lightning-base-components 1.18.1-alpha → 1.18.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.
Files changed (298) hide show
  1. package/metadata/raptor.json +9 -0
  2. package/package.json +57 -1
  3. package/src/lightning/accordion/__docs__/accordion.md +2 -2
  4. package/src/lightning/accordion/accordion.css +12 -0
  5. package/src/lightning/accordion/accordion.html +3 -1
  6. package/src/lightning/accordion/accordion.js +4 -2
  7. package/src/lightning/accordion/accordion.slds.css +671 -0
  8. package/src/lightning/accordionSection/accordion-section.slds.css +647 -0
  9. package/src/lightning/accordionSection/accordionSection.css +14 -0
  10. package/src/lightning/accordionSection/accordionSection.html +23 -19
  11. package/src/lightning/accordionSection/accordionSection.js +29 -2
  12. package/src/lightning/ariaObserver/__docs__/ariaObserver.md +21 -9
  13. package/src/lightning/ariaObserver/ariaObserver.js +185 -154
  14. package/src/lightning/ariaObserver/polyfill.js +639 -0
  15. package/src/lightning/avatar/__docs__/avatar.md +7 -7
  16. package/src/lightning/avatar/avatar.css +2 -0
  17. package/src/lightning/avatar/avatar.html +2 -0
  18. package/src/lightning/avatar/avatar.js +18 -15
  19. package/src/lightning/avatar/avatar.slds.css +272 -0
  20. package/src/lightning/badge/__docs__/badge.md +2 -2
  21. package/src/lightning/baseCombobox/base-combobox.slds.css +1585 -0
  22. package/src/lightning/baseCombobox/baseCombobox.css +11 -1
  23. package/src/lightning/baseCombobox/baseCombobox.html +154 -146
  24. package/src/lightning/baseCombobox/baseCombobox.js +122 -46
  25. package/src/lightning/baseCombobox/spinner.slds.css +438 -0
  26. package/src/lightning/baseComboboxItem/baseComboboxItem.js +4 -2
  27. package/src/lightning/baseComboboxItem/inline.css +2 -0
  28. package/src/lightning/breadcrumb/breadcrumb.css +2 -2
  29. package/src/lightning/breadcrumb/breadcrumb.js +4 -2
  30. package/src/lightning/breadcrumb/breadcrumb.slds.css +2 -7
  31. package/src/lightning/breadcrumbs/__docs__/breadcrumbs.md +3 -3
  32. package/src/lightning/breadcrumbs/breadcrumbs.css +2 -2
  33. package/src/lightning/breadcrumbs/breadcrumbs.js +3 -2
  34. package/src/lightning/breadcrumbs/breadcrumbs.slds.css +7 -1
  35. package/src/lightning/button/__docs__/button.md +15 -15
  36. package/src/lightning/button/__examples__/inverse/inverse.css +8 -0
  37. package/src/lightning/button/__examples__/inverse/inverse.html +3 -2
  38. package/src/lightning/button/button.css +2 -0
  39. package/src/lightning/button/button.html +4 -2
  40. package/src/lightning/button/button.js +21 -0
  41. package/src/lightning/button/button.slds.css +527 -0
  42. package/src/lightning/buttonGroup/buttonGroup.css +2 -2
  43. package/src/lightning/buttonGroup/buttonGroup.js +3 -2
  44. package/src/lightning/buttonIcon/__docs__/buttonIcon.md +9 -9
  45. package/src/lightning/buttonIcon/button-icon.slds.css +215 -453
  46. package/src/lightning/buttonIcon/buttonIcon.css +2 -2
  47. package/src/lightning/buttonIcon/buttonIcon.js +4 -0
  48. package/src/lightning/buttonIconStateful/__docs__/buttonIconStateful.md +9 -9
  49. package/src/lightning/buttonIconStateful/button-icon-stateful.slds.css +215 -453
  50. package/src/lightning/buttonIconStateful/buttonIconStateful.css +2 -2
  51. package/src/lightning/buttonMenu/__docs__/buttonMenu.md +8 -8
  52. package/src/lightning/buttonMenu/{dropdown.slds.css → button-menu.slds.css} +853 -217
  53. package/src/lightning/buttonMenu/buttonMenu.css +2 -2
  54. package/src/lightning/buttonMenu/buttonMenu.html +2 -2
  55. package/src/lightning/buttonMenu/buttonMenu.js +10 -14
  56. package/src/lightning/buttonStateful/__docs__/buttonStateful.md +12 -12
  57. package/src/lightning/buttonStateful/button-stateful.slds.css +225 -457
  58. package/src/lightning/buttonStateful/buttonStateful.css +2 -2
  59. package/src/lightning/buttonStateful/buttonStateful.js +3 -2
  60. package/src/lightning/calendar/__examples__/basic/basic.html +7 -0
  61. package/src/lightning/calendar/__examples__/basic/basic.js +3 -0
  62. package/src/lightning/calendar/calendar.css +3 -0
  63. package/src/lightning/calendar/calendar.html +12 -9
  64. package/src/lightning/calendar/calendar.js +18 -2
  65. package/src/lightning/calendar/calendar.slds.css +2048 -0
  66. package/src/lightning/card/__docs__/card.md +3 -3
  67. package/src/lightning/card/card.css +2 -2
  68. package/src/lightning/card/card.js +3 -2
  69. package/src/lightning/card/card.slds.css +141 -88
  70. package/src/lightning/checkboxGroup/__docs__/checkboxGroup.md +2 -2
  71. package/src/lightning/colorPickerCustom/colorPickerCustom.css +2 -2
  72. package/src/lightning/colorPickerCustom/colorPickerCustom.js +3 -2
  73. package/src/lightning/colorPickerPanel/color-picker-panel.slds.css +11 -38
  74. package/src/lightning/colorPickerPanel/colorPickerPanel.css +3 -2
  75. package/src/lightning/colorPickerPanel/colorPickerPanel.js +4 -2
  76. package/src/lightning/colorPickerPanel/popover.slds.css +121 -0
  77. package/src/lightning/combobox/combobox.css +4 -0
  78. package/src/lightning/combobox/combobox.html +31 -29
  79. package/src/lightning/combobox/combobox.js +21 -4
  80. package/src/lightning/combobox/combobox.slds.css +13 -0
  81. package/src/lightning/combobox/form-element.slds.css +281 -0
  82. package/src/lightning/configProvider/defaultConfig.js +2 -1
  83. package/src/lightning/datatable/__docs__/datatable.md +45 -35
  84. package/src/lightning/datatable/autoWidthStrategy.js +3 -0
  85. package/src/lightning/datatable/columnWidthManager.js +1 -1
  86. package/src/lightning/datatable/datatable.js +8 -7
  87. package/src/lightning/datatable/rowSelection.js +7 -4
  88. package/src/lightning/datatable/templates/table/table.html +1 -0
  89. package/src/lightning/datepicker/datepicker.css +3 -0
  90. package/src/lightning/datepicker/datepicker.html +7 -4
  91. package/src/lightning/datepicker/datepicker.js +76 -20
  92. package/src/lightning/datepicker/form-element.slds.css +281 -0
  93. package/src/lightning/datepicker/input-text.slds.css +398 -0
  94. package/src/lightning/datetimepicker/datetimepicker.css +3 -0
  95. package/src/lightning/datetimepicker/datetimepicker.html +9 -3
  96. package/src/lightning/datetimepicker/datetimepicker.js +42 -36
  97. package/src/lightning/datetimepicker/form-element.slds.css +281 -0
  98. package/src/lightning/datetimepicker/input-text.slds.css +398 -0
  99. package/src/lightning/dualListbox/dualListbox.css +2 -2
  100. package/src/lightning/dualListbox/dualListbox.html +3 -3
  101. package/src/lightning/dualListbox/dualListbox.js +47 -13
  102. package/src/lightning/dualListbox/form-element.slds.css +83 -34
  103. package/src/lightning/dualListbox/keyboard.js +20 -1
  104. package/src/lightning/dynamicIcon/dynamicIcon.js +3 -2
  105. package/src/lightning/dynamicIcon/ellie.css +1 -1
  106. package/src/lightning/dynamicIcon/eq.css +1 -1
  107. package/src/lightning/dynamicIcon/score.css +1 -1
  108. package/src/lightning/dynamicIcon/strength.css +1 -1
  109. package/src/lightning/dynamicIcon/trend.css +1 -1
  110. package/src/lightning/dynamicIcon/waffle.css +1 -1
  111. package/src/lightning/formattedRichText/formatted-rich-text.slds.css +230 -0
  112. package/src/lightning/formattedRichText/formattedRichText.css +2 -0
  113. package/src/lightning/formattedRichText/formattedRichText.js +4 -2
  114. package/src/lightning/formattedRichText/linkify.js +2 -2
  115. package/src/lightning/formattedText/formattedText.css +1 -0
  116. package/src/lightning/formattedText/formattedText.js +3 -2
  117. package/src/lightning/helptext/__docs__/helptext.md +2 -2
  118. package/src/lightning/helptext/form-element.slds.css +83 -34
  119. package/src/lightning/helptext/help-text.slds.css +215 -453
  120. package/src/lightning/helptext/helptext.css +2 -2
  121. package/src/lightning/helptext/helptext.js +3 -2
  122. package/src/lightning/i18nCldrOptions/README.md +5 -0
  123. package/src/lightning/i18nService/README.md +5 -0
  124. package/src/lightning/icon/__docs__/icon.md +5 -5
  125. package/src/lightning/icon/icon.css +2 -2
  126. package/src/lightning/icon/icon.js +21 -2
  127. package/src/lightning/icon/icon.slds.css +29 -17
  128. package/src/lightning/icon/iconColors.js +1 -0
  129. package/src/lightning/iconUtils/iconUtils.js +0 -12
  130. package/src/lightning/iconUtils/polyfill.js +5 -90
  131. package/src/lightning/input/__docs__/input.md +7 -7
  132. package/src/lightning/input/__examples__/checkboxbutton/checkboxbutton.css +6 -0
  133. package/src/lightning/input/__examples__/checkboxbutton/checkboxbutton.html +2 -1
  134. package/src/lightning/input/__examples__/checkboxbutton/checkboxbutton.js +1 -1
  135. package/src/lightning/input/__examples__/number/number.html +0 -5
  136. package/src/lightning/input/__examples__/text/text.html +0 -1
  137. package/src/lightning/input/form-element.slds.css +281 -0
  138. package/src/lightning/input/input.css +2 -3
  139. package/src/lightning/input/input.html +154 -244
  140. package/src/lightning/input/input.js +306 -595
  141. package/src/lightning/inputAddress/__docs__/inputAddress.md +3 -3
  142. package/src/lightning/inputUtils/inputUtils.js +15 -20
  143. package/src/lightning/inputUtils/normalize.js +7 -0
  144. package/src/lightning/{input/numberUtil.js → inputUtils/number.js} +1 -1
  145. package/src/lightning/inputUtils/utils.js +18 -0
  146. package/src/lightning/internationalizationLibrary/README.md +24 -0
  147. package/src/lightning/internationalizationLibrary/utils.js +4 -1
  148. package/src/lightning/layout/__docs__/layout.md +1 -1
  149. package/src/lightning/layout/__examples__/simple/simple.css +1 -1
  150. package/src/lightning/layout/layout.css +5 -1
  151. package/src/lightning/layout/layout.js +4 -2
  152. package/src/lightning/layoutItem/__examples__/alignmentBump/alignmentBump.css +1 -1
  153. package/src/lightning/layoutItem/__examples__/sizePerDevice/sizePerDevice.css +0 -1
  154. package/src/lightning/layoutItem/layoutItem.css +5 -0
  155. package/src/lightning/layoutItem/layoutItem.js +4 -2
  156. package/src/lightning/menuDivider/menu-divider.slds.css +15 -0
  157. package/src/lightning/menuDivider/menuDivider.css +3 -0
  158. package/src/lightning/menuDivider/menuDivider.html +1 -1
  159. package/src/lightning/menuDivider/menuDivider.js +4 -2
  160. package/src/lightning/menuItem/menu-item.slds.css +140 -0
  161. package/src/lightning/menuItem/menuItem.css +3 -0
  162. package/src/lightning/menuItem/menuItem.html +43 -41
  163. package/src/lightning/menuItem/menuItem.js +4 -4
  164. package/src/lightning/menuSubheader/menu-subheader.slds.css +22 -0
  165. package/src/lightning/menuSubheader/menuSubheader.css +3 -0
  166. package/src/lightning/menuSubheader/menuSubheader.html +3 -1
  167. package/src/lightning/menuSubheader/menuSubheader.js +4 -6
  168. package/src/lightning/modal/__docs__/modal.md +3 -1
  169. package/src/lightning/modal/__modalUtils__/modalContainerTestConstants.js +267 -0
  170. package/src/lightning/modal/__modalUtils__/modalContainerTestMethods.js +1165 -0
  171. package/src/lightning/modal/__modalUtils__/modalContainerTestMockData.js +131 -0
  172. package/src/lightning/modal/modal.js +1 -1
  173. package/src/lightning/modalBody/__docs__/modalBody.md +9 -9
  174. package/src/lightning/modalFooter/__docs__/modalFooter.md +9 -9
  175. package/src/lightning/modalHeader/__docs__/modalHeader.md +9 -9
  176. package/src/lightning/overlayContainer/overlayContainer.js +4 -2
  177. package/src/lightning/pill/__docs__/pill.md +3 -3
  178. package/src/lightning/pill/avatar.slds.css +272 -0
  179. package/src/lightning/pill/link.css +3 -0
  180. package/src/lightning/pill/link.html +1 -1
  181. package/src/lightning/pill/pill.js +29 -9
  182. package/src/lightning/pill/pill.slds.css +168 -0
  183. package/src/lightning/pill/plain.css +3 -0
  184. package/src/lightning/pill/plain.html +1 -1
  185. package/src/lightning/pill/plainLink.css +3 -0
  186. package/src/lightning/pill/plainLink.html +1 -1
  187. package/src/lightning/pillContainer/__docs__/pillContainer.md +14 -14
  188. package/src/lightning/pillContainer/barePillContainer.css +3 -0
  189. package/src/lightning/pillContainer/barePillContainer.html +1 -2
  190. package/src/lightning/pillContainer/listbox.slds.css +267 -0
  191. package/src/lightning/pillContainer/pill-container.slds.css +22 -0
  192. package/src/lightning/pillContainer/pill.slds.css +168 -0
  193. package/src/lightning/pillContainer/pillContainer.js +7 -3
  194. package/src/lightning/pillContainer/standardPillContainer.css +4 -0
  195. package/src/lightning/pillContainer/standardPillContainer.html +2 -2
  196. package/src/lightning/popup/popover.slds.css +119 -119
  197. package/src/lightning/popup/popup.css +1 -2
  198. package/src/lightning/popup/popup.js +3 -2
  199. package/src/lightning/positionLibrary/elementProxy.js +7 -2
  200. package/src/lightning/positionLibrary/util.js +8 -0
  201. package/src/lightning/primitiveBubble/primitiveBubble.css +2 -2
  202. package/src/lightning/primitiveBubble/primitiveBubble.js +4 -2
  203. package/src/lightning/primitiveButton/primitiveButton.js +5 -4
  204. package/src/lightning/primitiveCellFactory/cellWithStandardLayout.html +29 -21
  205. package/src/lightning/primitiveCellFactory/primitiveCellFactory.js +4 -0
  206. package/src/lightning/primitiveColorpickerButton/color-picker-button.slds.css +31 -19
  207. package/src/lightning/primitiveColorpickerButton/primitiveColorpickerButton.css +2 -2
  208. package/src/lightning/primitiveColorpickerButton/primitiveColorpickerButton.js +5 -3
  209. package/src/lightning/primitiveIcon/icon.slds.css +209 -0
  210. package/src/lightning/primitiveIcon/primitiveIcon.css +2 -1
  211. package/src/lightning/primitiveIcon/primitiveIcon.html +1 -1
  212. package/src/lightning/primitiveIcon/primitiveIcon.js +26 -16
  213. package/src/lightning/progressStep/progressStep.js +10 -13
  214. package/src/lightning/radioGroup/__docs__/radioGroup.md +4 -4
  215. package/src/lightning/radioGroup/radioGroup.css +2 -1
  216. package/src/lightning/radioGroup/radioGroup.js +4 -2
  217. package/src/lightning/select/__docs__/select.md +2 -2
  218. package/src/lightning/select/form-element.slds.css +83 -34
  219. package/src/lightning/select/select.css +2 -2
  220. package/src/lightning/select/select.js +4 -2
  221. package/src/lightning/select/select.slds.css +86 -34
  222. package/src/lightning/shadowBaseClassPrivate/shadowBaseClassPrivate.js +1 -1
  223. package/src/lightning/sldsCommon/sldsCommon.css +251 -89
  224. package/src/lightning/sldsUtilsAlignment/sldsUtilsAlignment.css +10 -0
  225. package/src/lightning/sldsUtilsAlignment/sldsUtilsAlignment.js-meta.xml +4 -0
  226. package/src/lightning/sldsUtilsBorders/sldsUtilsBorders.css +18 -0
  227. package/src/lightning/sldsUtilsBorders/sldsUtilsBorders.js-meta.xml +4 -0
  228. package/src/lightning/sldsUtilsBox/sldsUtilsBox.css +24 -0
  229. package/src/lightning/sldsUtilsBox/sldsUtilsBox.js-meta.xml +4 -0
  230. package/src/lightning/sldsUtilsFloats/sldsUtilsFloats.css +20 -0
  231. package/src/lightning/sldsUtilsFloats/sldsUtilsFloats.js-meta.xml +4 -0
  232. package/src/lightning/sldsUtilsGrid/sldsUtilsGrid.css +259 -0
  233. package/src/lightning/sldsUtilsGrid/sldsUtilsGrid.js-meta.xml +4 -0
  234. package/src/lightning/sldsUtilsHyphenation/sldsUtilsHyphenation.css +8 -0
  235. package/src/lightning/sldsUtilsHyphenation/sldsUtilsHyphenation.js-meta.xml +4 -0
  236. package/src/lightning/sldsUtilsLineClamp/sldsUtilsLineClamp.css +57 -0
  237. package/src/lightning/sldsUtilsLineClamp/sldsUtilsLineClamp.js-meta.xml +4 -0
  238. package/src/lightning/sldsUtilsMargin/sldsUtilsMargin.css +313 -0
  239. package/src/lightning/sldsUtilsMargin/sldsUtilsMargin.js-meta.xml +4 -0
  240. package/src/lightning/sldsUtilsPadding/sldsUtilsPadding.css +308 -0
  241. package/src/lightning/sldsUtilsPadding/sldsUtilsPadding.js-meta.xml +4 -0
  242. package/src/lightning/sldsUtilsPosition/sldsUtilsPosition.css +18 -0
  243. package/src/lightning/sldsUtilsPosition/sldsUtilsPosition.js-meta.xml +4 -0
  244. package/src/lightning/sldsUtilsSizing/sldsUtilsSizing.css +1408 -0
  245. package/src/lightning/sldsUtilsSizing/sldsUtilsSizing.js-meta.xml +4 -0
  246. package/src/lightning/sldsUtilsThemes/sldsUtilsThemes.css +295 -0
  247. package/src/lightning/sldsUtilsThemes/sldsUtilsThemes.js-meta.xml +4 -0
  248. package/src/lightning/sldsUtilsTruncation/sldsUtilsTruncation.css +14 -0
  249. package/src/lightning/sldsUtilsTruncation/sldsUtilsTruncation.js-meta.xml +4 -0
  250. package/src/lightning/slider/__docs__/slider.md +2 -2
  251. package/src/lightning/spinner/spinner.css +2 -2
  252. package/src/lightning/spinner/spinner.js +4 -2
  253. package/src/lightning/tabBar/tab-bar.slds.css +334 -0
  254. package/src/lightning/tabBar/tabBar.css +2 -0
  255. package/src/lightning/tabBar/tabBar.html +4 -3
  256. package/src/lightning/tabBar/tabBar.js +30 -3
  257. package/src/lightning/tabset/__docs__/tabset.md +2 -2
  258. package/src/lightning/tabset/tabset.html +5 -4
  259. package/src/lightning/tabset/tabset.js +29 -11
  260. package/src/lightning/textarea/__docs__/textarea.md +2 -2
  261. package/src/lightning/timepicker/form-element.slds.css +281 -0
  262. package/src/lightning/timepicker/timepicker.css +3 -0
  263. package/src/lightning/timepicker/timepicker.html +5 -1
  264. package/src/lightning/timepicker/timepicker.js +22 -17
  265. package/src/lightning/timepicker/timepicker.slds.css +18 -0
  266. package/src/lightning/toast/toast.js-meta.xml +2 -0
  267. package/src/lightning/toastContainer/__docs__/toastContainer.md +14 -34
  268. package/src/lightning/toastContainer/toastContainer.js +10 -15
  269. package/src/lightning/tooltipLibrary/tooltipLibrary.js +32 -23
  270. package/src/lightning/utilsPrivate/browser.js +5 -3
  271. package/src/lightning/utilsPrivate/os.js +6 -4
  272. package/src/lightning/utilsPrivate/ssr.js +4 -0
  273. package/src/lightning/utilsPrivate/utilsPrivate.js +2 -0
  274. package/src/lightning/verticalNavigation/verticalNavigation.css +2 -1
  275. package/src/lightning/verticalNavigation/verticalNavigation.js +3 -2
  276. package/src/lightning/verticalNavigationSection/verticalNavigationSection.css +2 -1
  277. package/src/lightning/verticalNavigationSection/verticalNavigationSection.js +3 -2
  278. package/src/lightning/accordion/__perf__DISABLED/accordion-perf-utils.js +0 -76
  279. package/src/lightning/accordion/__perf__DISABLED/accordion10Multiple25SectionEach.perf.js +0 -57
  280. package/src/lightning/accordion/__perf__DISABLED/accordion10Simple25SectionEach.perf.js +0 -37
  281. package/src/lightning/accordion/__perf__DISABLED/accordionMultiple50Section.perf.js +0 -45
  282. package/src/lightning/accordion/__perf__DISABLED/accordionSimple50Section.perf.js +0 -35
  283. package/src/lightning/accordion/__perf__DISABLED/container/container.html +0 -15
  284. package/src/lightning/accordion/__perf__DISABLED/container/container.js +0 -7
  285. package/src/lightning/iconUtils/isIframeInEdge.js +0 -7
  286. package/src/lightning/iconUtils/supportsSvg.js +0 -16
  287. package/src/lightning/input/input-checkbox.slds.css +0 -404
  288. package/src/lightning/input/input-text.slds.css +0 -287
  289. package/src/lightning/input/normalize.js +0 -6
  290. package/src/lightning/input/selection.js +0 -131
  291. package/src/lightning/positionLibrary/__component__/positionLibraryBounding.spec.js +0 -319
  292. package/src/lightning/positionLibrary/__component__/x/bounding/bounding.css +0 -16
  293. package/src/lightning/positionLibrary/__component__/x/bounding/bounding.html +0 -36
  294. package/src/lightning/positionLibrary/__component__/x/bounding/bounding.js +0 -122
  295. /package/src/lightning/{baseCombobox → baseComboboxItem}/listbox.slds.css +0 -0
  296. /package/src/lightning/formattedRichText/{__examples__disabled → __examples__}/basic/basic.html +0 -0
  297. /package/src/lightning/formattedRichText/{__examples__disabled → __examples__}/basic/basic.js +0 -0
  298. /package/src/lightning/{input/emailUtil.js → inputUtils/email.js} +0 -0
