@aquera/nile-elements 1.2.8-beta-1.6 → 1.2.8-beta-1.8
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/demo/index.html +52 -70
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +285 -274
- package/dist/nile-auto-complete/index.cjs.js +1 -1
- package/dist/nile-auto-complete/index.esm.js +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.cjs.js +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.cjs.js.map +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.esm.js +17 -13
- package/dist/nile-auto-complete/nile-auto-complete.test.cjs.js +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.test.cjs.js.map +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.test.esm.js +1 -1
- package/dist/nile-auto-complete/portal-manager.cjs.js +2 -0
- package/dist/nile-auto-complete/portal-manager.cjs.js.map +1 -0
- package/dist/nile-auto-complete/portal-manager.esm.js +1 -0
- package/dist/nile-auto-complete/portal-utils.cjs.js +2 -0
- package/dist/nile-auto-complete/portal-utils.cjs.js.map +1 -0
- package/dist/nile-auto-complete/portal-utils.esm.js +1 -0
- package/dist/nile-chip/index.cjs.js +1 -1
- package/dist/nile-chip/index.esm.js +1 -1
- package/dist/nile-chip/nile-chip.cjs.js +1 -1
- package/dist/nile-chip/nile-chip.cjs.js.map +1 -1
- package/dist/nile-chip/nile-chip.esm.js +14 -7
- package/dist/nile-chip/nile-chip.test.cjs.js +1 -1
- package/dist/nile-chip/nile-chip.test.cjs.js.map +1 -1
- package/dist/nile-chip/nile-chip.test.esm.js +1 -1
- package/dist/nile-lite-tooltip/nile-lite-tooltip.cjs.js +1 -1
- package/dist/nile-lite-tooltip/nile-lite-tooltip.cjs.js.map +1 -1
- package/dist/nile-lite-tooltip/nile-lite-tooltip.esm.js +1 -1
- package/dist/src/nile-auto-complete/nile-auto-complete.d.ts +18 -1
- package/dist/src/nile-auto-complete/nile-auto-complete.js +131 -9
- package/dist/src/nile-auto-complete/nile-auto-complete.js.map +1 -1
- package/dist/src/nile-auto-complete/portal-manager.d.ts +41 -0
- package/dist/src/nile-auto-complete/portal-manager.js +308 -0
- package/dist/src/nile-auto-complete/portal-manager.js.map +1 -0
- package/dist/src/nile-auto-complete/portal-utils.d.ts +31 -0
- package/dist/src/nile-auto-complete/portal-utils.js +166 -0
- package/dist/src/nile-auto-complete/portal-utils.js.map +1 -0
- package/dist/src/nile-chip/nile-chip.d.ts +7 -0
- package/dist/src/nile-chip/nile-chip.js +53 -10
- package/dist/src/nile-chip/nile-chip.js.map +1 -1
- package/dist/src/nile-lite-tooltip/nile-lite-tooltip.d.ts +1 -0
- package/dist/src/nile-lite-tooltip/nile-lite-tooltip.js +41 -59
- package/dist/src/nile-lite-tooltip/nile-lite-tooltip.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-auto-complete/nile-auto-complete.ts +148 -13
- package/src/nile-auto-complete/portal-manager.ts +410 -0
- package/src/nile-auto-complete/portal-utils.ts +221 -0
- package/src/nile-chip/nile-chip.ts +54 -11
- package/src/nile-lite-tooltip/nile-lite-tooltip.ts +56 -75
- package/vscode-html-custom-data.json +17 -2
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type Placement,
|
|
3
|
+
type MiddlewareData
|
|
4
|
+
} from '@floating-ui/dom';
|
|
5
|
+
|
|
6
|
+
export class PortalUtils {
|
|
7
|
+
static calculateAvailableSpace(referenceElement: HTMLElement): {
|
|
8
|
+
spaceAbove: number;
|
|
9
|
+
spaceBelow: number;
|
|
10
|
+
viewportHeight: number;
|
|
11
|
+
} {
|
|
12
|
+
const rect = referenceElement.getBoundingClientRect();
|
|
13
|
+
const viewportHeight = window.innerHeight;
|
|
14
|
+
const spaceBelow = viewportHeight - rect.bottom;
|
|
15
|
+
const spaceAbove = rect.top;
|
|
16
|
+
|
|
17
|
+
return { spaceAbove, spaceBelow, viewportHeight };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static getOptimalPlacement(referenceElement: HTMLElement): Placement {
|
|
21
|
+
const { spaceAbove, spaceBelow } = this.calculateAvailableSpace(referenceElement);
|
|
22
|
+
|
|
23
|
+
if (spaceBelow < 200 && spaceAbove > spaceBelow) {
|
|
24
|
+
return 'top';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return 'bottom';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static findBoundaryElements(component: HTMLElement): Element[] | undefined {
|
|
31
|
+
const boundaryElements: Element[] = [];
|
|
32
|
+
|
|
33
|
+
let currentElement = component.parentElement;
|
|
34
|
+
|
|
35
|
+
while (currentElement && currentElement !== document.body) {
|
|
36
|
+
const computedStyle = window.getComputedStyle(currentElement);
|
|
37
|
+
const overflow = computedStyle.overflow;
|
|
38
|
+
const overflowY = computedStyle.overflowY;
|
|
39
|
+
const overflowX = computedStyle.overflowX;
|
|
40
|
+
|
|
41
|
+
if (overflow === 'auto' || overflow === 'scroll' ||
|
|
42
|
+
overflowY === 'auto' || overflowY === 'scroll' ||
|
|
43
|
+
overflowX === 'auto' || overflowX === 'scroll') {
|
|
44
|
+
boundaryElements.push(currentElement);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (currentElement.hasAttribute('data-floating-boundary') ||
|
|
48
|
+
currentElement.classList.contains('floating-boundary') ||
|
|
49
|
+
currentElement.classList.contains('scroll-container')) {
|
|
50
|
+
boundaryElements.push(currentElement);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
currentElement = currentElement.parentElement;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return boundaryElements.length > 0 ? boundaryElements : undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
static calculateOptimalHeight(
|
|
60
|
+
referenceRect: { x: number; y: number; width: number; height: number },
|
|
61
|
+
viewportHeight: number,
|
|
62
|
+
placement: Placement
|
|
63
|
+
): number {
|
|
64
|
+
const spaceBelow = viewportHeight - (referenceRect.y + referenceRect.height);
|
|
65
|
+
const spaceAbove = referenceRect.y;
|
|
66
|
+
|
|
67
|
+
if (spaceAbove > spaceBelow) {
|
|
68
|
+
return Math.max(spaceAbove - 20, 100);
|
|
69
|
+
}
|
|
70
|
+
else if (spaceBelow > spaceAbove) {
|
|
71
|
+
return Math.max(spaceBelow - 20, 100);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return Math.max(Math.min(spaceAbove, spaceBelow) - 20, 100);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
static extractStylesAsCSS(styles: any): string {
|
|
78
|
+
if (typeof styles === 'string') {
|
|
79
|
+
return styles;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (Array.isArray(styles)) {
|
|
83
|
+
return styles.map(style => this.extractStylesAsCSS(style)).join('\n');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (styles && typeof styles === 'object' && styles.cssText) {
|
|
87
|
+
return styles.cssText;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return '';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static generateStyleId(): string {
|
|
94
|
+
return `nile-auto-complete-styles-${Math.random().toString(36).substring(2, 11)}`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
static isPositioningOptimal(
|
|
98
|
+
placement: Placement,
|
|
99
|
+
referenceElement: HTMLElement
|
|
100
|
+
): boolean {
|
|
101
|
+
const { spaceAbove, spaceBelow } = this.calculateAvailableSpace(referenceElement);
|
|
102
|
+
|
|
103
|
+
const isAbove = placement.startsWith('top');
|
|
104
|
+
const isBelow = placement.startsWith('bottom');
|
|
105
|
+
|
|
106
|
+
if (isAbove && spaceBelow > spaceAbove) return false;
|
|
107
|
+
if (isBelow && spaceAbove > spaceBelow) return false;
|
|
108
|
+
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
static applyCollisionData(
|
|
113
|
+
element: HTMLElement,
|
|
114
|
+
middlewareData: MiddlewareData,
|
|
115
|
+
placement: Placement
|
|
116
|
+
): void {
|
|
117
|
+
if (middlewareData.flip) {
|
|
118
|
+
const { overflows } = middlewareData.flip;
|
|
119
|
+
|
|
120
|
+
element.setAttribute('data-placement', placement);
|
|
121
|
+
|
|
122
|
+
if (overflows && overflows.length > 0) {
|
|
123
|
+
const overflowPlacements = overflows.map(overflow => overflow.placement).join(',');
|
|
124
|
+
element.setAttribute('data-overflow', overflowPlacements);
|
|
125
|
+
} else {
|
|
126
|
+
element.removeAttribute('data-overflow');
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (middlewareData.shift) {
|
|
131
|
+
const { x, y } = middlewareData.shift;
|
|
132
|
+
|
|
133
|
+
if (x !== undefined && y !== undefined && (x !== 0 || y !== 0)) {
|
|
134
|
+
element.setAttribute('data-shift', `${x},${y}`);
|
|
135
|
+
} else {
|
|
136
|
+
element.removeAttribute('data-shift');
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (middlewareData.size) {
|
|
141
|
+
const { availableWidth, availableHeight } = middlewareData.size;
|
|
142
|
+
|
|
143
|
+
if (availableWidth !== undefined) {
|
|
144
|
+
element.setAttribute('data-available-width', availableWidth.toString());
|
|
145
|
+
}
|
|
146
|
+
if (availableHeight !== undefined) {
|
|
147
|
+
element.setAttribute('data-available-height', availableHeight.toString());
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export class PortalContentUtils {
|
|
154
|
+
static createBaseMenu(component: any): HTMLElement {
|
|
155
|
+
const menu = document.createElement('nile-menu');
|
|
156
|
+
menu.id = 'content-menu';
|
|
157
|
+
menu.className = component.enableVirtualScroll ? 'virtualized__menu' : '';
|
|
158
|
+
|
|
159
|
+
if (component.enableVirtualScroll) {
|
|
160
|
+
menu.setAttribute('exportparts', 'menu__items-wrapper:options__wrapper');
|
|
161
|
+
} else {
|
|
162
|
+
menu.setAttribute('exportparts', 'menu__items-wrapper:options__wrapper');
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return menu;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
static addMenuItems(menu: HTMLElement, component: any): void {
|
|
169
|
+
const menuItems = component.menuItems || [];
|
|
170
|
+
|
|
171
|
+
menuItems.forEach((item: any) => {
|
|
172
|
+
const menuItem = this.createMenuItem(item, component);
|
|
173
|
+
menu.appendChild(menuItem);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
static createMenuItem(item: any, component: any): HTMLElement {
|
|
178
|
+
const menuItem = document.createElement('nile-menu-item');
|
|
179
|
+
const value = component.renderItemFunction ? component.renderItemFunction(item) : item;
|
|
180
|
+
menuItem.setAttribute('value', String(value));
|
|
181
|
+
menuItem.innerHTML = String(value);
|
|
182
|
+
return menuItem;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
static createPortalMenu(component: any): HTMLElement {
|
|
186
|
+
const menu = this.createBaseMenu(component);
|
|
187
|
+
this.addMenuItems(menu, component);
|
|
188
|
+
return menu;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
static updatePortalMenuItems(clonedMenu: HTMLElement, component: any): void {
|
|
192
|
+
if (!clonedMenu) return;
|
|
193
|
+
|
|
194
|
+
// Remove existing items
|
|
195
|
+
const existingItems = clonedMenu.querySelectorAll('nile-menu-item');
|
|
196
|
+
existingItems.forEach(item => item.remove());
|
|
197
|
+
|
|
198
|
+
// Add updated items
|
|
199
|
+
this.addMenuItems(clonedMenu, component);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export class PortalEventUtils {
|
|
204
|
+
static setupPortalEventListeners(clonedMenu: HTMLElement, component: any): void {
|
|
205
|
+
if (!clonedMenu) return;
|
|
206
|
+
|
|
207
|
+
this.setupMenuSelectListeners(clonedMenu, component);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
static setupMenuSelectListeners(clonedMenu: HTMLElement, component: any): void {
|
|
211
|
+
if (!clonedMenu) return;
|
|
212
|
+
|
|
213
|
+
clonedMenu.addEventListener('nile-select', (event: Event) => {
|
|
214
|
+
const customEvent = event as CustomEvent;
|
|
215
|
+
if (component.handleSelect) {
|
|
216
|
+
// Call the component's handleSelect method directly
|
|
217
|
+
component.handleSelect(customEvent);
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
@@ -17,6 +17,7 @@ import { styles } from './nile-chip.css';
|
|
|
17
17
|
import { classMap } from 'lit/directives/class-map.js';
|
|
18
18
|
import { HasSlotController } from '../internal/slot';
|
|
19
19
|
import NileElement, { NileFormControl } from '../internal/nile-element';
|
|
20
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
20
21
|
|
|
21
22
|
interface CustomEventDetail {
|
|
22
23
|
value: string;
|
|
@@ -39,6 +40,7 @@ export class NileChip extends NileElement {
|
|
|
39
40
|
@state() inputValue: string = '';
|
|
40
41
|
|
|
41
42
|
@state() isDropdownOpen: boolean = false;
|
|
43
|
+
@state() tooltips: (string | null)[] = [];
|
|
42
44
|
|
|
43
45
|
@query('nile-auto-complete') autoComplete!: any;
|
|
44
46
|
|
|
@@ -78,6 +80,12 @@ export class NileChip extends NileElement {
|
|
|
78
80
|
/** Disables the input. */
|
|
79
81
|
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
80
82
|
|
|
83
|
+
/**
|
|
84
|
+
* When true, the dropdown menu will be appended to the document body instead of the parent container.
|
|
85
|
+
* This is useful when the parent has overflow: hidden, clip-path, or transform applied.
|
|
86
|
+
*/
|
|
87
|
+
@property({ type: Boolean, reflect: true }) portal = false;
|
|
88
|
+
|
|
81
89
|
// AUTO-COMPLETE-OPTIONS
|
|
82
90
|
|
|
83
91
|
/** Virtual scroll in dropdown options. */
|
|
@@ -103,6 +111,9 @@ export class NileChip extends NileElement {
|
|
|
103
111
|
|
|
104
112
|
@property({ attribute:false}) renderItemFunction: (item:any)=>string = (item:any)=>item;
|
|
105
113
|
|
|
114
|
+
|
|
115
|
+
@property({ type: Boolean }) showTooltip: boolean = false;
|
|
116
|
+
|
|
106
117
|
protected updated(changedProperties: PropertyValues): void {
|
|
107
118
|
super.updated(changedProperties);
|
|
108
119
|
if (changedProperties.has('autoCompleteOptions')) {
|
|
@@ -198,21 +209,35 @@ export class NileChip extends NileElement {
|
|
|
198
209
|
'nile-chip--open': this.isDropdownOpen,
|
|
199
210
|
})}
|
|
200
211
|
>
|
|
201
|
-
${this.tags.map(
|
|
202
|
-
|
|
212
|
+
${this.tags.map((tag, index) => {
|
|
213
|
+
const tooltipContent = this.tooltips[index];
|
|
214
|
+
const tagTemplate = html`
|
|
203
215
|
<nile-tag
|
|
204
216
|
class=${classMap({
|
|
205
217
|
'nile-chip__tags': true,
|
|
206
218
|
})}
|
|
207
|
-
.variant=${this.errorIndexes.includes(index)
|
|
219
|
+
.variant=${this.errorIndexes.includes(index)
|
|
220
|
+
? 'error'
|
|
221
|
+
: 'normal'}
|
|
208
222
|
@nile-remove=${() => this.handleRemove(tag)}
|
|
209
|
-
|
|
210
|
-
|
|
223
|
+
removable
|
|
224
|
+
?pill=${this.tagVariant !== 'normal'}
|
|
211
225
|
>
|
|
212
|
-
${tag}
|
|
226
|
+
${unsafeHTML(tag)}
|
|
213
227
|
</nile-tag>
|
|
214
|
-
|
|
215
|
-
|
|
228
|
+
`;
|
|
229
|
+
|
|
230
|
+
if (this.showTooltip && tooltipContent) {
|
|
231
|
+
return html`
|
|
232
|
+
<nile-lite-tooltip allowHTML .content=${tooltipContent}>
|
|
233
|
+
${tagTemplate}
|
|
234
|
+
</nile-lite-tooltip>
|
|
235
|
+
`;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return tagTemplate;
|
|
239
|
+
})}
|
|
240
|
+
|
|
216
241
|
<div class="nile-chip__auto-complete">
|
|
217
242
|
${this.noAutoComplete
|
|
218
243
|
? html`
|
|
@@ -235,6 +260,7 @@ export class NileChip extends NileElement {
|
|
|
235
260
|
.allMenuItems=${this.filteredAutoCompleteOptions}
|
|
236
261
|
.filterFunction=${this.filterFunction}
|
|
237
262
|
.renderItemFunction=${this.renderItemFunction}
|
|
263
|
+
.showTooltips=${this.showTooltip}
|
|
238
264
|
.loading="${this.loading}"
|
|
239
265
|
.value=${this.inputValue}
|
|
240
266
|
?isDropdownOpen=${this.isDropdownOpen}
|
|
@@ -242,6 +268,7 @@ export class NileChip extends NileElement {
|
|
|
242
268
|
.noOutline=${true}
|
|
243
269
|
.noPadding=${true}
|
|
244
270
|
.disabled=${this.disabled}
|
|
271
|
+
.portal=${this.portal}
|
|
245
272
|
openOnFocus
|
|
246
273
|
exportparts="options__wrapper, input, base"
|
|
247
274
|
.placeholder=${this.placeholder}
|
|
@@ -269,9 +296,25 @@ export class NileChip extends NileElement {
|
|
|
269
296
|
|
|
270
297
|
private handleSelect(event: CustomEvent<CustomEventDetail>) {
|
|
271
298
|
// Add the selected value to the tags array only if it doesn't already exist
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
299
|
+
const selectedValue = event.detail.value;
|
|
300
|
+
const selectedOption = this.autoCompleteOptions.find(
|
|
301
|
+
(opt) => opt.name === selectedValue || opt.id === selectedValue
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
let tooltipContent: string | null = null;
|
|
305
|
+
|
|
306
|
+
if (selectedOption?.tooltip) {
|
|
307
|
+
const { content, for: showFor } = selectedOption.tooltip;
|
|
308
|
+
if (!showFor || showFor === 'tag') {
|
|
309
|
+
tooltipContent = content;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
if (!this.noDuplicates || !this.tags.includes(selectedValue)) {
|
|
314
|
+
this.tags = [...this.tags, selectedValue];
|
|
315
|
+
this.tooltips = [...this.tooltips, tooltipContent];
|
|
316
|
+
|
|
317
|
+
this.emit('nile-chip-change', { value: this.tags});
|
|
275
318
|
this.resetInput();
|
|
276
319
|
}
|
|
277
320
|
}
|
|
@@ -127,6 +127,11 @@ export class NileliteTooltip extends NileElement {
|
|
|
127
127
|
this.attachTooltip();
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
public refresh() {
|
|
131
|
+
this.attachTooltip();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
|
|
130
135
|
private attachTooltip(): void {
|
|
131
136
|
this.destroyTooltips();
|
|
132
137
|
if (this.disabled) return;
|
|
@@ -181,105 +186,81 @@ export class NileliteTooltip extends NileElement {
|
|
|
181
186
|
return undefined;
|
|
182
187
|
},
|
|
183
188
|
};
|
|
189
|
+
|
|
190
|
+
let targets: HTMLElement[] = [];
|
|
191
|
+
|
|
184
192
|
if (this.for) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
if (this.targetEl) {
|
|
188
|
-
targets = [this.targetEl];
|
|
189
|
-
} else {
|
|
190
|
-
const selector = this.for.startsWith('.') ? this.for : `.${this.for}`;
|
|
193
|
+
const selector = this.for.trim();
|
|
194
|
+
try {
|
|
191
195
|
targets = Array.from(document.querySelectorAll(selector));
|
|
196
|
+
} catch {
|
|
197
|
+
targets = Array.from(document.querySelectorAll(`.${this.for}`));
|
|
192
198
|
}
|
|
193
|
-
|
|
194
|
-
if (
|
|
195
|
-
|
|
196
|
-
if (targets.length > 1) {
|
|
199
|
+
|
|
200
|
+
if (targets.length > 0) {
|
|
201
|
+
|
|
197
202
|
this.tooltipInstances = targets.map(el => {
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
const instance = tippy(el, {
|
|
203
|
+
const instance = tippy(el as HTMLElement, {
|
|
201
204
|
...options,
|
|
202
|
-
content:
|
|
205
|
+
content: el.getAttribute('content') || this.content,
|
|
203
206
|
});
|
|
204
|
-
|
|
205
207
|
instance.popper.querySelector('.tippy-box')?.classList.add(this.size);
|
|
206
208
|
return instance;
|
|
207
209
|
});
|
|
208
|
-
|
|
210
|
+
|
|
209
211
|
if (this.singleton && this.tooltipInstances.length > 1) {
|
|
210
212
|
this.singletonInstance = createSingleton(this.tooltipInstances, {
|
|
211
213
|
delay: [75, 0],
|
|
212
214
|
arrow: roundArrow,
|
|
213
215
|
moveTransition: 'transform 0.15s ease-out',
|
|
214
|
-
overrides: ['content'],
|
|
215
216
|
});
|
|
216
217
|
}
|
|
217
|
-
|
|
218
|
+
|
|
218
219
|
if (this.open) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
this.targetEl = targets[0];
|
|
227
|
-
|
|
228
|
-
const children = Array.from(this.targetEl.querySelectorAll('*'));
|
|
229
|
-
if (children.length > 0) {
|
|
230
|
-
this.tooltipInstances = children.map(child => {
|
|
231
|
-
const el = child as HTMLElement;
|
|
232
|
-
const localContent = el.getAttribute('content') || this.content;
|
|
233
|
-
|
|
234
|
-
const instance = tippy(el, {
|
|
235
|
-
...options,
|
|
236
|
-
content: localContent,
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
instance.popper.querySelector('.tippy-box')?.classList.add(this.size);
|
|
240
|
-
return instance;
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
if (this.singleton && this.tooltipInstances.length > 1) {
|
|
244
|
-
this.singletonInstance = createSingleton(this.tooltipInstances, {
|
|
245
|
-
delay: [75, 0],
|
|
246
|
-
arrow: roundArrow,
|
|
247
|
-
moveTransition: 'transform 0.15s ease-out',
|
|
248
|
-
overrides: ['content'],
|
|
220
|
+
queueMicrotask(() => {
|
|
221
|
+
this.singletonInstance?.show();
|
|
222
|
+
this.tooltipInstances?.forEach(t => t.show());
|
|
249
223
|
});
|
|
250
224
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const targetEl = document.getElementById(this.for);
|
|
229
|
+
if (targetEl) {
|
|
230
|
+
this.singleInstance = tippy(targetEl, options);
|
|
231
|
+
this.singleInstance.popper.querySelector('.tippy-box')?.classList.add(this.size);
|
|
232
|
+
if (this.open) queueMicrotask(() => this.singleInstance?.show());
|
|
233
|
+
return;
|
|
258
234
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const children = Array.from(this.querySelectorAll('*'));
|
|
238
|
+
if (children.length > 0) {
|
|
239
|
+
this.tooltipInstances = children.map(child => {
|
|
240
|
+
const el = child as HTMLElement;
|
|
241
|
+
const localContent = el.getAttribute('content') || this.content;
|
|
242
|
+
const instance = tippy(el, { ...options, content: localContent });
|
|
243
|
+
instance.popper.querySelector('.tippy-box')?.classList.add(this.size);
|
|
244
|
+
return instance;
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
if (this.singleton && this.tooltipInstances.length > 1) {
|
|
248
|
+
this.singletonInstance = createSingleton(this.tooltipInstances, {
|
|
249
|
+
delay: [75, 0],
|
|
250
|
+
arrow: roundArrow,
|
|
251
|
+
moveTransition: 'transform 0.15s ease-out',
|
|
252
|
+
});
|
|
263
253
|
}
|
|
264
|
-
|
|
265
|
-
this.prevDescribedby = this.targetEl.getAttribute('aria-describedby');
|
|
266
|
-
const describedby = this.prevDescribedby
|
|
267
|
-
? `${this.prevDescribedby} ${this.id}`
|
|
268
|
-
: this.id;
|
|
269
|
-
this.targetEl.setAttribute('aria-describedby', describedby);
|
|
270
|
-
|
|
271
|
-
this.singleInstance = tippy(this.targetEl, options);
|
|
272
|
-
if (this.size)
|
|
273
|
-
this.singleInstance.popper
|
|
274
|
-
.querySelector('.tippy-box')
|
|
275
|
-
?.classList.add(this.size);
|
|
254
|
+
|
|
276
255
|
if (this.open) {
|
|
277
|
-
queueMicrotask(() =>
|
|
256
|
+
queueMicrotask(() => {
|
|
257
|
+
this.singletonInstance?.show();
|
|
258
|
+
this.tooltipInstances?.forEach(t => t.show());
|
|
259
|
+
});
|
|
278
260
|
}
|
|
279
|
-
return;
|
|
280
261
|
}
|
|
281
|
-
|
|
282
|
-
|
|
262
|
+
}
|
|
263
|
+
|
|
283
264
|
|
|
284
265
|
private destroyTooltips(): void {
|
|
285
266
|
this.tooltipInstances?.forEach(t => t.destroy());
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
"name": "nile-auto-complete",
|
|
65
|
-
"description": "Attributes:\n\n * `disabled` {`boolean`} - \n\n * `isDropdownOpen` {`boolean`} - \n\n * `enableVirtualScroll` {`boolean`} - \n\n * `openOnFocus` {`boolean`} - \n\n * `value` {`string`} - \n\n * `placeholder` {`string`} - \n\n * `noBorder` {`boolean`} - \n\n * `noOutline` {`boolean`} - \n\n * `noPadding` {`boolean`} - \n\n * `loading` {`boolean`} - \n\n * `allMenuItems` - \n\nProperties:\n\n * `styles` - \n\n * `dropdownElement` - \n\n * `disabled` {`boolean`} - \n\n * `isDropdownOpen` {`boolean`} - \n\n * `enableVirtualScroll` {`boolean`} - \n\n * `openOnFocus` {`boolean`} - \n\n * `value` {`string`} - \n\n * `placeholder` {`string`} - \n\n * `noBorder` {`boolean`} - \n\n * `noOutline` {`boolean`} - \n\n * `noPadding` {`boolean`} - \n\n * `loading` {`boolean`} - \n\n * `filterFunction` - \n\n * `renderItemFunction` - \n\n * `allMenuItems` - \n\n * `menuItems` - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
|
65
|
+
"description": "Attributes:\n\n * `disabled` {`boolean`} - \n\n * `isDropdownOpen` {`boolean`} - \n\n * `portal` {`boolean`} - When true, the dropdown menu will be appended to the document body instead of the parent container.\nThis is useful when the parent has overflow: hidden, clip-path, or transform applied.\n\n * `enableVirtualScroll` {`boolean`} - \n\n * `openOnFocus` {`boolean`} - \n\n * `value` {`string`} - \n\n * `placeholder` {`string`} - \n\n * `noBorder` {`boolean`} - \n\n * `noOutline` {`boolean`} - \n\n * `noPadding` {`boolean`} - \n\n * `loading` {`boolean`} - \n\n * `allMenuItems` - \n\nProperties:\n\n * `styles` - \n\n * `dropdownElement` - \n\n * `inputElement` - \n\n * `disabled` {`boolean`} - \n\n * `isDropdownOpen` {`boolean`} - \n\n * `portal` {`boolean`} - When true, the dropdown menu will be appended to the document body instead of the parent container.\nThis is useful when the parent has overflow: hidden, clip-path, or transform applied.\n\n * `portalManager` - \n\n * `enableVirtualScroll` {`boolean`} - \n\n * `openOnFocus` {`boolean`} - \n\n * `value` {`string`} - \n\n * `placeholder` {`string`} - \n\n * `noBorder` {`boolean`} - \n\n * `noOutline` {`boolean`} - \n\n * `noPadding` {`boolean`} - \n\n * `loading` {`boolean`} - \n\n * `filterFunction` - \n\n * `renderItemFunction` - \n\n * `allMenuItems` - \n\n * `menuItems` - \n\n * `handleWindowResize` - \n\n * `handleWindowScroll` - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
|
66
66
|
"attributes": [
|
|
67
67
|
{
|
|
68
68
|
"name": "disabled",
|
|
@@ -74,6 +74,11 @@
|
|
|
74
74
|
"description": "`isDropdownOpen` {`boolean`} - \n\nProperty: isDropdownOpen\n\nDefault: false",
|
|
75
75
|
"valueSet": "v"
|
|
76
76
|
},
|
|
77
|
+
{
|
|
78
|
+
"name": "portal",
|
|
79
|
+
"description": "`portal` {`boolean`} - When true, the dropdown menu will be appended to the document body instead of the parent container.\nThis is useful when the parent has overflow: hidden, clip-path, or transform applied.\n\nProperty: portal\n\nDefault: false",
|
|
80
|
+
"valueSet": "v"
|
|
81
|
+
},
|
|
77
82
|
{
|
|
78
83
|
"name": "enableVirtualScroll",
|
|
79
84
|
"description": "`enableVirtualScroll` {`boolean`} - \n\nProperty: enableVirtualScroll\n\nDefault: false",
|
|
@@ -726,7 +731,7 @@
|
|
|
726
731
|
},
|
|
727
732
|
{
|
|
728
733
|
"name": "nile-chip",
|
|
729
|
-
"description": "Attributes:\n\n * `warning` {`boolean`} - Sets the input to a warning state, changing its visual appearance.\n\n * `noAutoComplete` {`boolean`} - \n\n * `error` {`boolean`} - Sets the input to an error state, changing its visual appearance.\n\n * `success` {`boolean`} - Sets the input to a success state, changing its visual appearance.\n\n * `noDuplicates` {`boolean`} - Disables the duplicate entries.\n\n * `label` {`string`} - The input's label. If you need to display HTML, use the `label` slot instead.\n\n * `tagVariant` {`string`} - \n\n * `acceptUserInput` {`boolean`} - Adds a clear button when the input is not empty.\n\n * `clearable` {`boolean`} - Adds a clear button when the input is not empty.\n\n * `placeholder` {`string`} - Placeholder text to show as a hint when the input is empty.\n\n * `readonly` {`boolean`} - Makes the input readonly.\n\n * `disabled` {`boolean`} - Disables the input.\n\n * `enableVirtualScroll` {`boolean`} - Virtual scroll in dropdown options.\n\n * `autoCompleteOptions` {`any[]`} - \n\n * `filteredAutoCompleteOptions` {`any[]`} - \n\n * `value` {`any[]`} - \n\n * `noWrap` {`boolean`} - \n\n * `loading` {`boolean`} - \n\n * `errorIndexes` {`number[]`} - \n\n * `help-text` {`string`} - \n\n * `error-message` {`string`} - \n\nProperties:\n\n * `hasSlotController` - \n\n * `tags` {`string[]`} - \n\n * `inputValue` {`string`} - \n\n * `isDropdownOpen` {`boolean`} - \n\n * `autoComplete` - \n\n * `warning` {`boolean`} - Sets the input to a warning state, changing its visual appearance.\n\n * `noAutoComplete` {`boolean`} - \n\n * `error` {`boolean`} - Sets the input to an error state, changing its visual appearance.\n\n * `success` {`boolean`} - Sets the input to a success state, changing its visual appearance.\n\n * `noDuplicates` {`boolean`} - Disables the duplicate entries.\n\n * `label` {`string`} - The input's label. If you need to display HTML, use the `label` slot instead.\n\n * `tagVariant` {`string`} - \n\n * `acceptUserInput` {`boolean`} - Adds a clear button when the input is not empty.\n\n * `clearable` {`boolean`} - Adds a clear button when the input is not empty.\n\n * `placeholder` {`string`} - Placeholder text to show as a hint when the input is empty.\n\n * `readonly` {`boolean`} - Makes the input readonly.\n\n * `disabled` {`boolean`} - Disables the input.\n\n * `enableVirtualScroll` {`boolean`} - Virtual scroll in dropdown options.\n\n * `autoCompleteOptions` {`any[]`} - \n\n * `filteredAutoCompleteOptions` {`any[]`} - \n\n * `value` {`any[]`} - \n\n * `noWrap` {`boolean`} - \n\n * `loading` {`boolean`} - \n\n * `errorIndexes` {`number[]`} - \n\n * `helpText` {`string`} - \n\n * `errorMessage` {`string`} - \n\n * `filterFunction` - \n\n * `renderItemFunction` - \n\n * `handleDocumentClick` - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
|
734
|
+
"description": "Attributes:\n\n * `warning` {`boolean`} - Sets the input to a warning state, changing its visual appearance.\n\n * `noAutoComplete` {`boolean`} - \n\n * `error` {`boolean`} - Sets the input to an error state, changing its visual appearance.\n\n * `success` {`boolean`} - Sets the input to a success state, changing its visual appearance.\n\n * `noDuplicates` {`boolean`} - Disables the duplicate entries.\n\n * `label` {`string`} - The input's label. If you need to display HTML, use the `label` slot instead.\n\n * `tagVariant` {`string`} - \n\n * `acceptUserInput` {`boolean`} - Adds a clear button when the input is not empty.\n\n * `clearable` {`boolean`} - Adds a clear button when the input is not empty.\n\n * `placeholder` {`string`} - Placeholder text to show as a hint when the input is empty.\n\n * `readonly` {`boolean`} - Makes the input readonly.\n\n * `disabled` {`boolean`} - Disables the input.\n\n * `portal` {`boolean`} - When true, the dropdown menu will be appended to the document body instead of the parent container.\nThis is useful when the parent has overflow: hidden, clip-path, or transform applied.\n\n * `enableVirtualScroll` {`boolean`} - Virtual scroll in dropdown options.\n\n * `autoCompleteOptions` {`any[]`} - \n\n * `filteredAutoCompleteOptions` {`any[]`} - \n\n * `value` {`any[]`} - \n\n * `noWrap` {`boolean`} - \n\n * `loading` {`boolean`} - \n\n * `errorIndexes` {`number[]`} - \n\n * `help-text` {`string`} - \n\n * `error-message` {`string`} - \n\n * `showTooltip` {`boolean`} - \n\nProperties:\n\n * `hasSlotController` - \n\n * `tags` {`string[]`} - \n\n * `inputValue` {`string`} - \n\n * `isDropdownOpen` {`boolean`} - \n\n * `tooltips` {`(string | null)[]`} - \n\n * `autoComplete` - \n\n * `warning` {`boolean`} - Sets the input to a warning state, changing its visual appearance.\n\n * `noAutoComplete` {`boolean`} - \n\n * `error` {`boolean`} - Sets the input to an error state, changing its visual appearance.\n\n * `success` {`boolean`} - Sets the input to a success state, changing its visual appearance.\n\n * `noDuplicates` {`boolean`} - Disables the duplicate entries.\n\n * `label` {`string`} - The input's label. If you need to display HTML, use the `label` slot instead.\n\n * `tagVariant` {`string`} - \n\n * `acceptUserInput` {`boolean`} - Adds a clear button when the input is not empty.\n\n * `clearable` {`boolean`} - Adds a clear button when the input is not empty.\n\n * `placeholder` {`string`} - Placeholder text to show as a hint when the input is empty.\n\n * `readonly` {`boolean`} - Makes the input readonly.\n\n * `disabled` {`boolean`} - Disables the input.\n\n * `portal` {`boolean`} - When true, the dropdown menu will be appended to the document body instead of the parent container.\nThis is useful when the parent has overflow: hidden, clip-path, or transform applied.\n\n * `enableVirtualScroll` {`boolean`} - Virtual scroll in dropdown options.\n\n * `autoCompleteOptions` {`any[]`} - \n\n * `filteredAutoCompleteOptions` {`any[]`} - \n\n * `value` {`any[]`} - \n\n * `noWrap` {`boolean`} - \n\n * `loading` {`boolean`} - \n\n * `errorIndexes` {`number[]`} - \n\n * `helpText` {`string`} - \n\n * `errorMessage` {`string`} - \n\n * `filterFunction` - \n\n * `renderItemFunction` - \n\n * `showTooltip` {`boolean`} - \n\n * `handleDocumentClick` - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
|
730
735
|
"attributes": [
|
|
731
736
|
{
|
|
732
737
|
"name": "warning",
|
|
@@ -785,6 +790,11 @@
|
|
|
785
790
|
"description": "`disabled` {`boolean`} - Disables the input.\n\nProperty: disabled\n\nDefault: false",
|
|
786
791
|
"valueSet": "v"
|
|
787
792
|
},
|
|
793
|
+
{
|
|
794
|
+
"name": "portal",
|
|
795
|
+
"description": "`portal` {`boolean`} - When true, the dropdown menu will be appended to the document body instead of the parent container.\nThis is useful when the parent has overflow: hidden, clip-path, or transform applied.\n\nProperty: portal\n\nDefault: false",
|
|
796
|
+
"valueSet": "v"
|
|
797
|
+
},
|
|
788
798
|
{
|
|
789
799
|
"name": "enableVirtualScroll",
|
|
790
800
|
"description": "`enableVirtualScroll` {`boolean`} - Virtual scroll in dropdown options.\n\nProperty: enableVirtualScroll\n\nDefault: false",
|
|
@@ -823,6 +833,11 @@
|
|
|
823
833
|
{
|
|
824
834
|
"name": "error-message",
|
|
825
835
|
"description": "`error-message` {`string`} - \n\nProperty: errorMessage\n\nDefault: "
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
"name": "showTooltip",
|
|
839
|
+
"description": "`showTooltip` {`boolean`} - \n\nProperty: showTooltip\n\nDefault: false",
|
|
840
|
+
"valueSet": "v"
|
|
826
841
|
}
|
|
827
842
|
]
|
|
828
843
|
},
|