lightning-base-components 1.18.1-alpha → 1.18.2-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 (215) hide show
  1. package/metadata/raptor.json +5 -0
  2. package/package.json +43 -1
  3. package/scopedImports/@salesforce-internal-core.appVersion.js +1 -1
  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/avatar.css +2 -0
  16. package/src/lightning/avatar/avatar.html +2 -0
  17. package/src/lightning/avatar/avatar.js +18 -15
  18. package/src/lightning/avatar/avatar.slds.css +272 -0
  19. package/src/lightning/baseCombobox/base-combobox.slds.css +1585 -0
  20. package/src/lightning/baseCombobox/baseCombobox.css +11 -1
  21. package/src/lightning/baseCombobox/baseCombobox.html +154 -146
  22. package/src/lightning/baseCombobox/baseCombobox.js +82 -46
  23. package/src/lightning/baseCombobox/spinner.slds.css +438 -0
  24. package/src/lightning/baseComboboxItem/baseComboboxItem.js +4 -2
  25. package/src/lightning/baseComboboxItem/inline.css +2 -0
  26. package/src/lightning/breadcrumb/breadcrumb.css +2 -2
  27. package/src/lightning/breadcrumb/breadcrumb.js +4 -2
  28. package/src/lightning/breadcrumb/breadcrumb.slds.css +2 -7
  29. package/src/lightning/breadcrumbs/breadcrumbs.css +2 -2
  30. package/src/lightning/breadcrumbs/breadcrumbs.js +3 -2
  31. package/src/lightning/breadcrumbs/breadcrumbs.slds.css +7 -1
  32. package/src/lightning/button/__examples__/inverse/inverse.css +8 -0
  33. package/src/lightning/button/__examples__/inverse/inverse.html +3 -2
  34. package/src/lightning/button/button.css +2 -0
  35. package/src/lightning/button/button.html +4 -2
  36. package/src/lightning/button/button.js +21 -0
  37. package/src/lightning/button/button.slds.css +527 -0
  38. package/src/lightning/buttonGroup/buttonGroup.css +2 -2
  39. package/src/lightning/buttonGroup/buttonGroup.js +3 -2
  40. package/src/lightning/buttonIcon/button-icon.slds.css +215 -453
  41. package/src/lightning/buttonIcon/buttonIcon.css +2 -2
  42. package/src/lightning/buttonIcon/buttonIcon.js +4 -0
  43. package/src/lightning/buttonIconStateful/button-icon-stateful.slds.css +215 -453
  44. package/src/lightning/buttonIconStateful/buttonIconStateful.css +2 -2
  45. package/src/lightning/buttonMenu/{dropdown.slds.css → button-menu.slds.css} +853 -217
  46. package/src/lightning/buttonMenu/buttonMenu.css +2 -2
  47. package/src/lightning/buttonMenu/buttonMenu.html +2 -2
  48. package/src/lightning/buttonMenu/buttonMenu.js +10 -14
  49. package/src/lightning/buttonStateful/button-stateful.slds.css +225 -457
  50. package/src/lightning/buttonStateful/buttonStateful.css +2 -2
  51. package/src/lightning/buttonStateful/buttonStateful.js +3 -2
  52. package/src/lightning/calendar/__examples__/basic/basic.html +7 -0
  53. package/src/lightning/calendar/__examples__/basic/basic.js +3 -0
  54. package/src/lightning/calendar/calendar.css +3 -0
  55. package/src/lightning/calendar/calendar.html +12 -9
  56. package/src/lightning/calendar/calendar.js +15 -1
  57. package/src/lightning/calendar/calendar.slds.css +2048 -0
  58. package/src/lightning/card/card.css +2 -2
  59. package/src/lightning/card/card.js +3 -2
  60. package/src/lightning/card/card.slds.css +141 -88
  61. package/src/lightning/colorPickerCustom/colorPickerCustom.css +2 -2
  62. package/src/lightning/colorPickerCustom/colorPickerCustom.js +3 -2
  63. package/src/lightning/colorPickerPanel/color-picker-panel.slds.css +11 -38
  64. package/src/lightning/colorPickerPanel/colorPickerPanel.css +3 -2
  65. package/src/lightning/colorPickerPanel/colorPickerPanel.js +4 -2
  66. package/src/lightning/colorPickerPanel/popover.slds.css +121 -0
  67. package/src/lightning/combobox/combobox.css +4 -0
  68. package/src/lightning/combobox/combobox.html +31 -29
  69. package/src/lightning/combobox/combobox.js +21 -4
  70. package/src/lightning/combobox/combobox.slds.css +13 -0
  71. package/src/lightning/combobox/form-element.slds.css +281 -0
  72. package/src/lightning/configProvider/defaultConfig.js +2 -1
  73. package/src/lightning/datepicker/datepicker.css +3 -0
  74. package/src/lightning/datepicker/datepicker.html +7 -4
  75. package/src/lightning/datepicker/datepicker.js +73 -19
  76. package/src/lightning/datepicker/form-element.slds.css +281 -0
  77. package/src/lightning/datepicker/input-text.slds.css +398 -0
  78. package/src/lightning/datetimepicker/datetimepicker.css +3 -0
  79. package/src/lightning/datetimepicker/datetimepicker.html +9 -3
  80. package/src/lightning/datetimepicker/datetimepicker.js +39 -35
  81. package/src/lightning/datetimepicker/form-element.slds.css +281 -0
  82. package/src/lightning/datetimepicker/input-text.slds.css +398 -0
  83. package/src/lightning/dualListbox/dualListbox.css +2 -2
  84. package/src/lightning/dualListbox/dualListbox.html +3 -3
  85. package/src/lightning/dualListbox/dualListbox.js +31 -6
  86. package/src/lightning/dualListbox/form-element.slds.css +83 -34
  87. package/src/lightning/dualListbox/keyboard.js +20 -1
  88. package/src/lightning/dynamicIcon/dynamicIcon.js +3 -2
  89. package/src/lightning/dynamicIcon/ellie.css +1 -1
  90. package/src/lightning/dynamicIcon/eq.css +1 -1
  91. package/src/lightning/dynamicIcon/score.css +1 -1
  92. package/src/lightning/dynamicIcon/strength.css +1 -1
  93. package/src/lightning/dynamicIcon/trend.css +1 -1
  94. package/src/lightning/dynamicIcon/waffle.css +1 -1
  95. package/src/lightning/formattedRichText/linkify.js +2 -2
  96. package/src/lightning/helptext/form-element.slds.css +83 -34
  97. package/src/lightning/helptext/help-text.slds.css +215 -453
  98. package/src/lightning/helptext/helptext.css +2 -2
  99. package/src/lightning/helptext/helptext.js +3 -2
  100. package/src/lightning/i18nCldrOptions/README.md +5 -0
  101. package/src/lightning/i18nService/README.md +5 -0
  102. package/src/lightning/icon/icon.css +2 -2
  103. package/src/lightning/icon/icon.js +16 -2
  104. package/src/lightning/icon/icon.slds.css +29 -17
  105. package/src/lightning/icon/iconColors.js +1 -0
  106. package/src/lightning/input/__examples__/text/text.html +0 -1
  107. package/src/lightning/input/form-element.slds.css +281 -0
  108. package/src/lightning/input/input-checkbox.slds.css +3 -12
  109. package/src/lightning/input/input-text.slds.css +239 -128
  110. package/src/lightning/input/input.css +2 -1
  111. package/src/lightning/input/input.html +8 -8
  112. package/src/lightning/input/input.js +107 -73
  113. package/src/lightning/internationalizationLibrary/README.md +24 -0
  114. package/src/lightning/internationalizationLibrary/utils.js +4 -1
  115. package/src/lightning/layout/__docs__/layout.md +1 -1
  116. package/src/lightning/layout/__examples__/simple/simple.css +1 -1
  117. package/src/lightning/layout/layout.css +5 -1
  118. package/src/lightning/layout/layout.js +4 -2
  119. package/src/lightning/layoutItem/__examples__/alignmentBump/alignmentBump.css +1 -1
  120. package/src/lightning/layoutItem/__examples__/sizePerDevice/sizePerDevice.css +0 -1
  121. package/src/lightning/layoutItem/layoutItem.css +5 -0
  122. package/src/lightning/layoutItem/layoutItem.js +4 -2
  123. package/src/lightning/menuDivider/menu-divider.slds.css +15 -0
  124. package/src/lightning/menuDivider/menuDivider.css +3 -0
  125. package/src/lightning/menuDivider/menuDivider.html +1 -1
  126. package/src/lightning/menuDivider/menuDivider.js +4 -2
  127. package/src/lightning/menuItem/menu-item.slds.css +140 -0
  128. package/src/lightning/menuItem/menuItem.css +3 -0
  129. package/src/lightning/menuItem/menuItem.html +43 -41
  130. package/src/lightning/menuItem/menuItem.js +4 -4
  131. package/src/lightning/menuSubheader/menu-subheader.slds.css +22 -0
  132. package/src/lightning/menuSubheader/menuSubheader.css +3 -0
  133. package/src/lightning/menuSubheader/menuSubheader.html +3 -1
  134. package/src/lightning/menuSubheader/menuSubheader.js +4 -6
  135. package/src/lightning/modal/__docs__/modal.md +3 -1
  136. package/src/lightning/modal/__modalUtils__/modalContainerTestConstants.js +267 -0
  137. package/src/lightning/modal/__modalUtils__/modalContainerTestMethods.js +1165 -0
  138. package/src/lightning/modal/__modalUtils__/modalContainerTestMockData.js +131 -0
  139. package/src/lightning/modal/modal.js +1 -1
  140. package/src/lightning/pill/avatar.slds.css +272 -0
  141. package/src/lightning/pill/link.css +3 -0
  142. package/src/lightning/pill/link.html +1 -1
  143. package/src/lightning/pill/pill.js +29 -9
  144. package/src/lightning/pill/pill.slds.css +168 -0
  145. package/src/lightning/pill/plain.css +3 -0
  146. package/src/lightning/pill/plain.html +1 -1
  147. package/src/lightning/pill/plainLink.css +3 -0
  148. package/src/lightning/pill/plainLink.html +1 -1
  149. package/src/lightning/pillContainer/barePillContainer.css +3 -0
  150. package/src/lightning/pillContainer/barePillContainer.html +1 -2
  151. package/src/lightning/pillContainer/listbox.slds.css +267 -0
  152. package/src/lightning/pillContainer/pill-container.slds.css +22 -0
  153. package/src/lightning/pillContainer/pill.slds.css +168 -0
  154. package/src/lightning/pillContainer/pillContainer.js +7 -3
  155. package/src/lightning/pillContainer/standardPillContainer.css +4 -0
  156. package/src/lightning/pillContainer/standardPillContainer.html +2 -2
  157. package/src/lightning/popup/popover.slds.css +119 -119
  158. package/src/lightning/popup/popup.css +1 -2
  159. package/src/lightning/popup/popup.js +3 -2
  160. package/src/lightning/positionLibrary/elementProxy.js +7 -2
  161. package/src/lightning/positionLibrary/util.js +8 -0
  162. package/src/lightning/primitiveBubble/primitiveBubble.css +2 -2
  163. package/src/lightning/primitiveBubble/primitiveBubble.js +4 -2
  164. package/src/lightning/primitiveButton/primitiveButton.js +5 -4
  165. package/src/lightning/primitiveCellFactory/cellWithStandardLayout.html +29 -21
  166. package/src/lightning/primitiveCellFactory/primitiveCellFactory.js +4 -0
  167. package/src/lightning/primitiveColorpickerButton/color-picker-button.slds.css +31 -19
  168. package/src/lightning/primitiveColorpickerButton/primitiveColorpickerButton.css +2 -2
  169. package/src/lightning/primitiveColorpickerButton/primitiveColorpickerButton.js +5 -3
  170. package/src/lightning/primitiveIcon/icon.slds.css +209 -0
  171. package/src/lightning/primitiveIcon/primitiveIcon.css +2 -1
  172. package/src/lightning/primitiveIcon/primitiveIcon.html +1 -1
  173. package/src/lightning/primitiveIcon/primitiveIcon.js +18 -11
  174. package/src/lightning/progressStep/progressStep.js +10 -13
  175. package/src/lightning/radioGroup/radioGroup.css +2 -1
  176. package/src/lightning/radioGroup/radioGroup.js +4 -2
  177. package/src/lightning/select/form-element.slds.css +83 -34
  178. package/src/lightning/select/select.css +2 -2
  179. package/src/lightning/select/select.js +4 -2
  180. package/src/lightning/select/select.slds.css +86 -34
  181. package/src/lightning/sldsCommon/sldsCommon.css +135 -75
  182. package/src/lightning/spinner/spinner.css +2 -2
  183. package/src/lightning/spinner/spinner.js +4 -2
  184. package/src/lightning/tabBar/tab-bar.slds.css +334 -0
  185. package/src/lightning/tabBar/tabBar.css +2 -0
  186. package/src/lightning/tabBar/tabBar.html +4 -3
  187. package/src/lightning/tabBar/tabBar.js +30 -3
  188. package/src/lightning/tabset/tabset.html +5 -4
  189. package/src/lightning/tabset/tabset.js +29 -11
  190. package/src/lightning/timepicker/form-element.slds.css +281 -0
  191. package/src/lightning/timepicker/timepicker.css +3 -0
  192. package/src/lightning/timepicker/timepicker.html +5 -1
  193. package/src/lightning/timepicker/timepicker.js +18 -15
  194. package/src/lightning/timepicker/timepicker.slds.css +18 -0
  195. package/src/lightning/tooltipLibrary/tooltipLibrary.js +21 -19
  196. package/src/lightning/utilsPrivate/browser.js +5 -3
  197. package/src/lightning/utilsPrivate/os.js +6 -4
  198. package/src/lightning/utilsPrivate/ssr.js +4 -0
  199. package/src/lightning/utilsPrivate/utilsPrivate.js +2 -0
  200. package/src/lightning/verticalNavigation/verticalNavigation.css +2 -1
  201. package/src/lightning/verticalNavigation/verticalNavigation.js +3 -2
  202. package/src/lightning/verticalNavigationSection/verticalNavigationSection.css +2 -1
  203. package/src/lightning/verticalNavigationSection/verticalNavigationSection.js +3 -2
  204. package/src/lightning/accordion/__perf__DISABLED/accordion-perf-utils.js +0 -76
  205. package/src/lightning/accordion/__perf__DISABLED/accordion10Multiple25SectionEach.perf.js +0 -57
  206. package/src/lightning/accordion/__perf__DISABLED/accordion10Simple25SectionEach.perf.js +0 -37
  207. package/src/lightning/accordion/__perf__DISABLED/accordionMultiple50Section.perf.js +0 -45
  208. package/src/lightning/accordion/__perf__DISABLED/accordionSimple50Section.perf.js +0 -35
  209. package/src/lightning/accordion/__perf__DISABLED/container/container.html +0 -15
  210. package/src/lightning/accordion/__perf__DISABLED/container/container.js +0 -7
  211. package/src/lightning/positionLibrary/__component__/positionLibraryBounding.spec.js +0 -319
  212. package/src/lightning/positionLibrary/__component__/x/bounding/bounding.css +0 -16
  213. package/src/lightning/positionLibrary/__component__/x/bounding/bounding.html +0 -36
  214. package/src/lightning/positionLibrary/__component__/x/bounding/bounding.js +0 -122
  215. /package/src/lightning/{baseCombobox → baseComboboxItem}/listbox.slds.css +0 -0