@@ -0,0 +1,281 @@
1
+
2
+ /* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
3
+ Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
4
+ @supports (--styling-hooks: '') {
5
+ /* TODO: Swap with utility classes */
6
+ :host([data-render-mode="shadow"]) fieldset {
7
+ border: 0;
8
+ margin: 0;
9
+ padding: 0;
10
+ }
11
+
12
+ /* FORM ELEMENT: BASE */
13
+ :host([data-render-mode="shadow"]) .slds-form-element {
14
+ position: relative;
15
+ min-width: 0;
16
+ }
17
+
18
+ :host([data-render-mode="shadow"]) .slds-form-element__label {
19
+ overflow-wrap: break-word;
20
+ word-wrap: break-word;
21
+ hyphens: auto;
22
+ display: inline-block;
23
+ color: var(--sds-g-color-neutral-base-30, #444444);
24
+ font-size: var(--sds-g-font-scale-neg-3, 0.75rem);
25
+ padding-inline-end: var(--sds-g-spacing-2, 0.5rem);
26
+ padding-block-start: var(--sds-g-spacing-1, 0.25rem);
27
+ margin-block-end: calc(var(--sds-g-spacing-1, 0.25rem) / 2);
28
+ }
29
+
30
+ :host([data-render-mode="shadow"]) .slds-form-element__label:empty {
31
+ margin: 0;
32
+ }
33
+
34
+ :host([data-render-mode="shadow"]) .slds-form-element__control {
35
+ clear: left; /* NOTE: Ideally we want left to be inline-start but browser support is not ready for that value. We need to figure out better RTL support */
36
+ position: relative;
37
+ }
38
+
39
+ :host([data-render-mode="shadow"]) .slds-form-element__icon {
40
+ display: inline-block;
41
+ position: relative;
42
+ padding-block-start: var(--sds-g-spacing-1, 0.25rem);
43
+ vertical-align: top;
44
+ line-height: var(--sds-g-font-lineheight-1, 1);
45
+ z-index: 1;
46
+ }
47
+
48
+ :host([data-render-mode="shadow"]) .slds-form-element__icon .slds-button_icon {
49
+ position: relative;
50
+ }
51
+
52
+ :host([data-render-mode="shadow"]) .slds-form-element__help,:host([data-render-mode="shadow"])
53
+ .slds-form-element__helper {
54
+ font-size: var(--sds-g-font-scale-neg-3, 0.75rem);
55
+ margin-block-start: calc(var(--sds-g-spacing-1, 0.25rem) / 2);
56
+ display: block;
57
+ }
58
+
59
+ :host([data-render-mode="shadow"]) .slds-form-element_edit .slds-form-element__static {
60
+ width: calc(100% - var(--sds-g-sizing-7, 1.5rem));
61
+ }
62
+
63
+ :host([data-render-mode="shadow"]) .slds-form-element_readonly {
64
+ flex-basis: 0%;
65
+ border-bottom: var(--sds-g-sizing-border-1, 1px) solid var(--sds-g-color-neutral-base-90, #e5e5e5);
66
+ margin-block-end: 0;
67
+ }
68
+
69
+ :host([data-render-mode="shadow"]) .slds-form-element_readonly .slds-form-element__control {
70
+ padding-block-start: calc(var(--sds-g-spacing-1, 0.25rem) / 2);
71
+ padding-block-end: calc(var(--sds-g-spacing-1, 0.25rem) / 2);
72
+ }
73
+
74
+ :host([data-render-mode="shadow"]) .slds-form-element_readonly .slds-form-element__label {
75
+ margin-block-end: 0;
76
+ }
77
+
78
+ :host([data-render-mode="shadow"]) .slds-form-element__legend {
79
+ font-weight: var(--sds-g-font-weight-7, 700);
80
+ float: left;
81
+ }
82
+
83
+ :host([data-render-mode="shadow"]) .slds-form-element__addon {
84
+ display: inline-block;
85
+ margin-block-start: 0;
86
+ margin-block-end: 0;
87
+ margin-inline-start: var(--sds-g-spacing-2, 0.5rem);
88
+ margin-inline-end: var(--sds-g-spacing-2, 0.5rem);
89
+ align-self: center;
90
+ }
91
+
92
+ :host([data-render-mode="shadow"]) .slds-form-element__static {
93
+ overflow-wrap: break-word;
94
+ word-wrap: break-word;
95
+ word-break: break-word;
96
+ display: inline-block;
97
+ font-size: var(--sds-g-font-scale-neg-1, 0.875rem);
98
+ font-weight: var(--sds-g-font-weight-4, 400);
99
+ color: var(--sds-g-color-neutral-base-10, #181818);
100
+ width: 100%;
101
+ }
102
+
103
+ :host([data-render-mode="shadow"]) .slds-form-element__static.slds-text-longform *:last-child {
104
+ margin-block-end: 0;
105
+ }
106
+
107
+ :host([data-render-mode="shadow"]) .slds-form-element__static:empty {
108
+ min-height: calc(var(--sds-g-sizing-6, 1.25rem) + 1px);
109
+ vertical-align: bottom;
110
+ }
111
+
112
+ :host([data-render-mode="shadow"]) .slds-form-element__static--edit {
113
+ width: calc(100% - var(--sds-g-sizing-7, 1.5rem));
114
+ }
115
+
116
+ :host([data-render-mode="shadow"]) .slds-required {
117
+ color: var(--sds-g-color-error-base-50, #ea001e);
118
+ margin-block-start: 0;
119
+ margin-block-end: 0;
120
+ margin-inline-start: calc(var(--sds-g-spacing-1, 0.25rem) / 2);
121
+ margin-inline-end: calc(var(--sds-g-spacing-1, 0.25rem) / 2);
122
+ }
123
+
124
+ :host([data-render-mode="shadow"]) .slds-has-error .slds-form-element__help {
125
+ color: var(--sds-g-color-error-base-50, #ea001e);
126
+ }
127
+
128
+ :host([data-render-mode="shadow"][invalid]) .slds-form-element__help {
129
+ color: var(--sds-g-color-error-base-50, #ea001e);
130
+ }
131
+
132
+ /* --------------------------------------- */
133
+
134
+ /* FORM ELEMENT: STACKED */
135
+
136
+ :host([data-render-mode="shadow"][variant~='label-stacked']) {
137
+ display: block;
138
+ }
139
+
140
+ /* TODO: Using `:not` is currently not working, and it could break the build because of issues with the dist script */
141
+
142
+ /* :host([variant~='label-stacked']):not(.slds-form-element_readonly) {
143
+ margin-block-end: var(--sds-g-spacing-2);
144
+ }
145
+
146
+ :host([variant~='label-stacked']):not(.slds-is-editing) {
147
+ padding: 0 var(--sds-g-spacing-1);
148
+ } */
149
+
150
+ /* :host([variant~='label-stacked']):not([class*="slds-size"]) {
151
+ width: 100%;
152
+ flex-basis: 100%;
153
+ } */
154
+
155
+ :host([data-render-mode="shadow"][variant~='label-stacked']) .slds-form-element {
156
+ padding: 0;
157
+ margin-block-end: 0;
158
+ }
159
+
160
+ :host([data-render-mode="shadow"][variant~='label-stacked']) .slds-form-element__label,:host([data-render-mode="shadow"][variant~='label-stacked']) .slds-form-element__control {
161
+ border-bottom: 0; /* Remove border when using legacy version of slds-form-element */
162
+ padding-inline-start: 0;
163
+ }
164
+
165
+ :host([data-render-mode="shadow"][variant~='label-stacked']) .slds-form-element__control {
166
+ width: 100%;
167
+ flex-basis: 100%;
168
+ clear: left;
169
+ }
170
+
171
+ :host([data-render-mode="shadow"][variant~='label-stacked']) .slds-form-element__icon {
172
+ float: none;
173
+ padding-block-start: var(--sds-g-spacing-1, 0.25rem);
174
+ }
175
+
176
+ /* --------------------------------------- */
177
+
178
+ /* FORM ELEMENT: INLINE */
179
+
180
+ :host([data-render-mode="shadow"][variant~='label-inline']) {
181
+ display: block;
182
+ }
183
+
184
+ /*
185
+ we have to combine with slds class here to avoid duplication
186
+ of this rule in child elements who import this stylesheet
187
+ in lighting-input this slds class is synonymous with the variant
188
+ */
189
+
190
+ :host([data-render-mode="shadow"][variant~='label-inline'].slds-form-element_horizontal) {
191
+ padding: var(--sds-g-spacing-1, 0.25rem);
192
+ margin-block-end: var(--sds-g-spacing-2, 0.5rem);
193
+ }
194
+
195
+ /* TODO: Using `:not` is currently not working, and it could break the build because of issues with the dist script */
196
+
197
+ /* :host([variant~='label-inline']):not(.slds-form-element_readonly) {
198
+ margin-block-end: var(--sds-g-spacing-2);
199
+ }
200
+
201
+ :host([variant~='label-inline']):not([class*="slds-size"]) {
202
+ width: 100%;
203
+ flex-basis: 100%;
204
+ }
205
+
206
+ :host([variant~='label-inline']:not(.slds-is-editing)) {
207
+ padding: var(--sds-g-spacing-1);
208
+ } */
209
+
210
+ :host([data-render-mode="shadow"][variant~='label-inline']).slds-is-edited {
211
+ padding-block-start: var(--sds-g-sizing-6, 1.25rem)
212
+ }
213
+
214
+ @media (min-width: 48em) {
215
+ :host([data-render-mode="shadow"][variant~='label-inline']) .slds-form-element__label {
216
+ float: left;
217
+ max-width: calc(33% - var(--sds-g-sizing-6, 1.25rem)); /* Removing icon width for when the help-text icon is present */
218
+ flex-basis: calc(33% - var(--sds-g-sizing-6, 1.25rem)); /* Some form element controls are set to display:flex */
219
+ flex-grow: 1; /* For IE and Safari which didn't auto expand to the available space */
220
+ margin-block-end: 0;
221
+ position: relative;
222
+ z-index: 1;
223
+ }
224
+
225
+ :host([data-render-mode="shadow"][variant~='label-inline']) lightning-helptext {
226
+ float: left;
227
+ }
228
+
229
+ :host([data-render-mode="shadow"][variant~='label-inline']) .slds-form-element__control {
230
+ margin-inline-start: 33%;
231
+ clear: none; /* Reset clear: left when switching to horizontal form layout */
232
+ }
233
+
234
+ :host([data-render-mode="shadow"][variant~='label-inline']) .slds-form-element__control .slds-form-element__control {
235
+ padding-inline-start: 0; /* Remove left padding on nested form controls, due to issues related to lightning-form components */
236
+ }
237
+
238
+ :host([data-render-mode="shadow"][variant~='label-inline']) .slds-dueling-list__column .slds-form-element__label {
239
+ width: auto;
240
+ max-width: 100%;
241
+ -ms-flex-preferred-size: auto;
242
+ flex-basis: auto;
243
+ float: none;
244
+ position: relative;
245
+ padding-inline-start: 0;
246
+ margin-block-end: 0;
247
+ }
248
+
249
+ :host([data-render-mode="shadow"][variant~='label-inline']) .slds-form-element__help {
250
+ margin-inline-start: 33%;
251
+ }
252
+
253
+ :host([data-render-mode="shadow"][variant~='label-inline']) .slds-dueling-list {
254
+ clear: none;
255
+ }
256
+ }
257
+
258
+ /* --------------------------------------- */
259
+
260
+ /* FORM ELEMENT: COMPOUND */
261
+
262
+ :host([data-render-mode="shadow"]) .slds-form-element_compound .slds-form-element__row {
263
+ display: flex;
264
+ margin-bottom: var(--sds-g-spacing-1, 0.25rem);
265
+ margin-left: calc(var(--sds-g-spacing-1, 0.25rem) * -1);
266
+ margin-right: calc(var(--sds-g-spacing-1, 0.25rem) * -1);
267
+ }
268
+
269
+ :host([data-render-mode="shadow"]) .slds-form-element_compound .slds-form-element__row .slds-form-element__label {
270
+ padding-top: 0;
271
+ }
272
+
273
+ :host([data-render-mode="shadow"]) .slds-form-element_compound .slds-form-element {
274
+ padding-left: var(--sds-g-spacing-1, 0.25rem);
275
+ padding-right: var(--sds-g-spacing-1, 0.25rem);
276
+ }
277
+
278
+ :host([data-render-mode="shadow"]) .slds-form-element_address .slds-form-element__row {
279
+ align-items: flex-end;
280
+ }
281
+ }
@@ -0,0 +1,3 @@
1
+ @import 'lightning/sldsCommon';
2
+ @import './timepicker.slds.css';
3
+ @import './form-element.slds.css';
@@ -10,6 +10,7 @@
10
10
  </template>
11
11
  <div class="slds-form-element__control">
12
12
  <lightning-base-combobox
13
+ part="input-container"
13
14
  onready={handleReady}
14
15
  autocomplete={autocomplete}
15
16
  dropdown-height="small"
@@ -33,8 +34,11 @@
33
34
  onblur={handleBlur}
34
35
  onselect={handleTimeSelect}
35
36
  data-aria-invalid={computedAriaInvalid}
37
+ root-aria-node={rootAriaNode}
38
+ input-described-by-elements={ariaDescribedByElements}
39
+ aria-error-message-elements={ariaErrorMessageElements}
36
40
  >
37
41
  </lightning-base-combobox>
38
42
  </div>
39
- <div id="error-message" data-error-message class={computedClass} aria-live="assertive">{_errorMessage}</div>
43
+ <div id="error-message" data-error-message class={computedClass} aria-live="assertive">{_errorMessage}</div>
40
44
  </template>
@@ -1,11 +1,11 @@
1
1
  /* eslint-disable @lwc/lwc/no-api-reassignments */
2
-
3
2
  import labelInvalidDate from '@salesforce/label/LightningDateTimePicker.invalidDate';
4
3
  import labelRangeOverflow from '@salesforce/label/LightningDateTimePicker.rangeOverflow';
5
4
  import labelRangeUnderflow from '@salesforce/label/LightningDateTimePicker.rangeUnderflow';
6
5
  import labelRequired from '@salesforce/label/LightningControl.required';
7
6
  import labelHelpTextAlternativeText from '@salesforce/label/LightningInput.helptextAlternativeText';
8
- import { LightningElement, track, api } from 'lwc';
7
+ import { track, api } from 'lwc';
8
+ import LightningShadowBaseClass from 'lightning/shadowBaseClassPrivate';
9
9
  import { getTimeToHighlight } from './utils';
10
10
  import { classSet, formatLabel } from 'lightning/utils';
11
11
  import {
@@ -22,6 +22,7 @@ import {
22
22
  synchronizeAttrs,
23
23
  normalizeString,
24
24
  computeAriaInvalid,
25
+ reflectAttribute,
25
26
  } from 'lightning/utilsPrivate';
26
27
  import { normalizeVariant, VARIANT } from 'lightning/inputUtils';
27
28
 
@@ -40,7 +41,7 @@ const TIME_STYLE = {
40
41
  LONG: 'long',
41
42
  };
42
43
 
43
- export default class LightningTimePicker extends LightningElement {
44
+ export default class LightningTimePicker extends LightningShadowBaseClass {
44
45
  static delegatesFocus = true;
45
46
 
46
47
  @track _disabled = false;
@@ -57,6 +58,8 @@ export default class LightningTimePicker extends LightningElement {
57
58
  @track _readonly = true;
58
59
  @track _describedByElements = [];
59
60
 
61
+ @api rootAriaNode;
62
+
60
63
  /**
61
64
  * Controls auto-filling of the input. Set the attribute to pass
62
65
  * through autocomplete values to be interpreted by the browser.
@@ -72,6 +75,11 @@ export default class LightningTimePicker extends LightningElement {
72
75
  @api name;
73
76
  @api placeholder = '';
74
77
 
78
+ @api
79
+ get comboboxComponent() {
80
+ return this.template.querySelector('lightning-base-combobox');
81
+ }
82
+
75
83
  @api messageWhenValueMissing;
76
84
  _ariaDescribedByElements;
77
85
  _timeStyle = TIME_STYLE.SHORT;
@@ -206,6 +214,7 @@ export default class LightningTimePicker extends LightningElement {
206
214
 
207
215
  set variant(value) {
208
216
  this._variant = normalizeVariant(value);
217
+ reflectAttribute(this, 'variant', this._variant);
209
218
  }
210
219
 
211
220
  @api
@@ -268,6 +277,7 @@ export default class LightningTimePicker extends LightningElement {
268
277
  }
269
278
 
270
279
  connectedCallback() {
280
+ super.connectedCallback();
271
281
  this.connected = true;
272
282
  }
273
283
 
@@ -275,24 +285,19 @@ export default class LightningTimePicker extends LightningElement {
275
285
  this.connected = false;
276
286
  }
277
287
 
278
- synchronizeA11y() {
279
- const label = this.template.querySelector('label');
280
- const comboBox = this.template.querySelector('lightning-base-combobox');
281
- let describedByElements = [];
282
- if (this._ariaDescribedByElements) {
283
- describedByElements = describedByElements.concat(
284
- this._ariaDescribedByElements
285
- );
286
- }
288
+ @api ariaErrorMessageElement;
287
289
 
290
+ get ariaErrorMessageElements() {
291
+ const elements = [this.ariaErrorMessageElement];
288
292
  if (this._errorMessage) {
289
- const errorMessage = this.template.querySelector(
290
- '[data-error-message]'
291
- );
292
- describedByElements.push(errorMessage);
293
+ elements.push(this.template.querySelector('[data-error-message]'));
293
294
  }
295
+ return elements;
296
+ }
297
+
298
+ synchronizeA11y() {
299
+ const label = this.template.querySelector('label');
294
300
 
295
- comboBox.inputDescribedByElements = describedByElements;
296
301
  synchronizeAttrs(label, {
297
302
  for: this._mainInputId,
298
303
  });
@@ -0,0 +1,18 @@
1
+
2
+ /* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
3
+ Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
4
+ @supports (--styling-hooks: '') {
5
+ /* ASSISTIVE TEXT */
6
+ :host([data-render-mode="shadow"]) .slds-assistive-text {
7
+ position: absolute !important;
8
+ margin: -1px !important;
9
+ border: 0 !important;
10
+ padding: 0 !important;
11
+ width: 1px !important;
12
+ height: 1px !important;
13
+ overflow: hidden !important;
14
+ clip: rect(0 0 0 0) !important;
15
+ text-transform: none !important;
16
+ white-space: nowrap !important;
17
+ }
18
+ }
@@ -1,4 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <LightningComponentBundle xmlns="xmlns=http://soap.sforce.com/2006/04/metadata">
3
3
  <isExposed>true</isExposed>
4
+ <minApiVersion>59.0</minApiVersion>
5
+ <support>BETA</support>
4
6
  </LightningComponentBundle>
@@ -1,40 +1,24 @@
1
- The `lightning-toast-container` component manages a list of toast components and its order. Currently, a single page-level toast container is supported.
1
+ Use the `lightning/toastContainer` module (Beta) to manage a list of toast components and their order. Pages support a single page-level toast container.
2
2
 
3
- The component uses `LightningToast` as the toast component to display messages.
3
+ This module is available only for LWR Sites for Experience Cloud. For more information, see [Create Components for LWR Sites](https://developer.salesforce.com/docs/atlas.en-us.exp_cloud_lwr.meta/exp_cloud_lwr/get_started_components.htm).
4
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.
5
+ This example creates a basic toast container component that handles and displays all the page-level toast messages.
10
6
 
11
7
  ```javascript
12
8
  const toastContainer = ToastContainer.instance();
13
9
  ```
14
10
 
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.
11
+ #### Customization
18
12
 
19
- The `containerPosition` attribute changes the container position. It supports these values.
13
+ By default, the toast container shows a maximum of 3 toast notifications at the same time. Set the `maxToasts` attribute to change the maximum number of toasts shown at a time.
20
14
 
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 |
15
+ Toast components display at the top center of the container by default. The most recent toast displays at the top of the container, and the oldest toast notification displays at the bottom. Change the toasts' position in the container with the `toastPosition` attribute.
25
16
 
26
- The `toastPosition` attribute sets the toast components position in the container.
17
+ The container position is fixed to the viewport. Adjust the position of the container relative to its parent element with the `containerPosition` attribute. This attribute has two values.
18
+ - `fixed` - positions the container relative to the initial containing block established by the viewport.
19
+ - `absolute` - positions the container relative to a positioned parent element.
27
20
 
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).
21
+ This example creates a page-level toast container in the top-right in the viewport that shows a maximum of 5 toast messages at one time.
38
22
  ```javascript
39
23
  // c/myApp.js
40
24
  import { LightningElement } from 'lwc';
@@ -49,11 +33,7 @@ export default class MyApp extends LightningElement {
49
33
  }
50
34
  ```
51
35
 
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.
36
+ #### Accessibility
37
+ Toast container follows the SLDS [Global Focus Orchestration](https://www.lightningdesignsystem.com/accessibility/guidelines/global-focus/#global-orchestration) accessibility guidelines, which allow users to use the keyboard shortcut to navigate between toasts.
38
+ - Press `Control` + `F6` or `Command` + `F6` for Mac OS to move focus to next toast, if any.
39
+ - Press `Shift` + `Control` + `F6` or `Shift` + `Command` + `F6` for Mac OS to move focus to the previous toast, if any.
@@ -96,11 +96,9 @@ export default class ToastContainer extends LightningOverlay {
96
96
  }
97
97
 
98
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'
99
+ * Controls the position of the toast container <div> related to the containing element. Supported values are 'absolute' and 'fixed'.
100
+ * @type {string}
101
+ * @default fixed
104
102
  */
105
103
  @api get containerPosition() {
106
104
  return this._containerPosition;
@@ -117,9 +115,8 @@ export default class ToastContainer extends LightningOverlay {
117
115
  }
118
116
 
119
117
  /**
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}
118
+ * Sets the maximum number of toast components shown at a given time.
119
+ * @type {number}
123
120
  * @default 3
124
121
  */
125
122
  @api get maxToasts() {
@@ -134,7 +131,7 @@ export default class ToastContainer extends LightningOverlay {
134
131
  }
135
132
 
136
133
  /**
137
- * return the div element which hosts the toast components
134
+ * Returns the <div> element that hosts the toast components.
138
135
  * @return {HTMLElement}
139
136
  */
140
137
  get root() {
@@ -142,11 +139,9 @@ export default class ToastContainer extends LightningOverlay {
142
139
  }
143
140
 
144
141
  /**
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'
142
+ * Controls the position of toast components inside the toast container. Supported values are 'top-left', 'top-center', 'top-right', 'bottom-left', 'bottom-center', and 'bottom-right'.
143
+ * @type {string}
144
+ * @default top-center
150
145
  */
151
146
  @api get toastPosition() {
152
147
  return this._toastPosition;
@@ -167,7 +162,7 @@ export default class ToastContainer extends LightningOverlay {
167
162
  }
168
163
 
169
164
  /**
170
- * override function to "close" the toast container (i.e. remove it from the DOM)
165
+ * Overrides the "close" function of the toast container.
171
166
  */
172
167
  @api close() {
173
168
  // reset before closing the container
@@ -1,12 +1,8 @@
1
1
  import { createElement } from 'lwc';
2
2
  import { AutoPosition, Direction } from 'lightning/positionLibrary';
3
- import {
4
- assert,
5
- guid,
6
- normalizeAriaAttribute,
7
- normalizeString,
8
- } from 'lightning/utilsPrivate';
3
+ import { assert, guid, normalizeString, isCSR } from 'lightning/utilsPrivate';
9
4
  import LightningPrimitiveBubble from 'lightning/primitiveBubble';
5
+ import AriaObserver from 'lightning/ariaObserver';
10
6
  export { Direction } from 'lightning/positionLibrary';
11
7
 
12
8
  export const BUBBLE_PREFIX = `salesforce-lightning-tooltip-bubble`;
@@ -80,6 +76,7 @@ export class Tooltip {
80
76
  _visible = false;
81
77
  _isFocusEvent = false;
82
78
  _initialResize = true;
79
+ _ariaObserver = null;
83
80
 
84
81
  _config = {};
85
82
 
@@ -108,7 +105,7 @@ export class Tooltip {
108
105
 
109
106
  // If a tooltip element is not given, fall back on the globally shared instance.
110
107
  this._element = config.element;
111
- if (!this._element) {
108
+ if (isCSR && !this._element) {
112
109
  this._element = getCachedBubbleElement;
113
110
  const bubbleElement = getCachedBubbleElement();
114
111
  if (bubbleElement.parentNode === null) {
@@ -150,16 +147,23 @@ export class Tooltip {
150
147
  this.addInfoListeners();
151
148
  break;
152
149
  }
153
- const ariaDescribedBy = normalizeAriaAttribute([
154
- target.getAttribute(ARIA_DESCRIBEDBY),
155
- this._element().contentId,
156
- ]);
157
- target.setAttribute(ARIA_DESCRIBEDBY, ariaDescribedBy);
150
+
151
+ this._ariaObserver = new AriaObserver(this._root);
152
+
153
+ this._ariaObserver.connect({
154
+ attribute: ARIA_DESCRIBEDBY,
155
+ targetNode: this._target(),
156
+ relatedNodes: this._element(),
157
+ });
158
158
 
159
159
  this._initialized = true;
160
160
  }
161
161
  }
162
162
 
163
+ disconnect() {
164
+ this._ariaObserver.disconnect();
165
+ }
166
+
163
167
  addInfoListeners() {
164
168
  const target = this._target();
165
169
 
@@ -169,9 +173,16 @@ export class Tooltip {
169
173
  );
170
174
  // Unlike the tooltip in Aura, we want clicks and keys to dismiss the tooltip.
171
175
  ['mouseleave', 'blur', 'click', 'keydown'].forEach((name) =>
172
- target.addEventListener(name, (event) =>
173
- this.hideIfNotSelfCover(event)
174
- )
176
+ target.addEventListener(name, (event) => {
177
+ if (!this._visible) {
178
+ return;
179
+ }
180
+ this.hideIfNotSelfCover(event);
181
+
182
+ if (event.key === 'Escape') {
183
+ event.stopPropagation();
184
+ }
185
+ })
175
186
  );
176
187
  }
177
188
  }
@@ -232,6 +243,9 @@ export class Tooltip {
232
243
  this.toggle();
233
244
  } else if (this._visible) {
234
245
  this.hide();
246
+ if (event.key === 'Escape') {
247
+ event.stopPropagation();
248
+ }
235
249
  }
236
250
  });
237
251
  }
@@ -291,15 +305,10 @@ export class Tooltip {
291
305
  this._visible = true;
292
306
  this._initialResize = true;
293
307
  const tooltip = this._element();
308
+ tooltip.visible = this._visible;
309
+ tooltip.content = this._value;
294
310
 
295
- /*
296
- When tabbing, populating the tooltip and making it visible too early can lead to bad interactions
297
- when the mouse is hovering over a tooltip. W-12559092
298
- */
299
- if (!this._isFocusEvent) {
300
- tooltip.content = this._value;
301
- tooltip.visible = this._visible;
302
- }
311
+ this._ariaObserver.sync();
303
312
 
304
313
  this.startPositioning();
305
314
  document.addEventListener('keydown', this.handleEscape);