lightning-base-components 1.17.3-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.
Files changed (249) hide show
  1. package/metadata/raptor.json +125 -2
  2. package/package.json +17 -1
  3. package/scopedImports/@salesforce-label-LightningInput.mailingAddressFieldsUpdateText.js +1 -0
  4. package/scopedImports/@salesforce-label-LightningToast.genericNavigationAssistiveText.js +1 -0
  5. package/scopedImports/@salesforce-label-LightningToast.macNavigationAssistiveText.js +1 -0
  6. package/src/lightning/ariaObserver/__examples__/connect/connect.html +19 -0
  7. package/src/lightning/ariaObserver/__examples__/connect/connect.js +10 -0
  8. package/src/lightning/ariaObserver/__examples__/connectChild/connectChild.html +3 -0
  9. package/src/lightning/ariaObserver/__examples__/connectChild/connectChild.js +45 -0
  10. package/src/lightning/ariaObserver/ariaObserver.js +16 -2
  11. package/src/lightning/baseCombobox/baseCombobox.js +11 -3
  12. package/src/lightning/baseCombobox/keyboard.js +3 -0
  13. package/src/lightning/breadcrumb/breadcrumb.css +3 -0
  14. package/src/lightning/breadcrumb/breadcrumb.html +1 -1
  15. package/src/lightning/breadcrumb/breadcrumb.slds.css +25 -0
  16. package/src/lightning/breadcrumbs/breadcrumbs.css +3 -0
  17. package/src/lightning/breadcrumbs/breadcrumbs.html +1 -1
  18. package/src/lightning/breadcrumbs/breadcrumbs.slds.css +33 -0
  19. package/src/lightning/button/button.html +2 -1
  20. package/src/lightning/button/button.js +9 -0
  21. package/src/lightning/buttonIcon/button-icon.slds.css +5 -1
  22. package/src/lightning/buttonIcon/buttonIcon.html +2 -1
  23. package/src/lightning/buttonIcon/buttonIcon.js +10 -1
  24. package/src/lightning/buttonIconStateful/button-icon-stateful.slds.css +5 -1
  25. package/src/lightning/dualListbox/dual-listbox.slds.css +200 -0
  26. package/src/lightning/dualListbox/dualListbox.css +3 -1
  27. package/src/lightning/dualListbox/dualListbox.html +2 -2
  28. package/src/lightning/dualListbox/dualListbox.js +2 -0
  29. package/src/lightning/dualListbox/form-element.slds.css +232 -0
  30. package/src/lightning/dynamicIcon/dynamic-icon-ellie.slds.css +180 -0
  31. package/src/lightning/dynamicIcon/dynamic-icon-eq.slds.css +63 -0
  32. package/src/lightning/dynamicIcon/dynamic-icon-score.slds.css +46 -0
  33. package/src/lightning/dynamicIcon/dynamic-icon-strength.slds.css +122 -0
  34. package/src/lightning/dynamicIcon/dynamic-icon-trend.slds.css +117 -0
  35. package/src/lightning/dynamicIcon/dynamic-icon-waffle.slds.css +177 -0
  36. package/src/lightning/dynamicIcon/ellie.css +1 -0
  37. package/src/lightning/dynamicIcon/eq.css +1 -0
  38. package/src/lightning/dynamicIcon/score.css +1 -0
  39. package/src/lightning/dynamicIcon/strength.css +1 -0
  40. package/src/lightning/dynamicIcon/trend.css +1 -0
  41. package/src/lightning/dynamicIcon/waffle.css +1 -0
  42. package/src/lightning/f6Controller/f6Controller.js +382 -0
  43. package/src/lightning/f6Controller/f6Controller.js-meta.xml +4 -0
  44. package/src/lightning/formattedRichText/formattedRichText.js +4 -3
  45. package/src/lightning/helptext/form-element.slds.css +232 -0
  46. package/src/lightning/helptext/help-text.slds.css +5 -1
  47. package/src/lightning/helptext/helptext.css +2 -1
  48. package/src/lightning/helptext/helptext.html +1 -0
  49. package/src/lightning/helptext/helptext.js +9 -0
  50. package/src/lightning/iconSvgTemplates/buildTemplates/standard/bill_of_materials.html +7 -0
  51. package/src/lightning/iconSvgTemplates/buildTemplates/standard/buyer_group_qualifier.html +8 -0
  52. package/src/lightning/iconSvgTemplates/buildTemplates/standard/datashare_target.html +9 -0
  53. package/src/lightning/iconSvgTemplates/buildTemplates/standard/datashares.html +7 -0
  54. package/src/lightning/iconSvgTemplates/buildTemplates/standard/disclosure_and_compliance.html +8 -0
  55. package/src/lightning/iconSvgTemplates/buildTemplates/standard/document_preview.html +7 -0
  56. package/src/lightning/iconSvgTemplates/buildTemplates/standard/facility_bed.html +7 -0
  57. package/src/lightning/iconSvgTemplates/buildTemplates/standard/market.html +8 -0
  58. package/src/lightning/iconSvgTemplates/buildTemplates/standard/mulesoft.html +8 -0
  59. package/src/lightning/iconSvgTemplates/buildTemplates/standard/price_sheet.html +7 -0
  60. package/src/lightning/iconSvgTemplates/buildTemplates/standard/travel_mode.html +2 -2
  61. package/src/lightning/iconSvgTemplates/buildTemplates/templates.js +34 -1
  62. package/src/lightning/iconSvgTemplates/buildTemplates/utility/add_source.html +7 -0
  63. package/src/lightning/iconSvgTemplates/buildTemplates/utility/app_web_messaging.html +7 -0
  64. package/src/lightning/iconSvgTemplates/buildTemplates/utility/bookmark_stroke.html +7 -0
  65. package/src/lightning/iconSvgTemplates/buildTemplates/utility/buyer_group_qualifier.html +8 -0
  66. package/src/lightning/iconSvgTemplates/buildTemplates/utility/document_preview.html +7 -0
  67. package/src/lightning/iconSvgTemplates/buildTemplates/utility/expired.html +7 -0
  68. package/src/lightning/iconSvgTemplates/buildTemplates/utility/favorite_alt.html +7 -0
  69. package/src/lightning/iconSvgTemplates/buildTemplates/utility/heart.html +7 -0
  70. package/src/lightning/iconSvgTemplates/buildTemplates/utility/hourglass.html +7 -0
  71. package/src/lightning/iconSvgTemplates/buildTemplates/utility/integration.html +8 -0
  72. package/src/lightning/iconSvgTemplates/buildTemplates/utility/market.html +8 -0
  73. package/src/lightning/iconSvgTemplates/buildTemplates/utility/more.html +7 -0
  74. package/src/lightning/iconSvgTemplates/buildTemplates/utility/mulesoft.html +8 -0
  75. package/src/lightning/iconSvgTemplates/buildTemplates/utility/notification_off.html +7 -0
  76. package/src/lightning/iconSvgTemplates/buildTemplates/utility/notification_snoozed.html +9 -0
  77. package/src/lightning/iconSvgTemplates/buildTemplates/utility/profile_alt.html +7 -0
  78. package/src/lightning/iconSvgTemplates/buildTemplates/utility/promotion_tiers.html +10 -0
  79. package/src/lightning/iconSvgTemplates/buildTemplates/utility/sender_email.html +7 -0
  80. package/src/lightning/iconSvgTemplates/buildTemplates/utility/service_appointment.html +13 -0
  81. package/src/lightning/iconSvgTemplates/buildTemplates/utility/service_report.html +8 -0
  82. package/src/lightning/iconSvgTemplates/buildTemplates/utility/toggle_off.html +7 -0
  83. package/src/lightning/iconSvgTemplates/buildTemplates/utility/toggle_on.html +7 -0
  84. package/src/lightning/iconSvgTemplates/buildTemplates/utility/your_account.html +10 -0
  85. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/bill_of_materials.html +7 -0
  86. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/buyer_group_qualifier.html +8 -0
  87. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/datashare_target.html +9 -0
  88. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/datashares.html +7 -0
  89. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/disclosure_and_compliance.html +8 -0
  90. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/document_preview.html +7 -0
  91. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/facility_bed.html +7 -0
  92. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/market.html +8 -0
  93. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/mulesoft.html +8 -0
  94. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/price_sheet.html +7 -0
  95. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/travel_mode.html +2 -2
  96. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/templates.js +34 -1
  97. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/add_source.html +7 -0
  98. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/app_web_messaging.html +7 -0
  99. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/bookmark_stroke.html +7 -0
  100. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/buyer_group_qualifier.html +8 -0
  101. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/document_preview.html +7 -0
  102. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/expired.html +7 -0
  103. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/favorite_alt.html +7 -0
  104. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/heart.html +7 -0
  105. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/hourglass.html +7 -0
  106. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/integration.html +8 -0
  107. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/market.html +8 -0
  108. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/more.html +7 -0
  109. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/mulesoft.html +8 -0
  110. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/notification_off.html +7 -0
  111. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/notification_snoozed.html +9 -0
  112. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/profile_alt.html +7 -0
  113. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/promotion_tiers.html +10 -0
  114. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/sender_email.html +7 -0
  115. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/service_appointment.html +13 -0
  116. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/service_report.html +8 -0
  117. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/toggle_off.html +7 -0
  118. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/toggle_on.html +7 -0
  119. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/your_account.html +10 -0
  120. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/bill_of_materials.html +7 -0
  121. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/buyer_group_qualifier.html +8 -0
  122. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/datashare_target.html +9 -0
  123. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/datashares.html +7 -0
  124. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/disclosure_and_compliance.html +8 -0
  125. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/document_preview.html +7 -0
  126. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/facility_bed.html +7 -0
  127. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/market.html +8 -0
  128. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/mulesoft.html +8 -0
  129. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/price_sheet.html +7 -0
  130. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/travel_mode.html +2 -2
  131. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/templates.js +11 -1
  132. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/bill_of_materials.html +7 -0
  133. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/buyer_group_qualifier.html +8 -0
  134. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/datashare_target.html +9 -0
  135. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/datashares.html +7 -0
  136. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/disclosure_and_compliance.html +8 -0
  137. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/document_preview.html +7 -0
  138. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/facility_bed.html +7 -0
  139. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/market.html +8 -0
  140. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/mulesoft.html +8 -0
  141. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/price_sheet.html +7 -0
  142. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/travel_mode.html +2 -2
  143. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/templates.js +11 -1
  144. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/templates.js +24 -1
  145. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/add_source.html +7 -0
  146. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/app_web_messaging.html +7 -0
  147. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/bookmark_stroke.html +7 -0
  148. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/buyer_group_qualifier.html +8 -0
  149. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/document_preview.html +7 -0
  150. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/expired.html +7 -0
  151. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/favorite_alt.html +7 -0
  152. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/heart.html +7 -0
  153. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/hourglass.html +7 -0
  154. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/integration.html +8 -0
  155. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/market.html +8 -0
  156. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/more.html +7 -0
  157. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/mulesoft.html +8 -0
  158. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/notification_off.html +7 -0
  159. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/notification_snoozed.html +9 -0
  160. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/profile_alt.html +7 -0
  161. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/promotion_tiers.html +10 -0
  162. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/sender_email.html +7 -0
  163. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/service_appointment.html +13 -0
  164. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/service_report.html +8 -0
  165. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/toggle_off.html +7 -0
  166. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/toggle_on.html +7 -0
  167. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/your_account.html +10 -0
  168. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/templates.js +24 -1
  169. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/add_source.html +7 -0
  170. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/app_web_messaging.html +7 -0
  171. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/bookmark_stroke.html +7 -0
  172. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/buyer_group_qualifier.html +8 -0
  173. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/document_preview.html +7 -0
  174. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/expired.html +7 -0
  175. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/favorite_alt.html +7 -0
  176. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/heart.html +7 -0
  177. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/hourglass.html +7 -0
  178. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/integration.html +8 -0
  179. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/market.html +8 -0
  180. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/more.html +7 -0
  181. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/mulesoft.html +8 -0
  182. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/notification_off.html +7 -0
  183. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/notification_snoozed.html +9 -0
  184. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/profile_alt.html +7 -0
  185. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/promotion_tiers.html +10 -0
  186. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/sender_email.html +7 -0
  187. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/service_appointment.html +13 -0
  188. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/service_report.html +8 -0
  189. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/toggle_off.html +7 -0
  190. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/toggle_on.html +7 -0
  191. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/your_account.html +10 -0
  192. package/src/lightning/input/input-text.slds.css +1 -1
  193. package/src/lightning/input/input.html +3 -3
  194. package/src/lightning/input/input.js +38 -2
  195. package/src/lightning/inputAddress/__docs__/inputAddress.md +3 -0
  196. package/src/lightning/inputAddress/inputAddress.html +1 -0
  197. package/src/lightning/inputAddress/inputAddress.js +6 -0
  198. package/src/lightning/modal/__examples__disabled/allform/allform.html +1 -1
  199. package/src/lightning/modal/__examples__disabled/allform/allform.js +1 -1
  200. package/src/lightning/modal/__examples__disabled/allformfull/allformfull.css +7 -0
  201. package/src/lightning/modal/__examples__disabled/allformfull/allformfull.html +9 -0
  202. package/src/lightning/modal/__examples__disabled/allformfull/allformfull.js +49 -0
  203. package/src/lightning/modal/__examples__disabled/demoallformfull/demoallformfull.css +3 -0
  204. package/src/lightning/modal/__examples__disabled/demoallformfull/demoallformfull.html +146 -0
  205. package/src/lightning/modal/__examples__disabled/demoallformfull/demoallformfull.js +240 -0
  206. package/src/lightning/modalBase/modalBase.css +1 -1
  207. package/src/lightning/modalBase/modalBase.html +1 -1
  208. package/src/lightning/modalBase/modalBase.js +180 -45
  209. package/src/lightning/modalBody/modalBody.js +133 -18
  210. package/src/lightning/modalFooter/modalFooter.js +57 -1
  211. package/src/lightning/navigation/__docs__/navigation.md +1 -1
  212. package/src/lightning/popup/popover.slds.css +121 -0
  213. package/src/lightning/popup/popup.css +3 -0
  214. package/src/lightning/positionLibrary/direction.js +10 -17
  215. package/src/lightning/primitiveBubble/primitiveBubble.js +16 -1
  216. package/src/lightning/select/__docs__/select.md +9 -0
  217. package/src/lightning/select/__examples__/disabled/disabled.html +10 -0
  218. package/src/lightning/select/__examples__/disabled/disabled.js +27 -0
  219. package/src/lightning/select/__examples__/hidden/hidden.html +10 -0
  220. package/src/lightning/select/__examples__/hidden/hidden.js +27 -0
  221. package/src/lightning/select/__examples__/inline/inline.html +10 -0
  222. package/src/lightning/select/__examples__/inline/inline.js +27 -0
  223. package/src/lightning/select/form-element.slds.css +232 -0
  224. package/src/lightning/select/select.css +3 -0
  225. package/src/lightning/select/select.html +2 -2
  226. package/src/lightning/select/select.js +3 -0
  227. package/src/lightning/select/select.slds.css +398 -0
  228. package/src/lightning/showToastEvent/showToastEvent.js +21 -0
  229. package/src/lightning/showToastEvent/showToastEvent.js-meta.xml +4 -0
  230. package/src/lightning/sldsCommon/sldsCommon.css +21 -4
  231. package/src/lightning/toast/__docs__/toast.md +103 -0
  232. package/src/lightning/toast/toast.css +52 -0
  233. package/src/lightning/toast/toast.html +70 -0
  234. package/src/lightning/toast/toast.js +608 -0
  235. package/src/lightning/toast/toast.js-meta.xml +4 -0
  236. package/src/lightning/toastContainer/__docs__/toastContainer.md +59 -0
  237. package/src/lightning/toastContainer/toastContainer.css +32 -0
  238. package/src/lightning/toastContainer/toastContainer.html +9 -0
  239. package/src/lightning/toastContainer/toastContainer.js +471 -0
  240. package/src/lightning/toastContainer/toastContainer.js-meta.xml +6 -0
  241. package/src/lightning/tooltipLibrary/tooltipLibrary.js +70 -8
  242. package/src/lightning/treeGrid/__docs__/treeGrid.md +4 -3
  243. package/src/lightning/utilsPrivate/url.js +2 -1
  244. package/src/lightning/verticalNavigation/vertical-navigation.slds.css +4 -0
  245. package/src/lightning/verticalNavigation/verticalNavigation.css +1 -0
  246. package/src/lightning/verticalNavigation/verticalNavigation.html +1 -1
  247. package/src/lightning/verticalNavigationSection/vertical-navigation-section.slds.css +19 -0
  248. package/src/lightning/verticalNavigationSection/verticalNavigationSection.css +2 -0
  249. package/src/lightning/verticalNavigationSection/verticalNavigationSection.html +1 -1
