lightning-base-components 1.28.14-alpha → 1.28.16-alpha
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/metadata/raptor.json +33 -11
- package/package.json +29 -1
- package/scopedImports/@salesforce-label-LightningControl.indeterminate.js +6 -0
- package/src/lightning/baseCombobox/baseCombobox.d.ts.map +1 -1
- package/src/lightning/baseCombobox/baseCombobox.js +3 -1
- package/src/lightning/combobox/combobox.d.ts.map +1 -1
- package/src/lightning/combobox/combobox.js +1 -1
- package/src/lightning/datatable/keyboard.d.ts.map +1 -1
- package/src/lightning/datatable/keyboard.js +4 -4
- package/src/lightning/dualListbox/dualListbox.d.ts +3 -0
- package/src/lightning/dualListbox/dualListbox.d.ts.map +1 -1
- package/src/lightning/dualListbox/dualListbox.html +5 -5
- package/src/lightning/dualListbox/dualListbox.js +15 -0
- package/src/lightning/dualListbox/dualListbox.lbc.empty.css +8 -0
- package/src/lightning/dualListbox/dualListbox.lbc.resizereflow.css +35 -0
- package/src/lightning/features/gates/imports.d.ts +5 -0
- package/src/lightning/features/gates/imports.d.ts.map +1 -1
- package/src/lightning/features/gates/imports.js +5 -0
- package/src/lightning/features/types.d.ts +5 -0
- package/src/lightning/features/types.d.ts.map +1 -1
- package/src/lightning/formattedRichText/colorShiftUtil.d.ts +17 -0
- package/src/lightning/formattedRichText/colorShiftUtil.d.ts.map +1 -0
- package/src/lightning/formattedRichText/colorShiftUtil.js +118 -0
- package/src/lightning/formattedRichText/formattedRichText.csr.html +3 -0
- package/src/lightning/formattedRichText/formattedRichText.d.ts +54 -2
- package/src/lightning/formattedRichText/formattedRichText.d.ts.map +1 -1
- package/src/lightning/formattedRichText/formattedRichText.js +253 -1
- package/src/lightning/formattedRichText/formattedRichText.ssr.html +8 -0
- package/src/lightning/formattedRichText/linkTextNodesSSR.d.ts +2 -0
- package/src/lightning/formattedRichText/linkTextNodesSSR.d.ts.map +1 -0
- package/src/lightning/formattedRichText/linkTextNodesSSR.js +37 -0
- package/src/lightning/formattedRichText/richTextConfig.d.ts +9 -0
- package/src/lightning/formattedRichText/richTextConfig.d.ts.map +1 -0
- package/src/lightning/formattedRichText/richTextConfig.js +176 -0
- package/src/lightning/formattedRichTextRenderer/formattedRichTextRenderer.d.ts.map +1 -1
- package/src/lightning/formattedRichTextRenderer/formattedRichTextRenderer.js +16 -12
- package/src/lightning/groupedCombobox/groupedCombobox.d.ts +4 -0
- package/src/lightning/groupedCombobox/groupedCombobox.d.ts.map +1 -1
- package/src/lightning/groupedCombobox/groupedCombobox.html +1 -0
- package/src/lightning/groupedCombobox/groupedCombobox.js +13 -1
- package/src/lightning/input/input.d.ts +4 -0
- package/src/lightning/input/input.d.ts.map +1 -1
- package/src/lightning/input/input.html +41 -18
- package/src/lightning/input/input.js +30 -0
- package/src/lightning/modalBase/modalBase.d.ts +1 -0
- package/src/lightning/modalBase/modalBase.d.ts.map +1 -1
- package/src/lightning/modalBase/modalBase.html +8 -0
- package/src/lightning/modalBase/modalBase.js +3 -0
- package/src/lightning/multiColumnSortingModal/multiColumnSortingModal.d.ts +1 -0
- package/src/lightning/multiColumnSortingModal/multiColumnSortingModal.d.ts.map +1 -1
- package/src/lightning/multiColumnSortingModal/multiColumnSortingModal.html +1 -1
- package/src/lightning/multiColumnSortingModal/multiColumnSortingModal.js +14 -0
- package/src/lightning/overlayBase/overlayBase.css +21 -0
- package/src/lightning/overlayBase/overlayBase.d.ts +28 -0
- package/src/lightning/overlayBase/overlayBase.d.ts.map +1 -0
- package/src/lightning/overlayBase/overlayBase.html +24 -0
- package/src/lightning/overlayBase/overlayBase.js +125 -0
- package/src/lightning/overlayBase/overlayBase.js-meta.xml +8 -0
- package/src/lightning/overlayPositionUtils/anchorPositioningAdapter.d.ts +24 -0
- package/src/lightning/overlayPositionUtils/anchorPositioningAdapter.d.ts.map +1 -0
- package/src/lightning/overlayPositionUtils/anchorPositioningAdapter.js +49 -0
- package/src/lightning/overlayPositionUtils/cssAnchorPositioning.d.ts +14 -0
- package/src/lightning/overlayPositionUtils/cssAnchorPositioning.d.ts.map +1 -0
- package/src/lightning/overlayPositionUtils/cssAnchorPositioning.js +94 -0
- package/src/lightning/overlayPositionUtils/overlayPositionUtils.d.ts +55 -0
- package/src/lightning/overlayPositionUtils/overlayPositionUtils.d.ts.map +1 -0
- package/src/lightning/overlayPositionUtils/overlayPositionUtils.js +107 -0
- package/src/lightning/overlayPositionUtils/overlayPositionUtils.js-meta.xml +6 -0
- package/src/lightning/overlayPositionUtils/positionLibraryFallback.d.ts +30 -0
- package/src/lightning/overlayPositionUtils/positionLibraryFallback.d.ts.map +1 -0
- package/src/lightning/overlayPositionUtils/positionLibraryFallback.js +435 -0
- package/src/lightning/primitiveCellFactory/primitiveCellFactory.d.ts +1 -1
- package/src/lightning/primitiveCellFactory/primitiveCellFactory.d.ts.map +1 -1
- package/src/lightning/primitiveCellFactory/primitiveCellFactory.js +4 -4
- package/src/lightning/primitiveHeaderFactory/selectableHeader.html +1 -0
- package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.d.ts +5 -1
- package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.d.ts.map +1 -1
- package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.js +35 -1
- package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.js +1 -1
- package/src/lightning/primitiveInputSimple/primitiveInputSimple.d.ts.map +1 -1
- package/src/lightning/primitiveInputSimple/primitiveInputSimple.js +2 -1
- package/src/lightning/primitiveOverlay/__examples__/alert/alert.d.ts +13 -0
- package/src/lightning/primitiveOverlay/__examples__/alert/alert.d.ts.map +1 -0
- package/src/lightning/primitiveOverlay/__examples__/alert/alert.html +27 -0
- package/src/lightning/primitiveOverlay/__examples__/alert/alert.js +34 -0
- package/src/lightning/primitiveOverlay/__examples__/basic/basic.css +7 -0
- package/src/lightning/primitiveOverlay/__examples__/basic/basic.d.ts +12 -0
- package/src/lightning/primitiveOverlay/__examples__/basic/basic.d.ts.map +1 -0
- package/src/lightning/primitiveOverlay/__examples__/basic/basic.html +18 -0
- package/src/lightning/primitiveOverlay/__examples__/basic/basic.js +58 -0
- package/src/lightning/primitiveOverlay/__examples__/demo/demo.d.ts +11 -0
- package/src/lightning/primitiveOverlay/__examples__/demo/demo.d.ts.map +1 -0
- package/src/lightning/primitiveOverlay/__examples__/demo/demo.html +29 -0
- package/src/lightning/primitiveOverlay/__examples__/demo/demo.js +41 -0
- package/src/lightning/primitiveOverlay/__examples__/panel/panel.d.ts +9 -0
- package/src/lightning/primitiveOverlay/__examples__/panel/panel.d.ts.map +1 -0
- package/src/lightning/primitiveOverlay/__examples__/panel/panel.html +17 -0
- package/src/lightning/primitiveOverlay/__examples__/panel/panel.js +24 -0
- package/src/lightning/primitiveOverlay/primitiveOverlay.d.ts +8 -0
- package/src/lightning/primitiveOverlay/primitiveOverlay.d.ts.map +1 -0
- package/src/lightning/primitiveOverlay/primitiveOverlay.html +4 -0
- package/src/lightning/primitiveOverlay/primitiveOverlay.js +37 -0
- package/src/lightning/primitiveOverlay/primitiveOverlay.js-meta.xml +7 -0
- package/src/lightning/tabBar/tabBar.d.ts.map +1 -1
- package/src/lightning/tabBar/tabBar.js +4 -1
- package/src/lightning/tooltipLibrary/tooltipLibrary.d.ts +5 -0
- package/src/lightning/tooltipLibrary/tooltipLibrary.d.ts.map +1 -1
- package/src/lightning/tooltipLibrary/tooltipLibrary.js +119 -5
|
@@ -11,7 +11,10 @@ import AriaObserver from 'lightning/ariaObserver';
|
|
|
11
11
|
import { features } from 'lightning/features';
|
|
12
12
|
export { Direction } from 'lightning/positionLibrary';
|
|
13
13
|
export const BUBBLE_PREFIX = `salesforce-lightning-tooltip-bubble`;
|
|
14
|
-
const
|
|
14
|
+
const BUBBLE_MODAL_PREFIX = `salesforce-lightning-tooltip-modal-portal`;
|
|
15
|
+
const BUBBLE_GUID = guid();
|
|
16
|
+
const BUBBLE_ID = `${BUBBLE_PREFIX}_${BUBBLE_GUID}`;
|
|
17
|
+
const BUBBLE_MODAL_ID = `${BUBBLE_MODAL_PREFIX}_${BUBBLE_GUID}`;
|
|
15
18
|
function isResizeObserverSupported() {
|
|
16
19
|
return window.ResizeObserver != null;
|
|
17
20
|
}
|
|
@@ -23,6 +26,9 @@ function getCachedBubbleElement() {
|
|
|
23
26
|
is: LightningPrimitiveBubble,
|
|
24
27
|
});
|
|
25
28
|
CACHED_BUBBLE_ELEMENT.contentId = BUBBLE_ID;
|
|
29
|
+
CACHED_BUBBLE_ELEMENT.contentModalPortalId = features.enableHelptextA11yInModal
|
|
30
|
+
? BUBBLE_MODAL_ID
|
|
31
|
+
: undefined;
|
|
26
32
|
CACHED_BUBBLE_ELEMENT.style.position = 'absolute';
|
|
27
33
|
CACHED_BUBBLE_ELEMENT.style.minWidth = '75px';
|
|
28
34
|
CACHED_BUBBLE_ELEMENT.disableVisibilityChangeOnLeave = true;
|
|
@@ -30,6 +36,20 @@ function getCachedBubbleElement() {
|
|
|
30
36
|
return CACHED_BUBBLE_ELEMENT;
|
|
31
37
|
}
|
|
32
38
|
const ARIA_DESCRIBEDBY = 'aria-describedby';
|
|
39
|
+
const MODAL_SELECTOR = '[data-modal][aria-modal="true"]';
|
|
40
|
+
const MODAL_TOOLTIP_PORTAL_SELECTOR = '[data-modal-tooltip-portal]';
|
|
41
|
+
const BUBBLE_BODY_SELECTOR = '.slds-popover__body';
|
|
42
|
+
function findTooltipPortalElement(target) {
|
|
43
|
+
if (import.meta.env.SSR || !target) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const dialog = target.closest?.(MODAL_SELECTOR);
|
|
47
|
+
const HTMLElementCtor = globalThis?.HTMLElement;
|
|
48
|
+
if (!dialog || !HTMLElementCtor || !(dialog instanceof HTMLElementCtor)) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return dialog.querySelector?.(MODAL_TOOLTIP_PORTAL_SELECTOR);
|
|
52
|
+
}
|
|
33
53
|
const NUBBIN_SIZE = 16;
|
|
34
54
|
const NUBBIN_OFFSET = 24;
|
|
35
55
|
export const TooltipType = {
|
|
@@ -51,6 +71,9 @@ export class Tooltip {
|
|
|
51
71
|
_target;
|
|
52
72
|
_element;
|
|
53
73
|
_type;
|
|
74
|
+
boundHandleTooltipMouseLeave;
|
|
75
|
+
_modalPortalElement = null;
|
|
76
|
+
_isTooltipInModal = false;
|
|
54
77
|
constructor(value, config) {
|
|
55
78
|
assert(!!config.target, 'target for tooltip is undefined or missing');
|
|
56
79
|
this.value = value;
|
|
@@ -76,6 +99,10 @@ export class Tooltip {
|
|
|
76
99
|
this.handleDocumentTouch = this.handleDocumentTouch.bind(this);
|
|
77
100
|
this.handleEscape = this.handleEscape.bind(this);
|
|
78
101
|
this.hide = this.hide.bind(this);
|
|
102
|
+
if (features.enableTooltipFlashingFix) {
|
|
103
|
+
this.boundHandleTooltipMouseLeave =
|
|
104
|
+
this._handleTooltipMouseLeave.bind(this);
|
|
105
|
+
}
|
|
79
106
|
}
|
|
80
107
|
detach() {
|
|
81
108
|
this._disabled = true;
|
|
@@ -106,10 +133,18 @@ export class Tooltip {
|
|
|
106
133
|
this._initialized = true;
|
|
107
134
|
}
|
|
108
135
|
}
|
|
136
|
+
getDescriptionElement() {
|
|
137
|
+
const { _modalPortalElement, _isTooltipInModal } = this;
|
|
138
|
+
return features.enableHelptextA11yInModal && _isTooltipInModal && _modalPortalElement
|
|
139
|
+
? _modalPortalElement
|
|
140
|
+
: this._element();
|
|
141
|
+
}
|
|
109
142
|
disconnect() {
|
|
110
143
|
if (this._ariaObserver) {
|
|
111
144
|
this._ariaObserver.disconnect();
|
|
112
145
|
}
|
|
146
|
+
this._modalPortalElement = null;
|
|
147
|
+
this._isTooltipInModal = false;
|
|
113
148
|
if (this._visible) {
|
|
114
149
|
this.hide();
|
|
115
150
|
}
|
|
@@ -161,6 +196,30 @@ export class Tooltip {
|
|
|
161
196
|
this.hide();
|
|
162
197
|
}
|
|
163
198
|
}
|
|
199
|
+
_handleTooltipMouseLeave = (event) => {
|
|
200
|
+
if (!this._visible) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (event instanceof MouseEvent && event.clientX && event.clientY) {
|
|
204
|
+
try {
|
|
205
|
+
const target = this._target();
|
|
206
|
+
if (target) {
|
|
207
|
+
const { clientX, clientY } = event;
|
|
208
|
+
const { left, right, top, bottom } = target.getBoundingClientRect();
|
|
209
|
+
const tolerance = 1;
|
|
210
|
+
if (clientX >= left - tolerance &&
|
|
211
|
+
clientX <= right + tolerance &&
|
|
212
|
+
clientY >= top - tolerance &&
|
|
213
|
+
clientY <= bottom + tolerance) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
catch (ex) {
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
this.hide();
|
|
222
|
+
};
|
|
164
223
|
addToggleListeners() {
|
|
165
224
|
const target = this._target();
|
|
166
225
|
if (!this._initialized && target) {
|
|
@@ -200,11 +259,19 @@ export class Tooltip {
|
|
|
200
259
|
this.hide(false);
|
|
201
260
|
return;
|
|
202
261
|
}
|
|
203
|
-
this.startPositioning()
|
|
262
|
+
this.startPositioning()
|
|
263
|
+
.then(() => {
|
|
204
264
|
if (this._initialResize) {
|
|
205
|
-
|
|
265
|
+
if (features.enableTooltipFlashingFix) {
|
|
266
|
+
tooltip.addEventListener('mouseleave', this.boundHandleTooltipMouseLeave);
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
tooltip.addEventListener('mouseleave', this.hide);
|
|
270
|
+
}
|
|
206
271
|
this._initialResize = false;
|
|
207
272
|
}
|
|
273
|
+
})
|
|
274
|
+
.catch(() => {
|
|
208
275
|
});
|
|
209
276
|
}
|
|
210
277
|
});
|
|
@@ -234,9 +301,36 @@ export class Tooltip {
|
|
|
234
301
|
this._visible = true;
|
|
235
302
|
this._initialResize = true;
|
|
236
303
|
const tooltip = this._element();
|
|
304
|
+
const target = this._target();
|
|
237
305
|
tooltip.visible = this._visible;
|
|
238
|
-
|
|
306
|
+
const { _value } = this;
|
|
307
|
+
tooltip.content = _value;
|
|
308
|
+
if (!import.meta.env.SSR &&
|
|
309
|
+
target &&
|
|
310
|
+
features.enableHelptextA11yInModal) {
|
|
311
|
+
this._modalPortalElement = null;
|
|
312
|
+
const portal = findTooltipPortalElement(target);
|
|
313
|
+
if (portal?.isConnected) {
|
|
314
|
+
this._modalPortalElement = portal;
|
|
315
|
+
this._isTooltipInModal = true;
|
|
316
|
+
portal.textContent = '';
|
|
317
|
+
portal.setAttribute('id', tooltip.contentModalPortalId);
|
|
318
|
+
portal.removeAttribute('aria-hidden');
|
|
319
|
+
const bubbleBody = tooltip.shadowRoot?.querySelector(BUBBLE_BODY_SELECTOR);
|
|
320
|
+
if (bubbleBody) {
|
|
321
|
+
bubbleBody.setAttribute('aria-hidden', 'true');
|
|
322
|
+
}
|
|
323
|
+
portal.textContent = _value;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
239
326
|
if (this._ariaObserver && this._root && this._root.isConnected) {
|
|
327
|
+
if (features.enableHelptextA11yInModal) {
|
|
328
|
+
this._ariaObserver.connect({
|
|
329
|
+
attribute: ARIA_DESCRIBEDBY,
|
|
330
|
+
targetNode: this._target(),
|
|
331
|
+
relatedNodes: this.getDescriptionElement(),
|
|
332
|
+
});
|
|
333
|
+
}
|
|
240
334
|
this._ariaObserver.sync();
|
|
241
335
|
}
|
|
242
336
|
this.startPositioning();
|
|
@@ -247,13 +341,33 @@ export class Tooltip {
|
|
|
247
341
|
hide(hideBubble = true) {
|
|
248
342
|
this._visible = false;
|
|
249
343
|
const tooltip = this._element();
|
|
344
|
+
const { _isTooltipInModal, _modalPortalElement } = this;
|
|
345
|
+
if (features.enableHelptextA11yInModal && _isTooltipInModal && _modalPortalElement) {
|
|
346
|
+
const portal = _modalPortalElement;
|
|
347
|
+
portal.setAttribute('aria-hidden', 'true');
|
|
348
|
+
portal.removeAttribute('id');
|
|
349
|
+
portal.textContent = '';
|
|
350
|
+
const bubbleBody = tooltip.shadowRoot
|
|
351
|
+
? tooltip.shadowRoot.querySelector(BUBBLE_BODY_SELECTOR)
|
|
352
|
+
: null;
|
|
353
|
+
if (bubbleBody) {
|
|
354
|
+
bubbleBody.removeAttribute('aria-hidden');
|
|
355
|
+
}
|
|
356
|
+
this._isTooltipInModal = false;
|
|
357
|
+
this._modalPortalElement = null;
|
|
358
|
+
}
|
|
250
359
|
if (hideBubble) {
|
|
251
360
|
tooltip.visible = this._visible;
|
|
252
361
|
}
|
|
253
362
|
this.stopPositioning();
|
|
254
363
|
document.removeEventListener('touchstart', this.handleDocumentTouch);
|
|
255
364
|
document.removeEventListener('keydown', this.handleEscape);
|
|
256
|
-
|
|
365
|
+
if (features.enableTooltipFlashingFix) {
|
|
366
|
+
tooltip.removeEventListener('mouseleave', this.boundHandleTooltipMouseLeave);
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
tooltip.removeEventListener('mouseleave', this.hide);
|
|
370
|
+
}
|
|
257
371
|
this.resizeObserver.unobserve(tooltip);
|
|
258
372
|
if (features.enableTooltipHoverDismiss) {
|
|
259
373
|
setActiveTooltip(null);
|