@@ -1,57 +0,0 @@
1
- import { measure, main } from '../../../perf';
2
- import { createElement } from 'lwc';
3
- import PerfAccordionContainer from './container/container';
4
- import { generateAccordions, getSectionNames } from './accordion-perf-utils';
5
-
6
- const measureName = 'accordion-10-multiple-25-sections-each';
7
-
8
- // eslint-disable-next-line no-undef
9
- measure(measureName, 10, benchmark, run, (tag, run) => {
10
- const elements = [];
11
- const accordions = generateAccordions({
12
- numberOfAccordions: 10,
13
- numberOfSectionsPerAccordion: 25,
14
- allowMultipleSectionsOpen: true,
15
- });
16
-
17
- // we need to rewrite the open sections
18
- for (let i = 0, n = accordions.length; i < n; i++) {
19
- accordions[i].activeSectionName = getSectionNames({
20
- ownerAccordionId: 'acc-' + i,
21
- firstSectionId: 0,
22
- sectionIdIncrement: 2,
23
- maxSectionId: 25,
24
- });
25
- }
26
-
27
- // lets store the new values for sections in the update
28
- const openUpdates = [];
29
-
30
- for (let i = 0, n = accordions.length; i < n; i++) {
31
- openUpdates[i] = getSectionNames({
32
- ownerAccordionId: 'acc-' + i,
33
- firstSectionId: 1,
34
- sectionIdIncrement: 2,
35
- maxSectionId: 25,
36
- });
37
- }
38
-
39
- run('create', (i) => {
40
- const element = createElement(tag, { is: PerfAccordionContainer });
41
- Object.assign(element, accordions[i]);
42
-
43
- elements[i] = element;
44
- });
45
-
46
- run('append', (i) => {
47
- main.appendChild(elements[i]);
48
- });
49
-
50
- run('update - open a section', (i) => {
51
- elements[i].activeSectionName = openUpdates[i];
52
- });
53
-
54
- run('remove', (i) => {
55
- main.removeChild(elements[i]);
56
- });
57
- });
@@ -1,37 +0,0 @@
1
- import { measure, main } from '../../../perf';
2
- import { createElement } from 'lwc';
3
- import PerfAccordionContainer from './container/container';
4
- import { generateAccordions } from './accordion-perf-utils';
5
-
6
- const measureName = 'accordion-10-single-25-sections-each';
7
-
8
- // eslint-disable-next-line no-undef
9
- measure(measureName, 10, benchmark, run, (tag, run) => {
10
- const elements = [];
11
- const accordions = generateAccordions({
12
- numberOfAccordions: 10,
13
- numberOfSectionsPerAccordion: 25,
14
- allowMultipleSectionsOpen: false,
15
- });
16
-
17
- run('create', (i) => {
18
- const element = createElement(tag, { is: PerfAccordionContainer });
19
- Object.assign(element, accordions[i]);
20
-
21
- elements[i] = element;
22
- });
23
-
24
- run('append', (i) => {
25
- main.appendChild(elements[i]);
26
- });
27
-
28
- run('update - open a section', (i) => {
29
- // section 20 is always closed given that in the accordion i the open section is i,
30
- // and we only have 10 accordions with 25 sections each
31
- elements[i].activeSectionName = 'acc-' + i + '-section-20';
32
- });
33
-
34
- run('remove', (i) => {
35
- main.removeChild(elements[i]);
36
- });
37
- });
@@ -1,45 +0,0 @@
1
- import { measure, main } from '../../../perf';
2
- import { createElement } from 'lwc';
3
- import PerfAccordionContainer from './container/container';
4
- import { generateSections, getSectionNames } from './accordion-perf-utils';
5
-
6
- const measureName = 'accordion-1-multipleSection-50-sections';
7
-
8
- // eslint-disable-next-line no-undef
9
- measure(measureName, 1, benchmark, run, (tag, run) => {
10
- const elements = [];
11
- const accordion = {
12
- activeSectionName: getSectionNames({
13
- ownerAccordionId: 'acc-1',
14
- firstSectionId: 0,
15
- sectionIdIncrement: 2,
16
- maxSectionId: 50,
17
- }),
18
- allowMultipleSectionsOpen: true,
19
- sections: generateSections(50, 'acc-1'),
20
- };
21
-
22
- run('create', (i) => {
23
- const element = createElement(tag, { is: PerfAccordionContainer });
24
- Object.assign(element, accordion);
25
-
26
- elements[i] = element;
27
- });
28
-
29
- run('append', (i) => {
30
- main.appendChild(elements[i]);
31
- });
32
-
33
- run('update - open/close a section', (i) => {
34
- elements[i].activeSectionName = getSectionNames({
35
- ownerAccordionId: 'acc-1',
36
- firstSectionId: 1,
37
- sectionIdIncrement: 2,
38
- maxSectionId: 50,
39
- });
40
- });
41
-
42
- run('remove', (i) => {
43
- main.removeChild(elements[i]);
44
- });
45
- });
@@ -1,35 +0,0 @@
1
- import { measure, main } from '../../../perf';
2
- import { createElement } from 'lwc';
3
- import PerfAccordionContainer from './container/container';
4
- import { generateSections } from './accordion-perf-utils';
5
-
6
- const measureName = 'accordion-1-singleSection-50-sections';
7
-
8
- // eslint-disable-next-line no-undef
9
- measure(measureName, 1, benchmark, run, (tag, run) => {
10
- const elements = [];
11
- const accordion = {
12
- activeSectionName: 'acc-1-section-10', // section 10 is open
13
- allowMultipleSectionsOpen: false,
14
- sections: generateSections(50, 'acc-1'),
15
- };
16
-
17
- run('create', (i) => {
18
- const element = createElement(tag, { is: PerfAccordionContainer });
19
- Object.assign(element, accordion);
20
-
21
- elements[i] = element;
22
- });
23
-
24
- run('append', (i) => {
25
- main.appendChild(elements[i]);
26
- });
27
-
28
- run('update - open a section', (i) => {
29
- elements[i].activeSectionName = 'acc-1-section-30';
30
- });
31
-
32
- run('remove', (i) => {
33
- main.removeChild(elements[i]);
34
- });
35
- });
@@ -1,15 +0,0 @@
1
- <template>
2
- <lightning-accordion
3
- active-section-name={activeSectionName}
4
- allow-multiple-sections-open={allowMultipleSectionsOpen}
5
- >
6
- <template for:each={sections} for:item="section">
7
- <lightning-accordion-section
8
- key={section.name}
9
- name={section.name}
10
- label={section.label}>
11
- <p>{section.content}</p>
12
- </lightning-accordion-section>
13
- </template>
14
- </lightning-accordion>
15
- </template>
@@ -1,7 +0,0 @@
1
- import { LightningElement, api } from 'lwc';
2
-
3
- export default class PerfAccordionContainer extends LightningElement {
4
- @api activeSectionName;
5
- @api sections = [];
6
- @api allowMultipleSectionsOpen = false;
7
- }
@@ -1,319 +0,0 @@
1
- /*
2
- * THIS IS ONLY A SAMPLE TEST OF DEMO HOW TO RUN SAME TEST FROM WDIO
3
- * AS A KARMA TEST, SHOULD BE ALIGN TO ASYNC MODEL INSTEAD OF waitFor
4
- */
5
- import { createElement } from 'lwc';
6
- import Bounding from 'x/bounding';
7
-
8
- function createHtml(props = {}) {
9
- const element = createElement('x-bounding', { is: Bounding });
10
- Object.assign(element, props);
11
- return element;
12
- }
13
-
14
- const FLIP_MAP = {
15
- bottom: 'bottom',
16
- 'bottom-left': 'bottom-right',
17
- 'bottom-right': 'bottom-left',
18
- left: 'right',
19
- 'left-bottom': 'right-bottom',
20
- 'left-top': 'right-bottom',
21
- right: 'left',
22
- 'right-bottom': 'left-bottom',
23
- 'right-top': 'left-top',
24
- top: 'top',
25
- 'top-left': 'top-right',
26
- 'top-right': 'top-left',
27
- };
28
-
29
- /**
30
- * Fixes @W-8235775.
31
- * Clean up the DOM, removing anything that isn't Jasmine related or script/css.
32
- * These tests are sensitive to the height of the DOM and fail if other stuff is too tall.
33
- *
34
- * TODO: Remove this cleanup when this can be done in a central location instead.
35
- */
36
- function cleanDom() {
37
- const bodyNodes = Array.prototype.slice.call(
38
- document.querySelectorAll('body > *')
39
- );
40
- const nodesToRemove = bodyNodes.filter(
41
- (n) =>
42
- n.tagName.toLowerCase() !== 'script' &&
43
- n.tagName.toLowerCase() !== 'link' &&
44
- n.className.indexOf('jasmine') !== 0
45
- );
46
- for (let i = 0; i < nodesToRemove.length; i++) {
47
- document.body.removeChild(nodesToRemove[i]);
48
- }
49
-
50
- document.querySelectorAll('style').forEach((style) => style.remove());
51
- }
52
-
53
- function setup() {
54
- cleanDom();
55
-
56
- const element = createHtml();
57
- document.body.appendChild(element);
58
- return element;
59
- }
60
-
61
- function convertCasesToRtl(cases) {
62
- const result = {};
63
- Object.keys(cases).forEach((align) => {
64
- result[align] = {};
65
- Object.keys(cases[align]).forEach((pos) => {
66
- const nubbinAlign = cases[align][pos];
67
- result[align][pos] = FLIP_MAP[nubbinAlign];
68
- });
69
- });
70
- return result;
71
- }
72
-
73
- /**
74
- * Waits for the bubble to be visible and have the correct positioning. If the wait condition is
75
- * not satisfied within the global Jasmine timeout interval (5000ms by default) the consuming test
76
- * will fail.
77
- * @param {Node} element test root node
78
- * @param {String} expected expected nubbin class
79
- */
80
- function waitForBubbleAlignment(element, expected) {
81
- return new Promise((resolve) => {
82
- function waitCondition() {
83
- const bubble = element.querySelector('lightning-primitive-bubble');
84
- if (bubble && bubble.visible) {
85
- const overlay =
86
- bubble.shadowRoot.querySelector('[part="overlay"]');
87
-
88
- const classList = overlay.getAttribute('class').split(' ');
89
- const positioned = classList.indexOf(expected) > -1;
90
- if (positioned) {
91
- resolve(positioned);
92
- }
93
- }
94
-
95
- window.requestAnimationFrame(waitCondition);
96
- }
97
- waitCondition();
98
- });
99
- }
100
-
101
- /**
102
- * The nubbin css class is used to determine the correctness of the bubble position.
103
- * @param {String} align alignment of the bubble
104
- * @param {String} pos name of target for the bubble
105
- * @param {String} nubbinAlign expected alignment for the nubbin
106
- */
107
- async function verifyBubbleAlignment(align, pos, nubbinAlign) {
108
- // Set the bubble alignment for the test.
109
- const element = document.querySelector('x-bounding');
110
- const button = element.querySelector(`[data-align=${align}]`);
111
- button.click();
112
-
113
- // Show the bubble at the position being tested.
114
- const show = element.querySelector(`[data-pos=${pos}]`);
115
- show.click();
116
-
117
- const expected = `slds-nubbin_${nubbinAlign}`;
118
- const positioned = await waitForBubbleAlignment(element, expected);
119
- expect(positioned).toBeTruthy();
120
- }
121
-
122
- /**
123
- * Dynamically creates test cases for all the combinations of alignments and positions specified in
124
- * the given map.
125
- * @param {Object} cases alignments with positions and their expected outcomes to test
126
- */
127
- function executeCases(cases) {
128
- Object.keys(cases).forEach((align) => {
129
- Object.keys(cases[align]).forEach((pos) => {
130
- const nubbinAlign = cases[align][pos];
131
- it(`should have bubble with nubbin alignment of ${nubbinAlign} relative to the ${pos} element when ${align} alignment is used`, async () => {
132
- await verifyBubbleAlignment(align, pos, nubbinAlign);
133
- });
134
- });
135
- });
136
- }
137
-
138
- /*
139
- * THIS IS ONLY A SAMPLE TEST OF DEMO HOW TO RUN SAME TEST FROM WDIO
140
- * AS A KARMA TEST, SHOULD BE ALIGN TO ASYNC MODEL INSTEAD OF waitFor
141
- */
142
- describe('Viewport Bounding', () => {
143
- // We can reuse the same page instance for the tests so we only need to run setup once.
144
- beforeAll(() => {
145
- setup();
146
- });
147
- afterAll(() => {
148
- const element = document.querySelector('x-bounding');
149
- document.body.removeChild(element);
150
- document.querySelectorAll('style').forEach((style) => style.remove());
151
- });
152
-
153
- // TODO: New cases will be added and some expected alignments will change when we add support
154
- // for left-top, right-top, left-bottom, right-bottom alignments.
155
- const cases = {
156
- Bottom: {
157
- leftTop: 'top-left',
158
- top: 'top',
159
- rightTop: 'top-right',
160
- left: 'top-left',
161
- center: 'top',
162
- right: 'top-right',
163
- leftBottom: 'bottom-left',
164
- bottom: 'bottom',
165
- rightBottom: 'bottom-right',
166
- },
167
- BottomLeft: {
168
- leftTop: 'top-left',
169
- top: 'top-left',
170
- rightTop: 'top-right',
171
- left: 'top-left',
172
- center: 'top-left',
173
- right: 'top-right',
174
- leftBottom: 'bottom-left',
175
- bottom: 'bottom-left',
176
- rightBottom: 'bottom-right',
177
- },
178
- BottomRight: {
179
- leftTop: 'top-left',
180
- top: 'top-right',
181
- rightTop: 'top-right',
182
- left: 'top-left',
183
- center: 'top-right',
184
- right: 'top-right',
185
- leftBottom: 'bottom-left',
186
- bottom: 'bottom-right',
187
- rightBottom: 'bottom-right',
188
- },
189
- Left: {
190
- leftTop: 'top-left', // left-top
191
- top: 'top-right', // right-top
192
- rightTop: 'top-right', // right-top
193
- left: 'left',
194
- center: 'right',
195
- right: 'right',
196
- leftBottom: 'bottom-left', // left-bottom
197
- bottom: 'bottom-right', // right-bottom
198
- rightBottom: 'bottom-right', // right-bottom
199
- },
200
- Right: {
201
- leftTop: 'top-left', // left-top
202
- top: 'top-left', // left-top
203
- rightTop: 'top-right', // right-top
204
- left: 'left',
205
- center: 'left',
206
- right: 'right',
207
- leftBottom: 'bottom-left', // left-bottom
208
- bottom: 'bottom-left', // left-bottom
209
- rightBottom: 'bottom-right', // right-bottom
210
- },
211
- Top: {
212
- leftTop: 'top-left',
213
- top: 'top',
214
- rightTop: 'top-right',
215
- left: 'bottom-left',
216
- center: 'bottom',
217
- right: 'bottom-right',
218
- leftBottom: 'bottom-left',
219
- bottom: 'bottom',
220
- rightBottom: 'bottom-right',
221
- },
222
- TopLeft: {
223
- leftTop: 'top-left',
224
- top: 'top-left',
225
- rightTop: 'top-right',
226
- left: 'bottom-left',
227
- center: 'bottom-left',
228
- right: 'bottom-right',
229
- leftBottom: 'bottom-left',
230
- bottom: 'bottom-left',
231
- rightBottom: 'bottom-right',
232
- },
233
- TopRight: {
234
- leftTop: 'top-left',
235
- top: 'top-right',
236
- rightTop: 'top-right',
237
- left: 'bottom-left',
238
- center: 'bottom-right',
239
- right: 'bottom-right',
240
- leftBottom: 'bottom-left',
241
- bottom: 'bottom-right',
242
- rightBottom: 'bottom-right',
243
- },
244
- };
245
-
246
- describe('LTR', () => {
247
- executeCases(cases);
248
- });
249
-
250
- describe('RTL', () => {
251
- beforeEach(() => {
252
- document.dir = 'rtl';
253
- });
254
-
255
- executeCases(convertCasesToRtl(cases));
256
-
257
- afterEach(() => {
258
- document.dir = 'ltr';
259
- });
260
- });
261
- });
262
-
263
- describe('Element Bounding', () => {
264
- // Same setup as viewport bounding but with element bounding enabled.
265
- beforeAll(() => {
266
- setup();
267
- const element = document.querySelector('x-bounding');
268
- element.querySelector('[name=elementBound]').click();
269
- });
270
-
271
- afterAll(() => {
272
- const element = document.querySelector('x-bounding');
273
- document.body.removeChild(element);
274
- document.querySelectorAll('style').forEach((style) => style.remove());
275
- });
276
-
277
- describe('LTR', () => {
278
- const cases = {
279
- BottomLeft: {
280
- left: 'top-left',
281
- center: 'top-left',
282
- right: 'top-right',
283
- },
284
- BottomRight: {
285
- left: 'top-left',
286
- center: 'top-left',
287
- right: 'top-right',
288
- },
289
- };
290
-
291
- executeCases(cases);
292
- });
293
-
294
- describe('RTL', () => {
295
- beforeEach(() => {
296
- document.dir = 'rtl';
297
- });
298
-
299
- // RTL flips the positions of the left and right elements.
300
- const cases = {
301
- BottomLeft: {
302
- left: 'top-right',
303
- center: 'top-right',
304
- right: 'top-left',
305
- },
306
- BottomRight: {
307
- left: 'top-right',
308
- center: 'top-right',
309
- right: 'top-left',
310
- },
311
- };
312
-
313
- executeCases(cases);
314
-
315
- afterEach(() => {
316
- document.dir = 'ltr';
317
- });
318
- });
319
- });
@@ -1,16 +0,0 @@
1
- /**
2
- * Makes element take up available space like slds-grid_frame but works with IE11.
3
- */
4
- .frame {
5
- position: absolute;
6
- top: 0;
7
- bottom: 0;
8
- left: 0;
9
- right: 0;
10
- }
11
-
12
- .bubble {
13
- position: absolute;
14
- width: 150px;
15
- height: 150px;
16
- }
@@ -1,36 +0,0 @@
1
- <template lwc:render-mode="light">
2
- <div class="frame slds-grid slds-grid_vertical slds-p-around_large">
3
- <div class="slds-col slds-grow-none">
4
- <button data-align="Bottom" onclick={changeAlign}>B</button>
5
- <button data-align="BottomLeft" onclick={changeAlign}>BL</button>
6
- <button data-align="BottomRight" onclick={changeAlign}>BR</button>
7
- <button data-align="Left" onclick={changeAlign}>L</button>
8
- <button data-align="Right" onclick={changeAlign}>R</button>
9
- <button data-align="Top" onclick={changeAlign}>T</button>
10
- <button data-align="TopLeft" onclick={changeAlign}>TL</button>
11
- <button data-align="TopRight" onclick={changeAlign}>TR</button>
12
-
13
- <label for="elementBound" class="slds-p-left_large">Element Bound:</label>
14
- <input type="checkbox" name="elementBound" class="slds-m-left_x-small" onclick={toggleElementBound}></input>
15
-
16
- <span class="slds-p-left_large">Align: <span class="align">{align}</span></span>
17
-
18
- <lightning-primitive-bubble class="bubble" content-id="test-bubble" content="Lightning Primitive Bubble"></lightning-primitive-bubble>
19
- </div>
20
- <div class="slds-col slds-grid slds-grid_align-spread slds-grid_vertical-align-start">
21
- <lightning-button-icon class="slds-col" data-pos="leftTop" icon-name="utility:settings" onclick={toggle}></lightning-button-icon>
22
- <lightning-button-icon class="slds-col" data-pos="top" icon-name="utility:settings" onclick={toggle}></lightning-button-icon>
23
- <lightning-button-icon class="slds-col" data-pos="rightTop" icon-name="utility:settings" onclick={toggle}></lightning-button-icon>
24
- </div>
25
- <div class="slds-col slds-col_bump-bottom slds-grid slds-grid_align-spread slds-grid_vertical-align-center">
26
- <lightning-button-icon class="slds-col" data-pos="left" icon-name="utility:settings" onclick={toggle}></lightning-button-icon>
27
- <lightning-button-icon class="slds-col" data-pos="center" icon-name="utility:settings" onclick={toggle}></lightning-button-icon>
28
- <lightning-button-icon class="slds-col" data-pos="right" icon-name="utility:settings" onclick={toggle}></lightning-button-icon>
29
- </div>
30
- <div class="slds-col slds-grid slds-grid_align-spread slds-grid_vertical-align-end">
31
- <lightning-button-icon class="slds-col" data-pos="leftBottom" icon-name="utility:settings" onclick={toggle}></lightning-button-icon>
32
- <lightning-button-icon class="slds-col" data-pos="bottom" icon-name="utility:settings" onclick={toggle}></lightning-button-icon>
33
- <lightning-button-icon class="slds-col" data-pos="rightBottom" icon-name="utility:settings" onclick={toggle}></lightning-button-icon>
34
- </div>
35
- </div>
36
- </template>