@@ -0,0 +1,59 @@
1
+ The `lightning-toast-container` component manages a list of toast components and its order. Currently, a single page-level toast container is supported.
2
+
3
+ The component uses `LightningToast` as the toast component to display messages.
4
+
5
+ Set the maximum of toasts shown at a time with the `maxToasts` attribute, set the position of the component relative to its container component with `containerPosition` attribute and set the toasts position with `toastPosition` attribute.
6
+
7
+ The following example will create a toast container component. This component will handle and display all the page-level toast messages. Only 1 page-level container exists at a time.
8
+
9
+ By default, the toast container shows, at most, 3 toast notifications at the same time. The most recent toast will display visually at the top or first, and the oldest toast notification will be displayed at the bottom of the toast container, or last. The container position is fixed to the viewport and the toast component will display at the top and center of the container.
10
+
11
+ ```javascript
12
+ const toastContainer = ToastContainer.instance();
13
+ ```
14
+
15
+ ### Component attributes
16
+
17
+ The `maxToasts` attribute sets the maximum number of toasts shown in the container. It accepts any non-zero positive number. Default value is 3.
18
+
19
+ The `containerPosition` attribute changes the container position. It supports these values.
20
+
21
+ | Value | Explanation |
22
+ |-------| ------------ |
23
+ | `fixed` (default) | positioned relative to the initial containing block established by the viewport |
24
+ | `absolute` | positioned relative to its closest positioned ancestor |
25
+
26
+ The `toastPosition` attribute sets the toast components position in the container.
27
+
28
+ | Value | Explanation |
29
+ |-------| ------------ |
30
+ | `top-center` (default) | toasts shown at top-center in the container |
31
+ | `top-left` | toasts shown at top-left in the container |
32
+ | `top-right` | toasts shown at top-right in the container |
33
+ | `bottom-center` | toasts shown at bottom-center in the container |
34
+ | `bottom-left` | toasts shown at bottom-left in the container |
35
+ | `bottom-right` | toasts shown at bottom-right in the container |
36
+
37
+ The following example changes the page-level toast container to show at most 5 toast messages at one time at the top-right in the viewport (i.e. `containerPosition` is `fixed` by default).
38
+ ```javascript
39
+ // c/myApp.js
40
+ import { LightningElement } from 'lwc';
41
+ import ToastContainer from 'lightning/toastContainer';
42
+
43
+ export default class MyApp extends LightningElement {
44
+ connectedCallback() {
45
+ const toastContainer = ToastContainer.instance();
46
+ toastContainer.maxShown = 5;
47
+ toastContainer.toastPosition = 'top-right';
48
+ }
49
+ }
50
+ ```
51
+
52
+ ### Keyboard accessibility
53
+ Toast container is part of the [global focus orchestration](https://www.lightningdesignsystem.com/accessibility/guidelines/global-focus/#global-orchestration) which allows users to use the keyboard shortcut to navigate between toasts:
54
+ - Press `Command` + `F6` for Mac OS or `Control` + `F6` for others to move focus to next toast, if any
55
+ - Press `Shift` + `Command` + `F6` for Mac OS or `Shift` +`Control` + `F6` for others to move focus to the previous toast, if any.
56
+
57
+
58
+ ### Future support (244+)
59
+ - Local toast container support - allows multiple toast containers in a page. A component can have its own toast container to display toast messages relevant to the component's context.
@@ -0,0 +1,32 @@
1
+ .top {
2
+ top: 0;
3
+ bottom: unset;
4
+ }
5
+
6
+ .bottom {
7
+ bottom: 0;
8
+ top: unset;
9
+ }
10
+
11
+ .left {
12
+ left: 0;
13
+ right: auto;
14
+ }
15
+
16
+ .right {
17
+ left: auto;
18
+ right: 0;
19
+ }
20
+
21
+ .center {
22
+ transform: translate(50%);
23
+ right: 50%;
24
+ }
25
+
26
+ @media (max-width: 30rem) {
27
+ .center {
28
+ transform: none;
29
+ right: 0;
30
+ left: 0;
31
+ }
32
+ }
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <lightning-focus-trap>
3
+ <div data-toast-container
4
+ lwc:dom='manual'
5
+ class={containerClass}
6
+ onprivatetoastregister={handleToastRegister}>
7
+ </div>
8
+ </lightning-focus-trap>
9
+ </template>
@@ -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
+ }
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <LightningComponentBundle xmlns="xmlns=http://soap.sforce.com/2006/04/metadata">
3
+ <isExposed>true</isExposed>
4
+ <minApiVersion>58.0</minApiVersion>
5
+ <support>BETA</support>
6
+ </LightningComponentBundle>