lightning-base-components 1.17.2-alpha → 1.17.5-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 +129 -3
- package/package.json +25 -1
- package/scopedImports/@salesforce-label-AddressAutocomplete.LookupButton.js +1 -0
- package/scopedImports/@salesforce-label-LightningDatatable.chooseARowSelectAll.js +1 -0
- package/scopedImports/@salesforce-label-LightningInput.mailingAddressFieldsUpdateText.js +1 -0
- package/scopedImports/@salesforce-label-LightningToast.genericNavigationAssistiveText.js +1 -0
- package/scopedImports/@salesforce-label-LightningToast.macNavigationAssistiveText.js +1 -0
- package/src/lightning/ariaObserver/__examples__/connect/connect.html +19 -0
- package/src/lightning/ariaObserver/__examples__/connect/connect.js +10 -0
- package/src/lightning/ariaObserver/__examples__/connectChild/connectChild.html +3 -0
- package/src/lightning/ariaObserver/__examples__/connectChild/connectChild.js +45 -0
- package/src/lightning/ariaObserver/ariaObserver.js +16 -2
- package/src/lightning/baseCombobox/baseCombobox.js +50 -4
- package/src/lightning/baseCombobox/keyboard.js +3 -0
- package/src/lightning/breadcrumb/__docs__/breadcrumb.md +5 -6
- package/src/lightning/breadcrumb/breadcrumb.css +3 -0
- package/src/lightning/breadcrumb/breadcrumb.html +1 -1
- package/src/lightning/breadcrumb/breadcrumb.slds.css +25 -0
- package/src/lightning/breadcrumbs/breadcrumbs.css +3 -0
- package/src/lightning/breadcrumbs/breadcrumbs.html +1 -1
- package/src/lightning/breadcrumbs/breadcrumbs.slds.css +33 -0
- package/src/lightning/button/button.html +2 -1
- package/src/lightning/button/button.js +9 -0
- package/src/lightning/buttonIcon/button-icon.slds.css +5 -1
- package/src/lightning/buttonIcon/buttonIcon.html +2 -1
- package/src/lightning/buttonIcon/buttonIcon.js +10 -1
- package/src/lightning/buttonIconStateful/button-icon-stateful.slds.css +5 -1
- package/src/lightning/card/__docs__/card.md +1 -1
- package/src/lightning/card/card.js +1 -1
- package/src/lightning/datatable/datatable.js +6 -15
- package/src/lightning/datatable/templates/div/div.html +4 -2
- package/src/lightning/datatable/templates/table/table.html +4 -2
- package/src/lightning/dialog/README.md +1 -1
- package/src/lightning/dualListbox/dual-listbox.slds.css +200 -0
- package/src/lightning/dualListbox/dualListbox.css +3 -1
- package/src/lightning/dualListbox/dualListbox.html +2 -2
- package/src/lightning/dualListbox/dualListbox.js +2 -0
- package/src/lightning/dualListbox/form-element.slds.css +232 -0
- package/src/lightning/dynamicIcon/dynamic-icon-ellie.slds.css +180 -0
- package/src/lightning/dynamicIcon/dynamic-icon-eq.slds.css +63 -0
- package/src/lightning/dynamicIcon/dynamic-icon-score.slds.css +46 -0
- package/src/lightning/dynamicIcon/dynamic-icon-strength.slds.css +122 -0
- package/src/lightning/dynamicIcon/dynamic-icon-trend.slds.css +117 -0
- package/src/lightning/dynamicIcon/dynamic-icon-waffle.slds.css +177 -0
- package/src/lightning/dynamicIcon/ellie.css +1 -0
- package/src/lightning/dynamicIcon/eq.css +1 -0
- package/src/lightning/dynamicIcon/score.css +1 -0
- package/src/lightning/dynamicIcon/strength.css +1 -0
- package/src/lightning/dynamicIcon/trend.css +1 -0
- package/src/lightning/dynamicIcon/waffle.css +1 -0
- package/src/lightning/f6Controller/f6Controller.js +382 -0
- package/src/lightning/f6Controller/f6Controller.js-meta.xml +4 -0
- package/src/lightning/formattedRichText/formattedRichText.js +4 -3
- package/src/lightning/helptext/form-element.slds.css +232 -0
- package/src/lightning/helptext/help-text.slds.css +5 -1
- package/src/lightning/helptext/helptext.css +2 -1
- package/src/lightning/helptext/helptext.html +1 -0
- package/src/lightning/helptext/helptext.js +9 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/bill_of_materials.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/buyer_group_qualifier.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/datashare_target.html +9 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/datashares.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/disclosure_and_compliance.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/document_preview.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/facility_bed.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/market.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/mulesoft.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/price_sheet.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/travel_mode.html +2 -2
- package/src/lightning/iconSvgTemplates/buildTemplates/templates.js +34 -1
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/add_source.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/app_web_messaging.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/bookmark_stroke.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/buyer_group_qualifier.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/document_preview.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/expired.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/favorite_alt.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/heart.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/hourglass.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/integration.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/market.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/more.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/mulesoft.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/notification_off.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/notification_snoozed.html +9 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/profile_alt.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/promotion_tiers.html +10 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/sender_email.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/service_appointment.html +13 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/service_report.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/toggle_off.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/toggle_on.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/your_account.html +10 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/bill_of_materials.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/buyer_group_qualifier.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/datashare_target.html +9 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/datashares.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/disclosure_and_compliance.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/document_preview.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/facility_bed.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/market.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/mulesoft.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/price_sheet.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/travel_mode.html +2 -2
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/templates.js +34 -1
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/add_source.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/app_web_messaging.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/bookmark_stroke.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/buyer_group_qualifier.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/document_preview.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/expired.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/favorite_alt.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/heart.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/hourglass.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/integration.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/market.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/more.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/mulesoft.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/notification_off.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/notification_snoozed.html +9 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/profile_alt.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/promotion_tiers.html +10 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/sender_email.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/service_appointment.html +13 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/service_report.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/toggle_off.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/toggle_on.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/your_account.html +10 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/bill_of_materials.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/buyer_group_qualifier.html +8 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/datashare_target.html +9 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/datashares.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/disclosure_and_compliance.html +8 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/document_preview.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/facility_bed.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/market.html +8 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/mulesoft.html +8 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/price_sheet.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/travel_mode.html +2 -2
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/templates.js +11 -1
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/bill_of_materials.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/buyer_group_qualifier.html +8 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/datashare_target.html +9 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/datashares.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/disclosure_and_compliance.html +8 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/document_preview.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/facility_bed.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/market.html +8 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/mulesoft.html +8 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/price_sheet.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/travel_mode.html +2 -2
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/templates.js +11 -1
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/templates.js +24 -1
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/add_source.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/app_web_messaging.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/bookmark_stroke.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/buyer_group_qualifier.html +8 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/document_preview.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/expired.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/favorite_alt.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/heart.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/hourglass.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/integration.html +8 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/market.html +8 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/more.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/mulesoft.html +8 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/notification_off.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/notification_snoozed.html +9 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/profile_alt.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/promotion_tiers.html +10 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/sender_email.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/service_appointment.html +13 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/service_report.html +8 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/toggle_off.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/toggle_on.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/your_account.html +10 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/templates.js +24 -1
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/add_source.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/app_web_messaging.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/bookmark_stroke.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/buyer_group_qualifier.html +8 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/document_preview.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/expired.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/favorite_alt.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/heart.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/hourglass.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/integration.html +8 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/market.html +8 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/more.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/mulesoft.html +8 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/notification_off.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/notification_snoozed.html +9 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/profile_alt.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/promotion_tiers.html +10 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/sender_email.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/service_appointment.html +13 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/service_report.html +8 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/toggle_off.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/toggle_on.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/your_account.html +10 -0
- package/src/lightning/input/__docs__/input.md +1 -1
- package/src/lightning/input/input-text.slds.css +1 -1
- package/src/lightning/input/input.html +3 -3
- package/src/lightning/input/input.js +39 -3
- package/src/lightning/inputAddress/__docs__/inputAddress.md +3 -0
- package/src/lightning/inputAddress/inputAddress.html +1 -0
- package/src/lightning/inputAddress/inputAddress.js +6 -0
- package/src/lightning/modal/__docs__/modal.md +187 -20
- package/src/lightning/modal/__examples__disabled/allform/allform.html +1 -1
- package/src/lightning/modal/__examples__disabled/allform/allform.js +1 -1
- package/src/lightning/modal/__examples__disabled/allformfull/allformfull.css +7 -0
- package/src/lightning/modal/__examples__disabled/allformfull/allformfull.html +9 -0
- package/src/lightning/modal/__examples__disabled/allformfull/allformfull.js +49 -0
- package/src/lightning/modal/__examples__disabled/demoallformfull/demoallformfull.css +3 -0
- package/src/lightning/modal/__examples__disabled/demoallformfull/demoallformfull.html +146 -0
- package/src/lightning/modal/__examples__disabled/demoallformfull/demoallformfull.js +240 -0
- package/src/lightning/modalBase/modalBase.css +1 -1
- package/src/lightning/modalBase/modalBase.html +1 -1
- package/src/lightning/modalBase/modalBase.js +180 -45
- package/src/lightning/modalBody/modalBody.js +133 -18
- package/src/lightning/modalFooter/modalFooter.js +57 -1
- package/src/lightning/navigation/__docs__/navigation.md +1 -1
- package/src/lightning/popup/popover.slds.css +121 -0
- package/src/lightning/popup/popup.css +3 -0
- package/src/lightning/positionLibrary/direction.js +10 -17
- package/src/lightning/positionLibrary/overlayDetector.js +10 -1
- package/src/lightning/primitiveBubble/primitiveBubble.js +16 -1
- package/src/lightning/primitiveCellCheckbox/primitiveCellCheckbox.js +15 -1
- package/src/lightning/primitiveHeaderFactory/primitiveHeaderFactory.js +29 -0
- package/src/lightning/primitiveHeaderFactory/selectableHeader.html +3 -6
- package/src/lightning/progressIndicator/progressIndicator.js +1 -1
- package/src/lightning/select/__docs__/select.md +9 -0
- package/src/lightning/select/__examples__/disabled/disabled.html +10 -0
- package/src/lightning/select/__examples__/disabled/disabled.js +27 -0
- package/src/lightning/select/__examples__/hidden/hidden.html +10 -0
- package/src/lightning/select/__examples__/hidden/hidden.js +27 -0
- package/src/lightning/select/__examples__/inline/inline.html +10 -0
- package/src/lightning/select/__examples__/inline/inline.js +27 -0
- package/src/lightning/select/form-element.slds.css +232 -0
- package/src/lightning/select/select.css +3 -0
- package/src/lightning/select/select.html +2 -2
- package/src/lightning/select/select.js +3 -0
- package/src/lightning/select/select.slds.css +398 -0
- package/src/lightning/showToastEvent/showToastEvent.js +21 -0
- package/src/lightning/showToastEvent/showToastEvent.js-meta.xml +4 -0
- package/src/lightning/sldsCommon/sldsCommon.css +21 -4
- package/src/lightning/toast/__docs__/toast.md +103 -0
- package/src/lightning/toast/toast.css +52 -0
- package/src/lightning/toast/toast.html +70 -0
- package/src/lightning/toast/toast.js +608 -0
- package/src/lightning/toast/toast.js-meta.xml +4 -0
- package/src/lightning/toastContainer/__docs__/toastContainer.md +59 -0
- package/src/lightning/toastContainer/toastContainer.css +32 -0
- package/src/lightning/toastContainer/toastContainer.html +9 -0
- package/src/lightning/toastContainer/toastContainer.js +471 -0
- package/src/lightning/toastContainer/toastContainer.js-meta.xml +6 -0
- package/src/lightning/tooltipLibrary/tooltipLibrary.js +70 -8
- package/src/lightning/treeGrid/__docs__/treeGrid.md +7 -3
- package/src/lightning/treeGrid/treeGrid.js +25 -30
- package/src/lightning/utilsPrivate/normalize.js +22 -6
- package/src/lightning/utilsPrivate/url.js +2 -1
- package/src/lightning/verticalNavigation/vertical-navigation.slds.css +4 -0
- package/src/lightning/verticalNavigation/verticalNavigation.css +1 -0
- package/src/lightning/verticalNavigation/verticalNavigation.html +1 -1
- package/src/lightning/verticalNavigationSection/vertical-navigation-section.slds.css +19 -0
- package/src/lightning/verticalNavigationSection/verticalNavigationSection.css +2 -0
- package/src/lightning/verticalNavigationSection/verticalNavigationSection.html +1 -1
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
import { api, createElement } from 'lwc';
|
|
2
|
+
import { classSet } from 'lightning/utils';
|
|
3
|
+
import {
|
|
4
|
+
instanceName,
|
|
5
|
+
properties,
|
|
6
|
+
requiredProperties,
|
|
7
|
+
} from 'lightning/overlayUtils';
|
|
8
|
+
import { SHOW_TOAST_EVENT_NAME } from 'lightning/showToastEvent';
|
|
9
|
+
import { normalizeNumber, normalizeString } from 'lightning/utilsPrivate';
|
|
10
|
+
import { createF6Controller } from 'lightning/f6Controller';
|
|
11
|
+
import {
|
|
12
|
+
getElementWithFocus,
|
|
13
|
+
returnFocusToElement,
|
|
14
|
+
} from 'lightning/focusUtils';
|
|
15
|
+
import LightningOverlay from 'lightning/overlay';
|
|
16
|
+
|
|
17
|
+
const CONSOLE_ERROR_MESSAGES = {
|
|
18
|
+
MISSING_PROPERTY: 'Unable to show toast, missing toast property\'s "{0}"',
|
|
19
|
+
MISSING_CONFIG: 'Unable to show toast, missing toast config.',
|
|
20
|
+
MISSING_TOAST: 'Unable to show toast, missing toast class reference.',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const TOAST_POSITION = {
|
|
24
|
+
TOP_CENTER: 'top-center',
|
|
25
|
+
TOP_LEFT: 'top-left',
|
|
26
|
+
TOP_RIGHT: 'top-right',
|
|
27
|
+
BOTTOM_LEFT: 'bottom-left',
|
|
28
|
+
BOTTOM_CENTER: 'bottom-center',
|
|
29
|
+
BOTTOM_RIGHT: 'bottom-right',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const CONTAINER_POSITION = {
|
|
33
|
+
ABSOLUTE: 'absolute',
|
|
34
|
+
FIXED: 'fixed',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const DEFAULT_CONTAINER_POSITION = CONTAINER_POSITION.FIXED;
|
|
38
|
+
const DEFAULT_MAX_TOASTS_SHOWN = 3;
|
|
39
|
+
const DEFAULT_TOAST_POSITION = TOAST_POSITION.TOP_CENTER;
|
|
40
|
+
const MAX_NUM_GLOBAL_TOAST_CONTAINER = 1;
|
|
41
|
+
const globalContainer = [];
|
|
42
|
+
|
|
43
|
+
const getGlobalContainer = () => {
|
|
44
|
+
return globalContainer[0];
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const configure = (toastContainer, config) => {
|
|
48
|
+
if (!toastContainer) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const { containerPosition, maxToasts, toastPosition } = config;
|
|
52
|
+
if (maxToasts) {
|
|
53
|
+
toastContainer.maxToasts = maxToasts;
|
|
54
|
+
}
|
|
55
|
+
if (containerPosition) {
|
|
56
|
+
toastContainer.containerPosition = containerPosition;
|
|
57
|
+
}
|
|
58
|
+
if (toastPosition) {
|
|
59
|
+
toastContainer.toastPosition = toastPosition;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const CLOSE_EVENT_NAME = 'close';
|
|
64
|
+
|
|
65
|
+
export default class ToastContainer extends LightningOverlay {
|
|
66
|
+
static [instanceName] = 'lightning-toast-container';
|
|
67
|
+
static [properties] = ['containerPosition', 'maxToasts', 'toastPosition'];
|
|
68
|
+
|
|
69
|
+
// container position
|
|
70
|
+
_containerPosition = CONTAINER_POSITION.FIXED;
|
|
71
|
+
// max number of toasts shown at a time
|
|
72
|
+
_maxToasts = DEFAULT_MAX_TOASTS_SHOWN;
|
|
73
|
+
// toast position
|
|
74
|
+
_toastPosition = TOAST_POSITION.TOP_CENTER;
|
|
75
|
+
// store the currently displayed toasts
|
|
76
|
+
_displayToasts = [];
|
|
77
|
+
// store awaiting toasts and their config
|
|
78
|
+
_queue = [];
|
|
79
|
+
// reference to the handler function for ShowToastEvent
|
|
80
|
+
_showToastHandler;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* css class for focus trap which is used to control toast container position and the toasts' position.
|
|
84
|
+
* @returns {string} - CSS classes of the toast as a string
|
|
85
|
+
*/
|
|
86
|
+
get containerClass() {
|
|
87
|
+
const toastPosition = this._toastPosition.split('-');
|
|
88
|
+
return classSet(
|
|
89
|
+
`slds-grid slds-grid_vertical-reverse toast-container ${toastPosition[0]} ${toastPosition[1]}`
|
|
90
|
+
).add({
|
|
91
|
+
'slds-is-fixed':
|
|
92
|
+
this.containerPosition === CONTAINER_POSITION.FIXED,
|
|
93
|
+
'slds-is-absolute':
|
|
94
|
+
this.containerPosition === CONTAINER_POSITION.ABSOLUTE,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* toast container position
|
|
100
|
+
* controls the position of the toast container div related to the containing element
|
|
101
|
+
* options: 'absolute', 'fixed'
|
|
102
|
+
* @returns {string}
|
|
103
|
+
* @default 'fixed'
|
|
104
|
+
*/
|
|
105
|
+
@api get containerPosition() {
|
|
106
|
+
return this._containerPosition;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
set containerPosition(value) {
|
|
110
|
+
this._containerPosition = normalizeString(value, {
|
|
111
|
+
fallbackValue: DEFAULT_CONTAINER_POSITION,
|
|
112
|
+
validValues: [
|
|
113
|
+
CONTAINER_POSITION.ABSOLUTE,
|
|
114
|
+
CONTAINER_POSITION.FIXED,
|
|
115
|
+
],
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* this attribute controls the maximum number of toast components shown at a given time
|
|
121
|
+
* if user enters a zero or negative number, the value will default to 3
|
|
122
|
+
* @returns {number}
|
|
123
|
+
* @default 3
|
|
124
|
+
*/
|
|
125
|
+
@api get maxToasts() {
|
|
126
|
+
return this._maxToasts;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
set maxToasts(value) {
|
|
130
|
+
this._maxToasts = normalizeNumber(value, {
|
|
131
|
+
fallbackValue: DEFAULT_MAX_TOASTS_SHOWN,
|
|
132
|
+
minValue: 1,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* return the div element which hosts the toast components
|
|
138
|
+
* @return {HTMLElement}
|
|
139
|
+
*/
|
|
140
|
+
get root() {
|
|
141
|
+
return this.template.querySelector('[data-toast-container]');
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* toast position
|
|
146
|
+
* controls the final position of toast components shown in the toast container
|
|
147
|
+
* options: 'top-left', 'top-center', 'top-right', 'bottom-left', 'bottom-center', 'bottom-right'
|
|
148
|
+
* @returns {string}
|
|
149
|
+
* @default 'top-center'
|
|
150
|
+
*/
|
|
151
|
+
@api get toastPosition() {
|
|
152
|
+
return this._toastPosition;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
set toastPosition(value) {
|
|
156
|
+
this._toastPosition = normalizeString(value, {
|
|
157
|
+
fallbackValue: DEFAULT_TOAST_POSITION,
|
|
158
|
+
validValues: [
|
|
159
|
+
TOAST_POSITION.TOP_LEFT,
|
|
160
|
+
TOAST_POSITION.TOP_CENTER,
|
|
161
|
+
TOAST_POSITION.TOP_RIGHT,
|
|
162
|
+
TOAST_POSITION.BOTTOM_LEFT,
|
|
163
|
+
TOAST_POSITION.BOTTOM_CENTER,
|
|
164
|
+
TOAST_POSITION.BOTTOM_RIGHT,
|
|
165
|
+
],
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* override function to "close" the toast container (i.e. remove it from the DOM)
|
|
171
|
+
*/
|
|
172
|
+
@api close() {
|
|
173
|
+
// reset before closing the container
|
|
174
|
+
this.reset();
|
|
175
|
+
super.close();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// private functions
|
|
179
|
+
connectedCallback() {
|
|
180
|
+
if (globalContainer.length < MAX_NUM_GLOBAL_TOAST_CONTAINER) {
|
|
181
|
+
this._showToastHandler = this.handleShowToast.bind(this);
|
|
182
|
+
document.body.addEventListener(
|
|
183
|
+
SHOW_TOAST_EVENT_NAME,
|
|
184
|
+
this._showToastHandler
|
|
185
|
+
);
|
|
186
|
+
globalContainer.push(this);
|
|
187
|
+
this.setAriaHidden();
|
|
188
|
+
createF6Controller();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
disconnectedCallback() {
|
|
193
|
+
this.close();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* assign allowed property values to an HTMLElement
|
|
198
|
+
* @param {array} allowedProperties array of property names which can have value assigned
|
|
199
|
+
* @param {HTMLElement} element element to assign attribute values
|
|
200
|
+
* @param {object} config a map of attribute -> value
|
|
201
|
+
*/
|
|
202
|
+
assignValuesToElement(allowedProperties, element, config) {
|
|
203
|
+
const elementProperties = allowedProperties || [];
|
|
204
|
+
Object.entries(config).forEach(([key, value]) => {
|
|
205
|
+
const keyLower = key.toLowerCase();
|
|
206
|
+
const match = keyLower.match(/^on(.+)/);
|
|
207
|
+
if (match) {
|
|
208
|
+
const eventName = match[1];
|
|
209
|
+
element.addEventListener(eventName, value);
|
|
210
|
+
} else {
|
|
211
|
+
// assign value only to the allowed properties
|
|
212
|
+
if (elementProperties.indexOf(key) > -1) {
|
|
213
|
+
element[key] = value;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* handler function of show toast event
|
|
221
|
+
* @param {Event} event ShowToastEvent
|
|
222
|
+
*/
|
|
223
|
+
handleShowToast(event) {
|
|
224
|
+
event.stopPropagation();
|
|
225
|
+
const params = this.validateToastParameters(event);
|
|
226
|
+
if (!params) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
// enqueue the toast and config
|
|
230
|
+
this._queue.push(params);
|
|
231
|
+
// show toast if any
|
|
232
|
+
this.showNextToast();
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* handler function of [toast] close event
|
|
237
|
+
* @param {HTMLElement} element the closed toast component
|
|
238
|
+
*/
|
|
239
|
+
handleToastClose(closedToast, event) {
|
|
240
|
+
let toastIndex = -1;
|
|
241
|
+
let source;
|
|
242
|
+
|
|
243
|
+
// remove the closed toast from the DOM
|
|
244
|
+
this._displayToasts = this._displayToasts.filter(
|
|
245
|
+
({ toastElement, sourceElement }, index) => {
|
|
246
|
+
if (toastElement === closedToast) {
|
|
247
|
+
toastIndex = index;
|
|
248
|
+
source = sourceElement;
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
this.root.removeChild(closedToast);
|
|
256
|
+
// show next toast if any
|
|
257
|
+
this.showNextToast();
|
|
258
|
+
|
|
259
|
+
// if the closed toast does not have focus, do nothing
|
|
260
|
+
if (!event.detail.isFocused) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
// closed toast also is the focused toast, thus move focus to the next toast if any
|
|
264
|
+
const nextToast =
|
|
265
|
+
toastIndex > -1 &&
|
|
266
|
+
toastIndex < this._displayToasts.length &&
|
|
267
|
+
this._displayToasts[toastIndex].toastElement;
|
|
268
|
+
if (nextToast && nextToast.isConnected) {
|
|
269
|
+
nextToast.focus();
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
// no toast to focus, return focus to the source component which triggered the toast which was closed.
|
|
273
|
+
returnFocusToElement(source);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* handler function for registering a toast to the container
|
|
278
|
+
* @param {CustomEvent} event
|
|
279
|
+
*/
|
|
280
|
+
handleToastRegister(event) {
|
|
281
|
+
const { target: toastElement, detail } = event;
|
|
282
|
+
const { unregisterCallback } = detail;
|
|
283
|
+
const toastCloseHandler = this.handleToastClose.bind(
|
|
284
|
+
this,
|
|
285
|
+
toastElement
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
// add the close event listener to the toast element
|
|
289
|
+
toastElement.addEventListener(CLOSE_EVENT_NAME, toastCloseHandler);
|
|
290
|
+
unregisterCallback(() => {
|
|
291
|
+
// remove the close event listener when unregistering the toast from the container
|
|
292
|
+
toastElement.removeEventListener(
|
|
293
|
+
CLOSE_EVENT_NAME,
|
|
294
|
+
toastCloseHandler
|
|
295
|
+
);
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* set aria-hidden attribute to true if there is no toasts
|
|
301
|
+
*/
|
|
302
|
+
setAriaHidden() {
|
|
303
|
+
const ariaHiddenValueToSet = !this._displayToasts.length;
|
|
304
|
+
if (this.template.host.ariaHidden !== ariaHiddenValueToSet) {
|
|
305
|
+
this.template.host.ariaHidden = ariaHiddenValueToSet;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* show the next toast component(s) if any
|
|
311
|
+
*/
|
|
312
|
+
showNextToast() {
|
|
313
|
+
while (
|
|
314
|
+
this._queue.length &&
|
|
315
|
+
this._displayToasts.length < this._maxToasts
|
|
316
|
+
) {
|
|
317
|
+
const { toast, config, sourceElement } = this._queue.shift();
|
|
318
|
+
// create the toast component
|
|
319
|
+
const {
|
|
320
|
+
[instanceName]: toastInstanceName,
|
|
321
|
+
[properties]: toastProperties,
|
|
322
|
+
} = toast;
|
|
323
|
+
const toastElement = createElement(toastInstanceName, {
|
|
324
|
+
is: toast,
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
this.assignValuesToElement(toastProperties, toastElement, config);
|
|
328
|
+
this._displayToasts.push({ toastElement, sourceElement });
|
|
329
|
+
this.root.appendChild(toastElement);
|
|
330
|
+
}
|
|
331
|
+
this.setAriaHidden();
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* reset function to be called if the container is no longer used or detached from the DOM
|
|
336
|
+
*/
|
|
337
|
+
reset() {
|
|
338
|
+
if (this._showToastHandler) {
|
|
339
|
+
document.body.removeEventListener(
|
|
340
|
+
SHOW_TOAST_EVENT_NAME,
|
|
341
|
+
this._showToastHandler
|
|
342
|
+
);
|
|
343
|
+
this._showToastHandler = null;
|
|
344
|
+
}
|
|
345
|
+
globalContainer.splice(0, globalContainer.length);
|
|
346
|
+
this._containerPosition = CONTAINER_POSITION.FIXED;
|
|
347
|
+
this._maxToasts = DEFAULT_MAX_TOASTS_SHOWN;
|
|
348
|
+
this._toastPosition = TOAST_POSITION.TOP_CENTER;
|
|
349
|
+
// remove toasts if any
|
|
350
|
+
this.root.childNodes.forEach((node) => {
|
|
351
|
+
this.root.removeChild(node);
|
|
352
|
+
});
|
|
353
|
+
this._displayToasts = [];
|
|
354
|
+
this._queue = [];
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* retrieve toast config constructed in platformShowToastEvent
|
|
359
|
+
* @param {object} toastAttributes toast config defined by platformShowToastEvent
|
|
360
|
+
*/
|
|
361
|
+
retrievePlatformShowToastConfig(toastAttributes, detail) {
|
|
362
|
+
const { title, message, messageData, mode, type } = toastAttributes;
|
|
363
|
+
const toast = detail.toast || undefined;
|
|
364
|
+
return {
|
|
365
|
+
config: {
|
|
366
|
+
label: title,
|
|
367
|
+
message,
|
|
368
|
+
messageLinks: messageData,
|
|
369
|
+
mode,
|
|
370
|
+
variant: type,
|
|
371
|
+
},
|
|
372
|
+
toast,
|
|
373
|
+
source: undefined,
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* retrieve toast config constructed in Toast.show()
|
|
379
|
+
* @param {*} detail
|
|
380
|
+
* @returns
|
|
381
|
+
*/
|
|
382
|
+
retrieveShowToastConfig(detail) {
|
|
383
|
+
// this toast config is created from Toast.show() i.e. lightningShowToastEvent
|
|
384
|
+
const config = { ...detail };
|
|
385
|
+
const toast = detail.toast || undefined;
|
|
386
|
+
const source = detail.source || undefined;
|
|
387
|
+
delete config.toast;
|
|
388
|
+
delete config.source;
|
|
389
|
+
return { config, toast, source };
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* validate function to check if config, toast, source have the necessary attributes needed
|
|
394
|
+
*/
|
|
395
|
+
validateToastParameters(event) {
|
|
396
|
+
const sourceElement = getElementWithFocus();
|
|
397
|
+
const { toastAttributes, detail } = event;
|
|
398
|
+
let convertedConfig;
|
|
399
|
+
// convert the platformShowToastEvent's toast config to the new format consumed by Toast
|
|
400
|
+
// this handles the case when platformShowToastEvent is dispatched
|
|
401
|
+
if (toastAttributes && detail) {
|
|
402
|
+
convertedConfig = this.retrievePlatformShowToastConfig(
|
|
403
|
+
toastAttributes,
|
|
404
|
+
detail
|
|
405
|
+
);
|
|
406
|
+
} else if (detail) {
|
|
407
|
+
// this toast config is created from Toast.show() i.e. lightningShowToastEvent
|
|
408
|
+
convertedConfig = this.retrieveShowToastConfig(detail);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
if (!convertedConfig) {
|
|
412
|
+
console.error(CONSOLE_ERROR_MESSAGES.MISSING_CONFIG);
|
|
413
|
+
return undefined;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
const { config, toast, source } = convertedConfig;
|
|
417
|
+
if (!toast) {
|
|
418
|
+
console.error(
|
|
419
|
+
'Unable to show toast, missing toast class reference.'
|
|
420
|
+
);
|
|
421
|
+
return undefined;
|
|
422
|
+
}
|
|
423
|
+
const { [requiredProperties]: toastRequiredProps } = toast;
|
|
424
|
+
if (toastRequiredProps) {
|
|
425
|
+
const missingPropertyName = toastRequiredProps.find((property) => {
|
|
426
|
+
if (
|
|
427
|
+
!Object.prototype.hasOwnProperty.call(config, property) ||
|
|
428
|
+
!config[property]
|
|
429
|
+
) {
|
|
430
|
+
return property;
|
|
431
|
+
}
|
|
432
|
+
return undefined;
|
|
433
|
+
});
|
|
434
|
+
if (missingPropertyName) {
|
|
435
|
+
console.error(
|
|
436
|
+
CONSOLE_ERROR_MESSAGES.MISSING_PROPERTY.replace(
|
|
437
|
+
'{0}',
|
|
438
|
+
missingPropertyName
|
|
439
|
+
)
|
|
440
|
+
);
|
|
441
|
+
return undefined;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
return { config, toast, source, sourceElement };
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* create a page level toast container, if it does not exist or return the existing one
|
|
449
|
+
* @param {object} config map of attributes -> value to set the toast container's public attributes
|
|
450
|
+
* @returns {ToastContainer} instance of the toast container
|
|
451
|
+
*/
|
|
452
|
+
static instance(config = {}) {
|
|
453
|
+
// create a instance if container does not exist
|
|
454
|
+
if (globalContainer.length < MAX_NUM_GLOBAL_TOAST_CONTAINER) {
|
|
455
|
+
ToastContainer.open(config);
|
|
456
|
+
return getGlobalContainer();
|
|
457
|
+
}
|
|
458
|
+
let toastContainer = getGlobalContainer();
|
|
459
|
+
if (!toastContainer.isConnected) {
|
|
460
|
+
// remove the container if it does not attached to the DOM anymore
|
|
461
|
+
toastContainer.close();
|
|
462
|
+
toastContainer = null;
|
|
463
|
+
// create a new one and returns it
|
|
464
|
+
ToastContainer.open(config);
|
|
465
|
+
return getGlobalContainer();
|
|
466
|
+
}
|
|
467
|
+
// set container attribute if already exists
|
|
468
|
+
configure(toastContainer, config);
|
|
469
|
+
return toastContainer;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
@@ -33,6 +33,8 @@ function buildResizeObserver(callback) {
|
|
|
33
33
|
*/
|
|
34
34
|
let CACHED_BUBBLE_ELEMENT;
|
|
35
35
|
|
|
36
|
+
let activeTooltip;
|
|
37
|
+
|
|
36
38
|
function getCachedBubbleElement() {
|
|
37
39
|
if (!CACHED_BUBBLE_ELEMENT) {
|
|
38
40
|
CACHED_BUBBLE_ELEMENT = createElement('lightning-primitive-bubble', {
|
|
@@ -41,6 +43,7 @@ function getCachedBubbleElement() {
|
|
|
41
43
|
CACHED_BUBBLE_ELEMENT.contentId = BUBBLE_ID;
|
|
42
44
|
CACHED_BUBBLE_ELEMENT.style.position = 'absolute';
|
|
43
45
|
CACHED_BUBBLE_ELEMENT.style.minWidth = '75px';
|
|
46
|
+
CACHED_BUBBLE_ELEMENT.disableVisibilityChangeOnLeave = true;
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
return CACHED_BUBBLE_ELEMENT;
|
|
@@ -86,6 +89,7 @@ export class Tooltip {
|
|
|
86
89
|
_initialized = false;
|
|
87
90
|
_visible = false;
|
|
88
91
|
_isFocusEvent = false;
|
|
92
|
+
_initialResize = true;
|
|
89
93
|
|
|
90
94
|
_config = {};
|
|
91
95
|
|
|
@@ -123,6 +127,7 @@ export class Tooltip {
|
|
|
123
127
|
}
|
|
124
128
|
this.handleDocumentTouch = this.handleDocumentTouch.bind(this);
|
|
125
129
|
this.handleEscape = this.handleEscape.bind(this);
|
|
130
|
+
this.hide = this.hide.bind(this);
|
|
126
131
|
}
|
|
127
132
|
|
|
128
133
|
/**
|
|
@@ -167,6 +172,7 @@ export class Tooltip {
|
|
|
167
172
|
|
|
168
173
|
addInfoListeners() {
|
|
169
174
|
const target = this._target();
|
|
175
|
+
|
|
170
176
|
if (!this._initialized && target) {
|
|
171
177
|
['mouseenter', 'focus'].forEach((name) =>
|
|
172
178
|
target.addEventListener(name, () => this.show())
|
|
@@ -181,6 +187,13 @@ export class Tooltip {
|
|
|
181
187
|
}
|
|
182
188
|
|
|
183
189
|
hideIfNotSelfCover(event) {
|
|
190
|
+
/*
|
|
191
|
+
If the tooltip is already hidden, do not try to hide it. The primitive bubble is shared and we don't want to
|
|
192
|
+
hide a tooltip that does not belong to this instance.
|
|
193
|
+
*/
|
|
194
|
+
if (!this._visible) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
184
197
|
if (event.type === 'mouseleave' && event.clientX && event.clientY) {
|
|
185
198
|
// In any chance, if mouseleave is caused by tooltip itself, it would means
|
|
186
199
|
// tooltip cover the target which mostly caused by dynamic resize of tooltip by CSS or JS.
|
|
@@ -209,6 +222,7 @@ export class Tooltip {
|
|
|
209
222
|
|
|
210
223
|
addToggleListeners() {
|
|
211
224
|
const target = this._target();
|
|
225
|
+
|
|
212
226
|
if (!this._initialized && target) {
|
|
213
227
|
target.addEventListener('touchstart', (e) => {
|
|
214
228
|
e.stopPropagation();
|
|
@@ -222,10 +236,11 @@ export class Tooltip {
|
|
|
222
236
|
this.hideIfNotSelfCover(event)
|
|
223
237
|
)
|
|
224
238
|
);
|
|
239
|
+
|
|
225
240
|
target.addEventListener('keydown', (event) => {
|
|
226
241
|
if (event.keyCode === 13 && !this._visible) {
|
|
227
242
|
this.toggle();
|
|
228
|
-
} else {
|
|
243
|
+
} else if (this._visible) {
|
|
229
244
|
this.hide();
|
|
230
245
|
}
|
|
231
246
|
});
|
|
@@ -242,7 +257,29 @@ export class Tooltip {
|
|
|
242
257
|
if (!this._resizeObserver) {
|
|
243
258
|
this._resizeObserver = buildResizeObserver(() => {
|
|
244
259
|
if (this._visible && this._autoPosition) {
|
|
245
|
-
this.
|
|
260
|
+
const tooltip = this._element();
|
|
261
|
+
/**
|
|
262
|
+
* There are some cases where the tooltip hide event does not trigger. For example,
|
|
263
|
+
* if a tab triggers a focus event on element A and then a pointer triggers mouseenter on element B.
|
|
264
|
+
* In this case, the content of the cached tooltip does not match the value of this Tooltip object and
|
|
265
|
+
* we know that this tooltip should be hidden. See @W-12512833
|
|
266
|
+
*/
|
|
267
|
+
if (activeTooltip !== this) {
|
|
268
|
+
this.hide(false);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
this.startPositioning().then(() => {
|
|
272
|
+
/*
|
|
273
|
+
* Once positioning is complete, add the listener to react when the mouse leaves the tooltip.
|
|
274
|
+
* Cannot be added before, or the tooltip will flicker and hide if the mouse is in the same
|
|
275
|
+
* position as the tooltip and the user tabs onto the tooltip. This cannot be managed inside
|
|
276
|
+
* the primitive-bubble, or the ResizeObserver will not be reset correctly.
|
|
277
|
+
*/
|
|
278
|
+
if (this._initialResize) {
|
|
279
|
+
tooltip.addEventListener('mouseleave', this.hide);
|
|
280
|
+
this._initialResize = false;
|
|
281
|
+
}
|
|
282
|
+
});
|
|
246
283
|
}
|
|
247
284
|
});
|
|
248
285
|
}
|
|
@@ -250,15 +287,29 @@ export class Tooltip {
|
|
|
250
287
|
}
|
|
251
288
|
|
|
252
289
|
show(ev) {
|
|
253
|
-
if (this._disabled) {
|
|
290
|
+
if (this._disabled || this._visible) {
|
|
254
291
|
return;
|
|
255
292
|
}
|
|
293
|
+
|
|
294
|
+
if (activeTooltip && activeTooltip !== this && activeTooltip._visible) {
|
|
295
|
+
activeTooltip.hide(false);
|
|
296
|
+
}
|
|
297
|
+
activeTooltip = this;
|
|
298
|
+
|
|
256
299
|
this._isFocusEvent = ev && (ev.type === 'focus' ? true : false);
|
|
257
300
|
|
|
258
301
|
this._visible = true;
|
|
302
|
+
this._initialResize = true;
|
|
259
303
|
const tooltip = this._element();
|
|
260
|
-
|
|
261
|
-
|
|
304
|
+
|
|
305
|
+
/*
|
|
306
|
+
When tabbing, populating the tooltip and making it visible too early can lead to bad interactions
|
|
307
|
+
when the mouse is hovering over a tooltip. W-12559092
|
|
308
|
+
*/
|
|
309
|
+
if (!this._isFocusEvent) {
|
|
310
|
+
tooltip.content = this._value;
|
|
311
|
+
tooltip.visible = this._visible;
|
|
312
|
+
}
|
|
262
313
|
|
|
263
314
|
this.startPositioning();
|
|
264
315
|
document.addEventListener('keydown', this.handleEscape);
|
|
@@ -266,17 +317,28 @@ export class Tooltip {
|
|
|
266
317
|
this.resizeObserver.observe(tooltip);
|
|
267
318
|
}
|
|
268
319
|
|
|
269
|
-
|
|
320
|
+
/**
|
|
321
|
+
* Hides the tooltip
|
|
322
|
+
*
|
|
323
|
+
* @param {*} hideBubble the primitive bubble is a shared instance, it may not be desirable to hide it
|
|
324
|
+
* if the current tooltip is no longer using it.
|
|
325
|
+
*/
|
|
326
|
+
hide(hideBubble = true) {
|
|
270
327
|
this._visible = false;
|
|
271
328
|
const tooltip = this._element();
|
|
272
|
-
|
|
329
|
+
|
|
330
|
+
if (hideBubble) {
|
|
331
|
+
tooltip.visible = this._visible;
|
|
332
|
+
}
|
|
273
333
|
|
|
274
334
|
this.stopPositioning();
|
|
275
335
|
|
|
276
336
|
document.removeEventListener('touchstart', this.handleDocumentTouch);
|
|
277
337
|
document.removeEventListener('keydown', this.handleEscape);
|
|
338
|
+
tooltip.removeEventListener('mouseleave', this.hide);
|
|
278
339
|
|
|
279
340
|
this.resizeObserver.unobserve(tooltip);
|
|
341
|
+
activeTooltip = null;
|
|
280
342
|
}
|
|
281
343
|
|
|
282
344
|
toggle() {
|
|
@@ -323,7 +385,7 @@ export class Tooltip {
|
|
|
323
385
|
const targetBox = this._target().getBoundingClientRect();
|
|
324
386
|
const padLeft = targetBox.width * 0.5 - NUBBIN_OFFSET;
|
|
325
387
|
|
|
326
|
-
this._autoPosition
|
|
388
|
+
return this._autoPosition
|
|
327
389
|
.start({
|
|
328
390
|
target: this._target,
|
|
329
391
|
element: this._element,
|
|
@@ -36,8 +36,11 @@ include:
|
|
|
36
36
|
- Selecting of rows
|
|
37
37
|
- Text wrapping and clipping
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
This component provides styling for up to 20 nested levels. For tree grids that require more than 20 nested levels,
|
|
40
|
+
build your own component.
|
|
41
|
+
|
|
42
|
+
A checkbox is displayed by default in the first column. Set the `hide-checkbox-column` attribute
|
|
43
|
+
to `true` to remove the checkbox.
|
|
41
44
|
|
|
42
45
|
Initialize your tree grid data using the `data`, `columns`, and `key-field` attributes
|
|
43
46
|
and define their values in JavaScript. Note that `key-field` is required.
|
|
@@ -46,7 +49,8 @@ This example creates a tree grid with 5 columns, where the
|
|
|
46
49
|
first column displays a checkbox for row selection. Selecting the checkbox
|
|
47
50
|
enables you to select the entire row of data and triggers the `onrowselection`
|
|
48
51
|
event handler. The `expanded-rows` attribute is optional, and expands nested
|
|
49
|
-
items on a row when provided.
|
|
52
|
+
items on a row when provided. Selecting a row using the checkbox does not select
|
|
53
|
+
the rows nested below it.
|
|
50
54
|
|
|
51
55
|
The example includes two buttons whose handlers call `lightning-tree-grid` methods
|
|
52
56
|
to collapse all rows and to show which rows are expanded.
|