lightning-base-components 1.21.2-alpha → 1.21.3-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 +28 -1
- package/package.json +28 -2
- package/scopedImports/@salesforce-label-LightningRichTextEditor.colorPicker.js +1 -0
- package/src/lightning/accordion/accordion-section.slds.css +3 -3
- package/src/lightning/accordion/accordion.slds.css +1 -2
- package/src/lightning/accordionSection/accordion-section.slds.css +3 -3
- package/src/lightning/accordionSection/accordionSection.js +3 -1
- package/src/lightning/accordionSection/button.slds.css +1 -1
- package/src/lightning/badge/badge.js +1 -0
- package/src/lightning/badge/badge.js-meta.xml +3 -0
- package/src/lightning/baseCombobox/base-combobox.slds.css +11 -6
- package/src/lightning/baseCombobox/baseCombobox.html +1 -1
- package/src/lightning/baseCombobox/baseCombobox.js +2 -2
- package/src/lightning/baseCombobox/baseCombobox.js-meta.xml +6 -0
- package/src/lightning/baseCombobox/input-text.slds.css +41 -68
- package/src/lightning/baseCombobox/keyboard.js +12 -4
- package/src/lightning/baseCombobox/listbox.slds.css +51 -99
- package/src/lightning/baseCombobox/spinner.slds.css +62 -62
- package/src/lightning/baseComboboxFormattedText/baseComboboxFormattedText.js-meta.xml +6 -0
- package/src/lightning/baseComboboxItem/baseComboboxItem.js +10 -6
- package/src/lightning/baseComboboxItem/baseComboboxItem.js-meta.xml +6 -0
- package/src/lightning/baseComboboxItem/listbox.slds.css +51 -99
- package/src/lightning/baseFormattedText/baseFormattedText.js +2 -2
- package/src/lightning/button/button.js +2 -1
- package/src/lightning/button/button.slds.css +1 -1
- package/src/lightning/buttonIcon/button-icon.slds.css +1 -1
- package/src/lightning/buttonIconStateful/button-icon-stateful.slds.css +4 -2
- package/src/lightning/buttonIconStateful/button-icon.slds.css +1 -1
- package/src/lightning/buttonIconStateful/button.slds.css +1 -1
- package/src/lightning/buttonMenu/button-icon.slds.css +1 -1
- package/src/lightning/buttonMenu/button-menu.slds.css +8 -2
- package/src/lightning/buttonMenu/button.slds.css +1 -1
- package/src/lightning/buttonStateful/button-stateful.slds.css +6 -2
- package/src/lightning/buttonStateful/button.slds.css +1 -1
- package/src/lightning/buttonStateful/buttonStateful.js +4 -1
- package/src/lightning/calendar/calendar.js-meta.xml +6 -0
- package/src/lightning/calendar/calendar.slds.css +9 -2
- package/src/lightning/colorPickerCustom/color-picker-custom.slds.css +22 -23
- package/src/lightning/colorPickerCustom/input-text.slds.css +41 -68
- package/src/lightning/colorPickerPanel/color-picker-panel.slds.css +9 -10
- package/src/lightning/colorPickerPanel/popover.slds.css +0 -2
- package/src/lightning/combobox/combobox.slds.css +1 -2
- package/src/lightning/combobox/form-element.slds.css +54 -54
- package/src/lightning/datatable/__examples__/customDatatableWrapper/customDatatableWrapper.js +0 -69
- package/src/lightning/datatable/__examples__/customDatatypeDeleteRowBtn/customDatatypeDeleteRowBtn.html +1 -1
- package/src/lightning/datatable/__examples__/customDatatypeDeleteRowBtn/customDatatypeDeleteRowBtn.js +1 -16
- package/src/lightning/datatable/__examples__/customDatatypeLink/customDatatypeLink.html +3 -3
- package/src/lightning/datatable/__examples__/customDatatypeRowOrderingBtn/customDatatypeRowOrderingBtn.html +1 -8
- package/src/lightning/datatable/__examples__/customDatatypeRowOrderingBtn/customDatatypeRowOrderingBtn.js +2 -39
- package/src/lightning/datatable/__examples__/customDatatypeTable/customNumber.html +1 -1
- package/src/lightning/datatable/__examples__/customDatatypeTable/customNumberEdit.html +2 -0
- package/src/lightning/datatable/__examples__/customDatatypeTable/deleteRow.html +3 -2
- package/src/lightning/datatable/__examples__/customDatatypeTable/iconPill.html +1 -1
- package/src/lightning/datatable/__examples__/customNestedComponent/customNestedComponent.html +10 -0
- package/src/lightning/datatable/__examples__/customNestedComponent/customNestedComponent.js +12 -0
- package/src/lightning/datatable/autoWidthStrategy.js +147 -191
- package/src/lightning/datatable/columnResizer.js +35 -35
- package/src/lightning/datatable/columnWidthManager.js +118 -177
- package/src/lightning/datatable/columns.js +90 -59
- package/src/lightning/datatable/datagrid.slds.css +187 -0
- package/src/lightning/datatable/datatable.js +248 -229
- package/src/lightning/datatable/errors.js +3 -0
- package/src/lightning/datatable/fixedWidthStrategy.js +22 -29
- package/src/lightning/datatable/headerActions.js +7 -9
- package/src/lightning/datatable/infiniteLoading.js +15 -15
- package/src/lightning/datatable/inlineEdit.js +255 -235
- package/src/lightning/datatable/keyboard.js +318 -282
- package/src/lightning/datatable/renderManager.js +10 -7
- package/src/lightning/datatable/resizeObserver.js +11 -59
- package/src/lightning/datatable/rowLevelActions.js +6 -5
- package/src/lightning/datatable/rowNumber.js +23 -23
- package/src/lightning/datatable/rowSelection.js +173 -145
- package/src/lightning/datatable/rowSelectionShared.js +13 -6
- package/src/lightning/datatable/rows.js +231 -196
- package/src/lightning/datatable/sort.js +26 -22
- package/src/lightning/datatable/templates/div/div.css +2 -57
- package/src/lightning/datatable/templates/div/div.html +13 -6
- package/src/lightning/datatable/templates/div/div.lbc.native.css +3 -0
- package/src/lightning/datatable/templates/div/div.lbc.synthetic.css +86 -0
- package/src/lightning/datatable/templates/table/table.html +1 -0
- package/src/lightning/datatable/utils.js +5 -5
- package/src/lightning/datatable/widthManagerShared.js +24 -21
- package/src/lightning/datatable/wrapText.js +25 -26
- package/src/lightning/datepicker/datepicker.js +32 -9
- package/src/lightning/datepicker/datepicker.js-meta.xml +6 -0
- package/src/lightning/datepicker/form-element.slds.css +54 -54
- package/src/lightning/datepicker/input-text.slds.css +41 -68
- package/src/lightning/datetimepicker/datetimepicker.js-meta.xml +6 -0
- package/src/lightning/datetimepicker/form-element.slds.css +54 -54
- package/src/lightning/datetimepicker/input-text.slds.css +41 -68
- package/src/lightning/dualListbox/dual-listbox.slds.css +7 -2
- package/src/lightning/dualListbox/form-element.slds.css +54 -54
- package/src/lightning/dualListbox/listbox.slds.css +51 -99
- package/src/lightning/dynamicIcon/dynamic-icon-strength.slds.css +1 -2
- package/src/lightning/dynamicIcon/dynamic-icon-trend.slds.css +1 -2
- package/src/lightning/formattedDateTime/formattedDateTime.js +7 -62
- package/src/lightning/formattedDateTime/formattedDateTime.js-meta.xml +3 -0
- package/src/lightning/formattedLocation/formattedLocation.html +1 -3
- package/src/lightning/formattedLocation/formattedLocation.js +3 -25
- package/src/lightning/formattedLookup/events.js +2 -4
- package/src/lightning/formattedNumber/formattedNumber.js +2 -49
- package/src/lightning/formattedRichText/formattedRichText.js +5 -5
- package/src/lightning/formattedRichText/linkTextNodes.js +58 -0
- package/src/lightning/groupedCombobox/form-element.slds.css +54 -54
- package/src/lightning/groupedCombobox/grouped-combobox.slds.css +0 -2
- package/src/lightning/groupedCombobox/groupedCombobox.js-meta.xml +1 -1
- package/src/lightning/groupedCombobox/input-text.slds.css +41 -68
- package/src/lightning/helptext/button-icon.slds.css +1 -1
- package/src/lightning/helptext/form-element.slds.css +54 -54
- package/src/lightning/icon/icon.slds.css +12 -25
- package/src/lightning/input/form-element.slds.css +54 -54
- package/src/lightning/inputAddress/form-element.slds.css +54 -54
- package/src/lightning/inputAddress/input-address.slds.css +1 -2
- package/src/lightning/inputAddress/input-text.slds.css +41 -68
- package/src/lightning/inputAddress/inputAddress.js +1 -0
- package/src/lightning/inputAddress/inputAddress.js-meta.xml +3 -0
- package/src/lightning/inputLocation/form-element.slds.css +54 -54
- package/src/lightning/inputLocation/input-location.slds.css +1 -2
- package/src/lightning/inputLocation/input-text.slds.css +41 -68
- package/src/lightning/inputName/form-element.slds.css +54 -54
- package/src/lightning/inputName/input-text.slds.css +41 -68
- package/src/lightning/interactiveDialogBase/interactive-dialog-base.slds.css +0 -3
- package/src/lightning/interactiveDialogBase/interactiveDialogBase.js-meta.xml +6 -0
- package/src/lightning/lookupAddress/form-element.slds.css +54 -54
- package/src/lightning/lookupAddress/listbox.slds.css +51 -99
- package/src/lightning/lookupAddress/location.js +2 -0
- package/src/lightning/lookupAddress/lookup-address.slds.css +0 -2
- package/src/lightning/lookupAddress/lookupAddress.js +15 -10
- package/src/lightning/menuDivider/menu-divider.slds.css +0 -2
- package/src/lightning/menuItem/menu-item.slds.css +8 -2
- package/src/lightning/menuSubheader/menu-subheader.slds.css +1 -2
- package/src/lightning/modalBase/modal-base.slds.css +3 -3
- package/src/lightning/modalBase/modalBase.js +0 -8
- package/src/lightning/modalBase/modalBase.js-meta.xml +6 -0
- package/src/lightning/modalBody/modal-body.slds.css +1 -2
- package/src/lightning/modalFooter/modal-footer.slds.css +2 -2
- package/src/lightning/modalFooter/modalFooter.js +0 -21
- package/src/lightning/modalHeader/modal-header.slds.css +1 -2
- package/src/lightning/modalHeader/modalHeader.js +0 -22
- package/src/lightning/overlay/overlay.js-meta.xml +6 -0
- package/src/lightning/pill/pill.slds.css +32 -58
- package/src/lightning/pillContainer/button.slds.css +1 -1
- package/src/lightning/pillContainer/listbox.slds.css +51 -99
- package/src/lightning/pillContainer/pill-container.slds.css +6 -10
- package/src/lightning/pillContainer/pill.slds.css +32 -58
- package/src/lightning/popup/popover.slds.css +0 -2
- package/src/lightning/primitiveBubble/primitiveBubble.js-meta.xml +6 -0
- package/src/lightning/primitiveButton/primitiveButoon.js-meta.xml +6 -0
- package/src/lightning/primitiveCellCheckbox/checkbox.css +2 -0
- package/src/lightning/primitiveColorpickerButton/color-picker-button.slds.css +16 -38
- package/src/lightning/primitiveCustomCell/primitiveCustomCell.js +26 -1
- package/src/lightning/primitiveHeaderFactory/nonsortableHeader.css +1 -0
- package/src/lightning/primitiveHeaderFactory/selectableHeader.css +2 -0
- package/src/lightning/primitiveIcon/icon.slds.css +12 -25
- package/src/lightning/primitiveIcon/primitiveIcon.js-meta.xml +6 -0
- package/src/lightning/primitiveIframe/primitiveIframe.js +3 -1
- package/src/lightning/primitiveInputCheckbox/form-element.slds.css +54 -54
- package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.js +5 -2
- package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.js-meta.xml +6 -0
- package/src/lightning/primitiveInputCheckboxButton/form-element.slds.css +54 -54
- package/src/lightning/primitiveInputCheckboxButton/input-checkbox-button.slds.css +6 -4
- package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.js +5 -2
- package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.js-meta.xml +6 -0
- package/src/lightning/primitiveInputColor/form-element.slds.css +54 -54
- package/src/lightning/primitiveInputColor/input-color.slds.css +2 -3
- package/src/lightning/primitiveInputColor/input-text.slds.css +41 -68
- package/src/lightning/primitiveInputColor/primitiveInputColor.js +5 -2
- package/src/lightning/primitiveInputColor/primitiveInputColor.js-meta.xml +6 -0
- package/src/lightning/primitiveInputFile/button.slds.css +1 -1
- package/src/lightning/primitiveInputFile/form-element.slds.css +54 -54
- package/src/lightning/primitiveInputFile/input-file.slds.css +1 -4
- package/src/lightning/primitiveInputFile/primitiveInputFile.js +4 -2
- package/src/lightning/primitiveInputFile/primitiveInputFile.js-meta.xml +6 -0
- package/src/lightning/primitiveInputRadio/primitiveInputRadio.js +4 -2
- package/src/lightning/primitiveInputSimple/form-element.slds.css +54 -54
- package/src/lightning/primitiveInputSimple/input-text.slds.css +41 -68
- package/src/lightning/primitiveInputSimple/primitiveInputSimple.js-meta.xml +6 -0
- package/src/lightning/primitiveInputToggle/form-element.slds.css +54 -54
- package/src/lightning/primitiveInputToggle/input-toggle.slds.css +50 -27
- package/src/lightning/primitiveInputToggle/primitiveInputToggle.js +5 -2
- package/src/lightning/primitiveInputToggle/primitiveInputToggle.js-meta.xml +6 -0
- package/src/lightning/progressBar/progress-bar.slds.css +8 -10
- package/src/lightning/progressRing/progress-ring.slds.css +0 -23
- package/src/lightning/progressStep/progressStep.js +1 -14
- package/src/lightning/radioGroup/form-element.slds.css +54 -54
- package/src/lightning/radioGroup/radioGroup.html +1 -2
- package/src/lightning/radioGroup/radioGroup.js +1 -0
- package/src/lightning/routingService/routingService.js +31 -5
- package/src/lightning/select/form-element.slds.css +54 -54
- package/src/lightning/select/select.slds.css +4 -2
- package/src/lightning/sldsUtilsVisibility/sldsUtilsVisibility.css +4 -0
- package/src/lightning/spinner/spinner.slds.css +62 -62
- package/src/lightning/tab/tab.js +4 -2
- package/src/lightning/tab/tab.slds.css +14 -7
- package/src/lightning/tabBar/tab-bar.slds.css +16 -6
- package/src/lightning/tabset/__docs__/tabset.md +24 -1
- package/src/lightning/tabset/tabset.js +25 -38
- package/src/lightning/tabset/tabset.slds.css +0 -2
- package/src/lightning/textarea/form-element.slds.css +54 -54
- package/src/lightning/textarea/textarea.js +5 -1
- package/src/lightning/textarea/textarea.slds.css +22 -9
- package/src/lightning/timepicker/form-element.slds.css +54 -54
- package/src/lightning/timepicker/timepicker.js-meta.xml +6 -0
- package/src/lightning/timepicker/timepicker.slds.css +2 -2
- package/src/lightning/toast/__docs__/toast.md +20 -22
- package/src/lightning/toast/button-icon.slds.css +1 -1
- package/src/lightning/toast/icon.slds.css +12 -25
- package/src/lightning/toast/toast.js +15 -12
- package/src/lightning/toast/toast.slds.css +6 -18
- package/src/lightning/toastContainer/toast.slds.css +6 -18
- package/src/lightning/toastContainer/toastContainer.js +25 -17
- package/src/lightning/tooltipLibrary/tooltipLibrary.js +12 -9
- package/src/lightning/tree/tree.js +2 -0
- package/src/lightning/utils/classSet.js +9 -3
- package/src/lightning/utilsPrivate/formatUtils.js +158 -0
- package/src/lightning/utilsPrivate/textUtils.js +16 -0
- package/src/lightning/utilsPrivate/utilsPrivate.js +56 -15
- package/src/lightning/utilsPrivate/validationUtils.js +59 -0
- package/src/lightning/verticalNavigationSection/vertical-navigation-section.slds.css +0 -2
- package/src/lightning/datatable/resizeSensor.js +0 -244
- package/src/lightning/formattedRichText/linkify.js +0 -43
- package/src/lightning/utilsPrivate/smartSetAttribute.js +0 -19
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
@supports (--styling-hooks: '') {
|
|
3
2
|
/* re-assign current slds hooks using deprecated naming conventions */
|
|
4
3
|
:host([data-render-mode="shadow"]) {
|
|
5
|
-
|
|
6
|
-
--slds-c-toast-spacing-
|
|
7
|
-
--slds-c-toast-spacing-
|
|
8
|
-
--slds-c-toast-spacing-
|
|
4
|
+
/* stylelint-disable */
|
|
5
|
+
--slds-c-toast-spacing-blockend: var(--slds-c-toast-spacing-block-end);
|
|
6
|
+
--slds-c-toast-spacing-blockstart: var(--slds-c-toast-spacing-block-start);
|
|
7
|
+
--slds-c-toast-spacing-inlineend: var(--slds-c-toast-spacing-inline-end);
|
|
8
|
+
--slds-c-toast-spacing-inlinestart: var(--slds-c-toast-spacing-inline-start);
|
|
9
|
+
/* stylelint-enable */
|
|
9
10
|
}
|
|
10
|
-
|
|
11
11
|
:host([data-render-mode="shadow"]) .slds-notify_toast {
|
|
12
12
|
display: inline-flex;
|
|
13
13
|
align-items: center;
|
|
@@ -25,32 +25,26 @@
|
|
|
25
25
|
text-align: left;
|
|
26
26
|
justify-content: flex-start;
|
|
27
27
|
}
|
|
28
|
-
|
|
29
28
|
:host([data-render-mode="shadow"]) .slds-notify_toast a {
|
|
30
29
|
color: currentcolor;
|
|
31
30
|
border: var(--slds-g-sizing-border-1) solid transparent;
|
|
32
31
|
border-radius: var(--slds-g-radius-border-2);
|
|
33
32
|
}
|
|
34
|
-
|
|
35
33
|
:host([data-render-mode="shadow"]) .slds-notify_toast a:hover,:host([data-render-mode="shadow"])
|
|
36
34
|
.slds-notify_toast a:focus {
|
|
37
35
|
text-decoration: none;
|
|
38
36
|
outline: 0;
|
|
39
37
|
}
|
|
40
|
-
|
|
41
38
|
:host([data-render-mode="shadow"]) .slds-notify_toast a:focus {
|
|
42
39
|
box-shadow: 0 0 3px var(--slds-g-info-container-1);
|
|
43
40
|
border: var(--slds-g-sizing-border-1) solid var(--slds-g-color-on-info-1);
|
|
44
41
|
}
|
|
45
|
-
|
|
46
42
|
:host([data-render-mode="shadow"]) .slds-notify_toast a:active {
|
|
47
43
|
color: var(--slds-g-color-neutral-100-opacity-50, rgba(255, 255, 255, 50%));
|
|
48
44
|
}
|
|
49
|
-
|
|
50
45
|
:host([data-render-mode="shadow"]) .slds-notify_toast a[disabled] {
|
|
51
46
|
color: var(--slds-g-color-neutral-100-opacity-10, rgba(255, 255, 255, 15%));
|
|
52
47
|
}
|
|
53
|
-
|
|
54
48
|
:host([data-render-mode="shadow"]) .slds-notify_toast .slds-notify__close {
|
|
55
49
|
float: right;
|
|
56
50
|
position: absolute;
|
|
@@ -59,19 +53,16 @@
|
|
|
59
53
|
margin-inline-start: var(--slds-g-spacing-1);
|
|
60
54
|
transform: translateY(-0.125rem);
|
|
61
55
|
}
|
|
62
|
-
|
|
63
56
|
:host([data-render-mode="shadow"]) .slds-region_narrow .slds-notify_toast {
|
|
64
57
|
min-width: auto;
|
|
65
58
|
width: 100%;
|
|
66
59
|
margin-inline-start: 0;
|
|
67
60
|
}
|
|
68
|
-
|
|
69
61
|
/* TODO W-12674349: remove after name-value-list utils are added */
|
|
70
62
|
:host([data-render-mode="shadow"]) .slds-list--inline {
|
|
71
63
|
display: inline-flex;
|
|
72
64
|
max-width: 100%;
|
|
73
65
|
}
|
|
74
|
-
|
|
75
66
|
/* TODO W-12674349: remove after assistive text util is added */
|
|
76
67
|
:host([data-render-mode="shadow"]) .slds-assistive-text {
|
|
77
68
|
position: absolute !important;
|
|
@@ -85,13 +76,11 @@
|
|
|
85
76
|
text-transform: none !important;
|
|
86
77
|
white-space: nowrap !important;
|
|
87
78
|
}
|
|
88
|
-
|
|
89
79
|
/* TODO W-12674349: remove after text utils are added */
|
|
90
80
|
:host([data-render-mode="shadow"]) .slds-text-heading_small {
|
|
91
81
|
font-size: var(--slds-g-font-size-base);
|
|
92
82
|
line-height: var(--slds-g-font-lineheight-2);
|
|
93
83
|
}
|
|
94
|
-
|
|
95
84
|
/* TODO W-12674349: remove after alert is added */
|
|
96
85
|
:host([data-render-mode="shadow"]) .slds-notify__close {
|
|
97
86
|
position: absolute;
|
|
@@ -100,4 +89,3 @@
|
|
|
100
89
|
margin-inline-start: var(--slds-g-spacing-1);
|
|
101
90
|
transform: translateY(-50%);
|
|
102
91
|
}
|
|
103
|
-
}
|
|
@@ -6,7 +6,11 @@ import {
|
|
|
6
6
|
requiredProperties,
|
|
7
7
|
} from 'lightning/overlayUtils';
|
|
8
8
|
import { SHOW_TOAST_EVENT_NAME } from 'lightning/showToastEvent';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
normalizeNumber,
|
|
11
|
+
normalizeString,
|
|
12
|
+
isCSR,
|
|
13
|
+
} from 'lightning/utilsPrivate';
|
|
10
14
|
import { createF6Controller } from 'lightning/f6Controller';
|
|
11
15
|
import {
|
|
12
16
|
getElementWithFocus,
|
|
@@ -449,22 +453,26 @@ export default class ToastContainer extends LightningOverlay {
|
|
|
449
453
|
* @returns {ToastContainer} instance of the toast container
|
|
450
454
|
*/
|
|
451
455
|
static instance(config = {}) {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
456
|
+
if (isCSR) {
|
|
457
|
+
// create a instance if container does not exist
|
|
458
|
+
if (globalContainer.length < MAX_NUM_GLOBAL_TOAST_CONTAINER) {
|
|
459
|
+
ToastContainer.open(config);
|
|
460
|
+
return getGlobalContainer();
|
|
461
|
+
}
|
|
462
|
+
let toastContainer = getGlobalContainer();
|
|
463
|
+
if (!toastContainer.isConnected) {
|
|
464
|
+
// remove the container if it does not attached to the DOM anymore
|
|
465
|
+
toastContainer.close();
|
|
466
|
+
toastContainer = null;
|
|
467
|
+
// create a new one and returns it
|
|
468
|
+
ToastContainer.open(config);
|
|
469
|
+
return getGlobalContainer();
|
|
470
|
+
}
|
|
471
|
+
// set container attribute if already exists
|
|
472
|
+
configure(toastContainer, config);
|
|
473
|
+
return toastContainer;
|
|
465
474
|
}
|
|
466
|
-
//
|
|
467
|
-
|
|
468
|
-
return toastContainer;
|
|
475
|
+
// Return an empty object in the server context, any property assignments will be harmless
|
|
476
|
+
return {};
|
|
469
477
|
}
|
|
470
478
|
}
|
|
@@ -97,6 +97,8 @@ export class Tooltip {
|
|
|
97
97
|
this._config = { ...config };
|
|
98
98
|
this._config.align = config.align || {};
|
|
99
99
|
this._config.targetAlign = config.targetAlign || {};
|
|
100
|
+
this._config.disableAriaDescribedBy =
|
|
101
|
+
config.disableAriaDescribedBy || false;
|
|
100
102
|
|
|
101
103
|
this._type = normalizeString(config.type, {
|
|
102
104
|
fallbackValue: TooltipType.Info,
|
|
@@ -148,20 +150,21 @@ export class Tooltip {
|
|
|
148
150
|
break;
|
|
149
151
|
}
|
|
150
152
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
this._ariaObserver.connect({
|
|
154
|
-
attribute: ARIA_DESCRIBEDBY,
|
|
155
|
-
targetNode: this._target(),
|
|
156
|
-
relatedNodes: this._element(),
|
|
157
|
-
});
|
|
153
|
+
if (!this._config.disableAriaDescribedBy) {
|
|
154
|
+
this._ariaObserver = new AriaObserver(this._root);
|
|
158
155
|
|
|
156
|
+
this._ariaObserver.connect({
|
|
157
|
+
attribute: ARIA_DESCRIBEDBY,
|
|
158
|
+
targetNode: this._target(),
|
|
159
|
+
relatedNodes: this._element(),
|
|
160
|
+
});
|
|
161
|
+
}
|
|
159
162
|
this._initialized = true;
|
|
160
163
|
}
|
|
161
164
|
}
|
|
162
165
|
|
|
163
166
|
disconnect() {
|
|
164
|
-
this._ariaObserver.disconnect();
|
|
167
|
+
if (this._ariaObserver) this._ariaObserver.disconnect();
|
|
165
168
|
}
|
|
166
169
|
|
|
167
170
|
addInfoListeners() {
|
|
@@ -308,7 +311,7 @@ export class Tooltip {
|
|
|
308
311
|
tooltip.visible = this._visible;
|
|
309
312
|
tooltip.content = this._value;
|
|
310
313
|
|
|
311
|
-
if (this._root && this._root.isConnected) {
|
|
314
|
+
if (this._ariaObserver && this._root && this._root.isConnected) {
|
|
312
315
|
this._ariaObserver.sync();
|
|
313
316
|
}
|
|
314
317
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { classSetToString } from 'lightning/utilsPrivate';
|
|
2
|
-
|
|
3
1
|
function classNamesHash(hash, classes) {
|
|
4
2
|
if (typeof classes === 'string') {
|
|
5
3
|
const array = classes.trim().split(/\s+/);
|
|
@@ -24,7 +22,15 @@ const proto = {
|
|
|
24
22
|
return this;
|
|
25
23
|
},
|
|
26
24
|
toString() {
|
|
27
|
-
|
|
25
|
+
let string = '';
|
|
26
|
+
const keys = Object.keys(this);
|
|
27
|
+
for (let i = 0, { length } = keys; i < length; i += 1) {
|
|
28
|
+
const key = keys[i];
|
|
29
|
+
if (this[key]) {
|
|
30
|
+
string += (string.length ? ' ' : '') + key;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return string;
|
|
28
34
|
},
|
|
29
35
|
};
|
|
30
36
|
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isValidDate,
|
|
3
|
+
isValidLatitude,
|
|
4
|
+
isValidLongitude,
|
|
5
|
+
} from './validationUtils';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Convert a LightningFormattedDate instance (or similar) to a dateTimeFormat
|
|
9
|
+
* options object.
|
|
10
|
+
*
|
|
11
|
+
* @param {LightningFormattedDateLike} instance
|
|
12
|
+
* An instance of the LightningFormattedDate class,
|
|
13
|
+
* or config object matching the public API.
|
|
14
|
+
* @returns {object} The dateTimeFormat options object.
|
|
15
|
+
*/
|
|
16
|
+
export function toDateTimeFormatOptions(instance) {
|
|
17
|
+
const options = {
|
|
18
|
+
weekday: instance.weekday,
|
|
19
|
+
era: instance.era,
|
|
20
|
+
year: instance.year,
|
|
21
|
+
month: instance.month,
|
|
22
|
+
day: instance.day,
|
|
23
|
+
hour: instance.hour,
|
|
24
|
+
hourCycle: undefined,
|
|
25
|
+
hour12: undefined,
|
|
26
|
+
minute: instance.minute,
|
|
27
|
+
second: instance.second,
|
|
28
|
+
timeZoneName: instance.timeZoneName,
|
|
29
|
+
timeZone: instance.timeZone,
|
|
30
|
+
};
|
|
31
|
+
const { hour12 } = instance;
|
|
32
|
+
// If hour12 is set, then we use it, otherwise locale defaults will be used
|
|
33
|
+
if (instance._hour12Set) {
|
|
34
|
+
// TODO: W-7787708: Remove hourCycle workaround below when possible.
|
|
35
|
+
// W-7583911: Temporarily works around an hourCycle spec bug that only Chrome has
|
|
36
|
+
// implemented causing the default hourCycle to be 'h24' rather than 'h23' when hour12 is
|
|
37
|
+
// false in 12-hour locales. Chrome ends up displaying times like '24:45'. Spec bug fix PR:
|
|
38
|
+
// https://github.com/tc39/ecma402/pull/436/files
|
|
39
|
+
if (hour12 === false) {
|
|
40
|
+
options.hourCycle = 'h23';
|
|
41
|
+
} else {
|
|
42
|
+
options.hour12 = hour12;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return options;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Convert a LightningFormattedDate instance (or similar) to a string.
|
|
50
|
+
* Allows for formatting a date without the overhead of instantiating a whole
|
|
51
|
+
* component.
|
|
52
|
+
*
|
|
53
|
+
* @param {LightningFormattedDateLike} instance
|
|
54
|
+
* An instance of the LightningFormattedDate class,
|
|
55
|
+
* or config object matching the public API.
|
|
56
|
+
* @returns {string} The date as a string.
|
|
57
|
+
*/
|
|
58
|
+
export function toFormattedDate(instance, dateTimeFormat) {
|
|
59
|
+
const { value } = instance;
|
|
60
|
+
if (isValidDate(value)) {
|
|
61
|
+
const formatted = dateTimeFormat(
|
|
62
|
+
toDateTimeFormatOptions(instance)
|
|
63
|
+
).format(value);
|
|
64
|
+
if (formatted) {
|
|
65
|
+
return formatted;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// eslint-disable-line no-console
|
|
69
|
+
console.warn(
|
|
70
|
+
`<lightning-formatted-date-time> The value attribute accepts either a Date object, a timestamp, or a valid ISO8601 formatted string ` +
|
|
71
|
+
`with timezone offset. but we are getting the ${typeof value} value "${value}" instead.`
|
|
72
|
+
);
|
|
73
|
+
return '';
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Convert a LightningFormattedLocation instance (or similar) to a string.
|
|
78
|
+
* Allows for formatting a location without the overhead of instantiating a whole
|
|
79
|
+
* component.
|
|
80
|
+
*
|
|
81
|
+
* @param {LightningFormattedLocationLike} instance
|
|
82
|
+
* An instance of the LightningFormattedLocation class,
|
|
83
|
+
* or config object matching the public API.
|
|
84
|
+
* @returns {string} The latitude and longitude as a string.
|
|
85
|
+
*/
|
|
86
|
+
export function toFormattedLocation(instance) {
|
|
87
|
+
const { latitude, longitude } = instance;
|
|
88
|
+
if (isValidLatitude(latitude) && isValidLongitude(longitude)) {
|
|
89
|
+
return `${latitude}, ${longitude}`;
|
|
90
|
+
}
|
|
91
|
+
// eslint-disable-next-line no-console
|
|
92
|
+
console.warn(
|
|
93
|
+
`<lightning-formatted-location> expects latitude in range [-90.0, 90.0], longitude in range [-180.0, 180.0].`
|
|
94
|
+
);
|
|
95
|
+
return '';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Convert a LightningFormattedNumber instance (or similar) to a string.
|
|
100
|
+
* Allows for formatting a number without the overhead of instantiating a whole
|
|
101
|
+
* component.
|
|
102
|
+
*
|
|
103
|
+
* @param {LightningFormattedNumberLike} instance
|
|
104
|
+
* An instance of the LightningFormattedNumber class,
|
|
105
|
+
* or config object matching the public API.
|
|
106
|
+
* @returns {string} The number as a string.
|
|
107
|
+
*/
|
|
108
|
+
export function toFormattedNumber(instance, numberFormat) {
|
|
109
|
+
const { value } = instance;
|
|
110
|
+
if (
|
|
111
|
+
value !== null &&
|
|
112
|
+
value !== undefined &&
|
|
113
|
+
value !== '' &&
|
|
114
|
+
isFinite(value)
|
|
115
|
+
) {
|
|
116
|
+
const { formatStyle } = instance;
|
|
117
|
+
const options = {
|
|
118
|
+
style: formatStyle,
|
|
119
|
+
currency: instance.currencyCode,
|
|
120
|
+
currencyDisplay: instance.currencyDisplayAs,
|
|
121
|
+
minimumIntegerDigits: instance.minimumIntegerDigits,
|
|
122
|
+
minimumFractionDigits: instance.minimumFractionDigits,
|
|
123
|
+
maximumFractionDigits: instance.maximumFractionDigits,
|
|
124
|
+
minimumSignificantDigits: instance.minimumSignificantDigits,
|
|
125
|
+
maximumSignificantDigits: instance.maximumSignificantDigits,
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const valueAsString = String(value);
|
|
129
|
+
|
|
130
|
+
let valueToFormat = valueAsString;
|
|
131
|
+
|
|
132
|
+
// percent-fixed just divides the value by 100
|
|
133
|
+
// before passing to the library, this is to deal with the
|
|
134
|
+
// fact that percentages in salesforce are 0-100, not 0-1
|
|
135
|
+
if (formatStyle === 'percent-fixed') {
|
|
136
|
+
options.style = 'percent';
|
|
137
|
+
|
|
138
|
+
valueToFormat = parseFloat(value) / 100;
|
|
139
|
+
|
|
140
|
+
// If the number contains fraction digits and is not in an exponent format
|
|
141
|
+
if (
|
|
142
|
+
valueAsString.indexOf('.') > 0 &&
|
|
143
|
+
valueAsString.indexOf('e') < 0
|
|
144
|
+
) {
|
|
145
|
+
// Depending on the input number, division by 100 may lead to rounding errors
|
|
146
|
+
// (e.g 0.785 / 100 is 0.007850000000000001), so we need to round back
|
|
147
|
+
// to the correct precision, that is - existing number of fractional digits
|
|
148
|
+
// plus extra 2 for division by 100.
|
|
149
|
+
valueToFormat = valueToFormat.toFixed(
|
|
150
|
+
valueAsString.split('.')[1].length + 2
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return numberFormat(options).format(valueToFormat);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return '';
|
|
158
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const hexColorCodesRegExp = /^#[0-9abcdef]{6}$/i;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Determine if a value should ignore RTL text formatting.
|
|
5
|
+
*
|
|
6
|
+
* @param {any} value The value to check.
|
|
7
|
+
* @returns {boolean} Whether the provided value should ignore RTL text formatting.
|
|
8
|
+
*/
|
|
9
|
+
export function isTextIgnoreRTL(value) {
|
|
10
|
+
return (
|
|
11
|
+
typeof value === 'string' &&
|
|
12
|
+
value !== '' &&
|
|
13
|
+
// Ignoring RTL for hex color codes
|
|
14
|
+
hexColorCodesRegExp.test(value)
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import formFactor from '@salesforce/client/formFactor';
|
|
2
|
+
import { isCSR } from './ssr';
|
|
3
|
+
|
|
1
4
|
export { assert } from './assert';
|
|
2
5
|
export {
|
|
3
6
|
ARIA,
|
|
@@ -44,30 +47,70 @@ export {
|
|
|
44
47
|
} from './linkify';
|
|
45
48
|
export { isValidPageReference } from './pageReference';
|
|
46
49
|
export { isMacOS, isWindowsOS, isiOS, isAndroidOS } from './os';
|
|
47
|
-
|
|
48
|
-
import { smartSetAttribute } from './smartSetAttribute';
|
|
49
|
-
|
|
50
50
|
export {
|
|
51
51
|
VALID_HEADING_LEVELS,
|
|
52
52
|
isHeadingLevelValid,
|
|
53
53
|
} from './ariaLevelHeadingUtils.js';
|
|
54
|
+
export {
|
|
55
|
+
toDateTimeFormatOptions,
|
|
56
|
+
toFormattedDate,
|
|
57
|
+
toFormattedLocation,
|
|
58
|
+
toFormattedNumber,
|
|
59
|
+
} from './formatUtils';
|
|
60
|
+
export { isTextIgnoreRTL } from './textUtils';
|
|
61
|
+
export {
|
|
62
|
+
isValidDate,
|
|
63
|
+
isValidLatitude,
|
|
64
|
+
isValidLongitude,
|
|
65
|
+
isValidPhone,
|
|
66
|
+
} from './validationUtils';
|
|
67
|
+
export { isCSR };
|
|
54
68
|
|
|
55
|
-
|
|
56
|
-
|
|
69
|
+
const LIGHTNING_TAG_REGEXP = /^LIGHTNING/i;
|
|
70
|
+
const LIGHTNING_DASH_NAME_REGEXP = /-\w/g;
|
|
71
|
+
|
|
72
|
+
function dashWordCharReplacement(dashWordCharMatch) {
|
|
73
|
+
return dashWordCharMatch[1].toUpperCase();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function synchronizeHTMLElementAttrs(element, attrs) {
|
|
77
|
+
const attrNames = Object.keys(attrs);
|
|
78
|
+
for (let i = 0, { length } = attrNames; i < length; i += 1) {
|
|
79
|
+
const attrName = attrNames[i];
|
|
80
|
+
const attrValue = attrs[attrName];
|
|
81
|
+
if (attrValue) {
|
|
82
|
+
element.setAttribute(attrName, attrValue);
|
|
83
|
+
} else {
|
|
84
|
+
element.removeAttribute(attrName);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function synchronizeLightningElementAttrs(element, attrs) {
|
|
90
|
+
const attrNames = Object.keys(attrs);
|
|
91
|
+
for (let i = 0, { length } = attrNames; i < length; i += 1) {
|
|
92
|
+
const attrName = attrNames[i];
|
|
93
|
+
const attrValue = attrs[attrName];
|
|
94
|
+
const normalizedName = attrName.replace(
|
|
95
|
+
LIGHTNING_DASH_NAME_REGEXP,
|
|
96
|
+
dashWordCharReplacement
|
|
97
|
+
);
|
|
98
|
+
element[normalizedName] = attrValue || null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
57
101
|
|
|
58
102
|
/**
|
|
59
103
|
* @param {HTMLElement} element Element to act on
|
|
60
104
|
* @param {Object} values values and attributes to set, if the value is
|
|
61
105
|
* falsy it the attribute will be removed
|
|
62
106
|
*/
|
|
63
|
-
export function synchronizeAttrs(element,
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
smartSetAttribute(element, attr, values[attr]);
|
|
107
|
+
export function synchronizeAttrs(element, attrs) {
|
|
108
|
+
if (element) {
|
|
109
|
+
if (LIGHTNING_TAG_REGEXP.test(element.tagName)) {
|
|
110
|
+
synchronizeLightningElementAttrs(element, attrs);
|
|
111
|
+
} else {
|
|
112
|
+
synchronizeHTMLElementAttrs(element, attrs);
|
|
113
|
+
}
|
|
71
114
|
}
|
|
72
115
|
}
|
|
73
116
|
|
|
@@ -142,7 +185,6 @@ export function getShadowActiveElements() {
|
|
|
142
185
|
}
|
|
143
186
|
|
|
144
187
|
export function isRTL() {
|
|
145
|
-
const isCSR = typeof window !== 'undefined';
|
|
146
188
|
// document does not exist on server and MRT does not support RTL below the root component (https://gus.lightning.force.com/lightning/r/ADM_Epic__c/a3QEE000000KEOb2AO/view)
|
|
147
189
|
return isCSR && document.dir === 'rtl';
|
|
148
190
|
}
|
|
@@ -166,7 +208,6 @@ export function getZIndexBaseline() {
|
|
|
166
208
|
// When SLDS styles are present, typically on Core
|
|
167
209
|
// this currently resolves to: '9000' (string)
|
|
168
210
|
// If function is called in server context, use default as window and document are not available.
|
|
169
|
-
const isCSR = typeof window !== 'undefined';
|
|
170
211
|
const modalZindexValueLwc = isCSR
|
|
171
212
|
? (
|
|
172
213
|
window.getComputedStyle(document.documentElement) ||
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { isValidISODateTimeString } from 'lightning/iso8601Utils';
|
|
2
|
+
|
|
3
|
+
const MAX_LONGITUDE = 180.0;
|
|
4
|
+
const MAX_LATITUDE = 90.0;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Determine if a value is a valid date.
|
|
8
|
+
*
|
|
9
|
+
* @param {any} value The value to validate.
|
|
10
|
+
* @returns {boolean} Whether the provided value is a valid date or not.
|
|
11
|
+
*/
|
|
12
|
+
export function isValidDate(value) {
|
|
13
|
+
if (value === null || value === undefined || value === '') {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return isFinite(value) || isValidISODateTimeString(value);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Determine if a value is a valid latitude.
|
|
21
|
+
*
|
|
22
|
+
* @param {any} value The value to validate.
|
|
23
|
+
* @returns {boolean} Whether the provided value is a valid latitude or not.
|
|
24
|
+
*/
|
|
25
|
+
export function isValidLatitude(value) {
|
|
26
|
+
return (
|
|
27
|
+
value !== null &&
|
|
28
|
+
value !== undefined &&
|
|
29
|
+
value !== '' &&
|
|
30
|
+
isFinite(value) &&
|
|
31
|
+
Math.abs(value) <= MAX_LATITUDE
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Determine if a value is a valid longitude.
|
|
37
|
+
*
|
|
38
|
+
* @param {any} value The value to validate.
|
|
39
|
+
* @returns {boolean} Whether the provided value is a valid longitude or not.
|
|
40
|
+
*/
|
|
41
|
+
export function isValidLongitude(value) {
|
|
42
|
+
return (
|
|
43
|
+
value !== null &&
|
|
44
|
+
value !== undefined &&
|
|
45
|
+
value !== '' &&
|
|
46
|
+
isFinite(value) &&
|
|
47
|
+
Math.abs(value) <= MAX_LONGITUDE
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Determine if a value is a valid phone value.
|
|
53
|
+
*
|
|
54
|
+
* @param {any} value The value to validate.
|
|
55
|
+
* @returns {boolean} Whether the provided value is a valid phone value or not.
|
|
56
|
+
*/
|
|
57
|
+
export function isValidPhone(value) {
|
|
58
|
+
return typeof value === 'string' && value !== '';
|
|
59
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
@supports (--styling-hooks: '') {
|
|
3
2
|
:host([data-render-mode="shadow"]) .slds-nav-vertical__title {
|
|
4
3
|
padding-block-start: var(--slds-g-spacing-2);
|
|
5
4
|
padding-block-end: var(--slds-g-spacing-2);
|
|
@@ -16,4 +15,3 @@
|
|
|
16
15
|
:host([data-render-mode="shadow"]) .slds-nav-vertical__title:not(:first-of-type) {
|
|
17
16
|
margin-block-start: var(--slds-g-spacing-2);
|
|
18
17
|
}
|
|
19
|
-
}
|