lightning-base-components 1.17.1-alpha → 1.17.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 (64) hide show
  1. package/metadata/raptor.json +32 -17
  2. package/package.json +15 -11
  3. package/scopedImports/@salesforce-label-AddressAutocomplete.LookupButton.js +1 -0
  4. package/scopedImports/@salesforce-label-LightningDatatable.chooseARowSelectAll.js +1 -0
  5. package/scopedImports/@salesforce-label-LightningLookup.noAccess.js +1 -0
  6. package/scopedImports/@salesforce-label-LightningToast.close.js +1 -0
  7. package/src/lightning/accordionSection/accordionSection.html +2 -2
  8. package/src/lightning/accordionSection/accordionSection.js +21 -2
  9. package/src/lightning/baseCombobox/baseCombobox.html +1 -1
  10. package/src/lightning/baseCombobox/baseCombobox.js +56 -3
  11. package/src/lightning/baseCombobox/keyboard.js +26 -0
  12. package/src/lightning/breadcrumb/__docs__/breadcrumb.md +5 -6
  13. package/src/lightning/buttonGroup/buttonGroup.css +9 -0
  14. package/src/lightning/buttonGroup/buttonGroup.html +1 -1
  15. package/src/lightning/buttonStateful/buttonStateful.html +2 -1
  16. package/src/lightning/buttonStateful/buttonStateful.js +10 -0
  17. package/src/lightning/card/__docs__/card.md +2 -2
  18. package/src/lightning/card/card.html +3 -1
  19. package/src/lightning/card/card.js +51 -15
  20. package/src/lightning/card/utils.js +0 -14
  21. package/src/lightning/checkboxGroup/checkboxGroup.html +1 -1
  22. package/src/lightning/datatable/datatable.js +6 -15
  23. package/src/lightning/datatable/renderManager.js +14 -5
  24. package/src/lightning/datatable/rowSelection.js +4 -4
  25. package/src/lightning/datatable/rows.js +1 -0
  26. package/src/lightning/datatable/templates/div/div.html +4 -2
  27. package/src/lightning/datatable/templates/table/table.html +6 -2
  28. package/src/lightning/dialog/README.md +1 -1
  29. package/src/lightning/focusUtils/focus.js +42 -0
  30. package/src/lightning/focusUtils/focusUtils.js +1 -0
  31. package/src/lightning/formattedAddress/formattedAddress.js +1 -1
  32. package/src/lightning/input/__docs__/input.md +1 -1
  33. package/src/lightning/input/input.html +5 -2
  34. package/src/lightning/input/input.js +14 -2
  35. package/src/lightning/modal/__docs__/modal.md +187 -20
  36. package/src/lightning/modalBase/modalBase.js +7 -6
  37. package/src/lightning/positionLibrary/overlayDetector.js +10 -1
  38. package/src/lightning/primitiveBubble/primitiveBubble.css +9 -0
  39. package/src/lightning/primitiveBubble/primitiveBubble.js +3 -1
  40. package/src/lightning/primitiveCellActions/primitiveCellActions.html +1 -0
  41. package/src/lightning/primitiveCellActions/primitiveCellActions.js +1 -1
  42. package/src/lightning/primitiveCellCheckbox/primitiveCellCheckbox.js +15 -1
  43. package/src/lightning/primitiveCellFactory/cellWithStandardLayout.html +3 -1
  44. package/src/lightning/primitiveCellFactory/primitiveCellFactory.js +1 -0
  45. package/src/lightning/primitiveHeaderFactory/primitiveHeaderFactory.js +29 -0
  46. package/src/lightning/primitiveHeaderFactory/selectableHeader.html +3 -6
  47. package/src/lightning/primitiveTreegridCellToggle/primitiveTreegridCellToggle.js +8 -3
  48. package/src/lightning/progressIndicator/progressIndicator.js +1 -1
  49. package/src/lightning/radioGroup/radioGroup.html +1 -1
  50. package/src/lightning/textarea/textarea.js +13 -1
  51. package/src/lightning/tooltipLibrary/tooltipLibrary.js +7 -0
  52. package/src/lightning/tree/tree.html +1 -1
  53. package/src/lightning/tree/tree.js +25 -1
  54. package/src/lightning/treeGrid/__docs__/treeGrid.md +15 -0
  55. package/src/lightning/treeGrid/treeGrid.js +25 -22
  56. package/src/lightning/utilsPrivate/ariaLevelHeadingUtils.js +11 -0
  57. package/src/lightning/utilsPrivate/normalize.js +22 -6
  58. package/src/lightning/utilsPrivate/os.js +36 -0
  59. package/src/lightning/utilsPrivate/utilsPrivate.js +7 -0
  60. package/src/lightning/verticalNavigationSection/verticalNavigationSection.html +1 -1
  61. package/src/lightning/verticalNavigationSection/verticalNavigationSection.js +22 -1
  62. package/scopedImports/@salesforce-label-LightningToast.missingToastLabel.js +0 -1
  63. package/scopedImports/@salesforce-label-LightningToastContainer.missingToastConfig.js +0 -1
  64. package/scopedImports/@salesforce-label-LightningToastContainer.missingToastProperty.js +0 -1
@@ -222,6 +222,13 @@ export class Tooltip {
222
222
  this.hideIfNotSelfCover(event)
223
223
  )
224
224
  );
225
+ target.addEventListener('keydown', (event) => {
226
+ if (event.keyCode === 13 && !this._visible) {
227
+ this.toggle();
228
+ } else {
229
+ this.hide();
230
+ }
231
+ });
225
232
  }
226
233
  }
227
234
  handleEscape(e) {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="slds-tree_container">
3
3
  <template if:true={header}>
4
- <h4 class="slds-tree__group-header" id="treeheading">{header}</h4>
4
+ <h4 class="slds-tree__group-header" id="treeheading" aria-level={_privateHeadingAriaLevel}>{header}</h4>
5
5
  </template>
6
6
 
7
7
  <lightning-tree-item if:true={hasChildren} class="slds-tree" role="tree" aria-labelledby={computedLabelledBy}
@@ -1,6 +1,10 @@
1
1
  import { LightningElement, api, track } from 'lwc';
2
2
  import { TreeData } from './treeData';
3
- import { keyCodes, deepCopy } from 'lightning/utilsPrivate';
3
+ import {
4
+ keyCodes,
5
+ deepCopy,
6
+ isHeadingLevelValid,
7
+ } from 'lightning/utilsPrivate';
4
8
 
5
9
  /**
6
10
  * Displays a nested tree.
@@ -41,6 +45,26 @@ export default class LightningTree extends LightningElement {
41
45
  );
42
46
  }
43
47
 
48
+ _privateHeadingAriaLevel;
49
+
50
+ /**
51
+ * Changes the 'aria-level' attribute value for the
52
+ * <h2> markup tag in the card's title element. Supported values
53
+ * are (1, 2, 3, 4, 5, 6).
54
+ *
55
+ * @type {string | number}
56
+ * @default 2
57
+ */
58
+ @api
59
+ get headingLevel() {
60
+ return this._privateHeadingAriaLevel;
61
+ }
62
+
63
+ set headingLevel(value) {
64
+ if (isHeadingLevelValid(value)) {
65
+ this._privateHeadingAriaLevel = value;
66
+ }
67
+ }
44
68
  /**
45
69
  * An array of key-value pairs that describe the tree. See the Documentation tab for more information.
46
70
  * @type {array}
@@ -36,6 +36,9 @@ include:
36
36
  - Selecting of rows
37
37
  - Text wrapping and clipping
38
38
 
39
+ This component provides styling for up to 20 nested levels. For tree grids that require more than 20 nested levels,
40
+ build your own component.
41
+
39
42
  A checkbox is displayed by default in the first column. The `hide-checkbox-column` attribute
40
43
  removes the checkbox.
41
44
 
@@ -507,6 +510,18 @@ Use the following `aria` attributes on `lightning-tree-grid` to provide a captio
507
510
  | aria-label | string | Provides an assistive label to identify a table from other tables on a page. |
508
511
  | aria-labelledby | ID reference list | Specifies the ID or list of IDs of the element or elements that contain visible descriptive text to caption or describe the table. |
509
512
 
513
+ You can add a `displayValue` on the dropdown arrow for a row. This `displayValue` replaces the default row `title` for the dropdown arrow's label.
514
+
515
+ ```javascript
516
+ {
517
+ name: '125313-7j',
518
+ accountName: 'Dach-Welch',
519
+ displayValue: 'Display Value One',
520
+ phone: '995-523-7024',
521
+ }
522
+ ```
523
+
524
+
510
525
  ##### Provide an Accessible Label for the Table
511
526
 
512
527
  Use the `aria-label` attribute to provide a more descriptive label for the table for assistive technology. The `aria-label` attribute and its value are passed down to the rendered `table` element.
@@ -273,30 +273,33 @@ export default class LightningTreeGrid extends LightningElement {
273
273
  handleRowSelection(event) {
274
274
  event.stopPropagation();
275
275
  // pass the event through
276
- switch (event.detail.config.selection) {
277
- case ROWS_ACTION.ROW_SELECT:
278
- this._selectedRowKeys.push(event.detail.config.value);
279
- break;
280
- case ROWS_ACTION.ROW_DESELECT: {
281
- const index = this._selectedRowKeys.indexOf(
282
- event.detail.config.value
283
- );
284
- this._selectedRowKeys.splice(index, 1);
285
-
286
- break;
276
+ if (event.detail.config) {
277
+ switch (event.detail.config.action) {
278
+ case ROWS_ACTION.ROW_SELECT:
279
+ this._selectedRowKeys.push(event.detail.config.value);
280
+ break;
281
+ case ROWS_ACTION.ROW_DESELECT: {
282
+ const index = this._selectedRowKeys.indexOf(
283
+ event.detail.config.value
284
+ );
285
+ this._selectedRowKeys.splice(index, 1);
286
+ break;
287
+ }
288
+ case ROWS_ACTION.SELECT_ALL_ROWS:
289
+ this._selectedRowKeys = this.getSelectedRowKeys(
290
+ event.detail.selectedRows
291
+ );
292
+ break;
293
+ case ROWS_ACTION.DESELECT_ALL_ROWS:
294
+ this._selectedRowKeys = this.getSelectedRowKeys(
295
+ event.detail.selectedRows
296
+ );
297
+ break;
298
+ default:
299
+ break;
287
300
  }
288
- case ROWS_ACTION.SELECT_ALL_ROWS:
289
- case ROWS_ACTION.DESELECT_ALL_ROWS:
290
- this._selectedRowKeys = this.getSelectedRowKeys(
291
- event.detail.selectedRows
292
- );
293
- break;
294
- default:
295
- this._selectedRowKeys.push(event.detail.config.value);
296
- break;
301
+ event.detail.config.selectedRowKeys = this._selectedRowKeys.slice();
297
302
  }
298
- delete event.detail.config; // to prevent further propagation of the config
299
-
300
303
  this.fireSelectedRowsChange(event.detail);
301
304
  }
302
305
 
@@ -0,0 +1,11 @@
1
+ /**
2
+ * These are all values that can be set to "aria-level" attribute of h2 tag for the card's title.
3
+ */
4
+ export const VALID_HEADING_LEVELS = ['1', '2', '3', '4', '5', '6'];
5
+
6
+ export function isHeadingLevelValid(level) {
7
+ return (
8
+ (typeof level === 'string' || typeof level === 'number') &&
9
+ VALID_HEADING_LEVELS.includes(level.toString())
10
+ );
11
+ }
@@ -25,6 +25,23 @@ export function normalizeBoolean(value) {
25
25
  return typeof value === 'string' || !!value;
26
26
  }
27
27
 
28
+ const isNotNumber = (value) => {
29
+ // Need to make sure it is a number than check isNaN
30
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN#difference_between_number.isnan_and_global_isnan
31
+ if (
32
+ Number.isNaN(value) ||
33
+ value === null ||
34
+ value === undefined ||
35
+ value === '' ||
36
+ Array.isArray(value)
37
+ ) {
38
+ return true;
39
+ }
40
+ // to eliminate non numeric string or other non numeric-typed objects
41
+ const convertedNumber = Number(value);
42
+ return Number.isNaN(convertedNumber);
43
+ };
44
+
28
45
  /**
29
46
  * A number normalization utility for attributes.
30
47
  * @param {number} value - The value to normalize.
@@ -39,18 +56,17 @@ export function normalizeNumber(value, config = {}) {
39
56
  const returnValueIfInvalid =
40
57
  (typeof fallbackValue === 'number' && fallbackValue) || undefined;
41
58
 
42
- // Need to make sure it is a number than check isNaN
43
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN#difference_between_number.isnan_and_global_isnan
44
- if (typeof value !== 'number' || Number.isNaN(value)) {
59
+ if (isNotNumber(value)) {
45
60
  return returnValueIfInvalid;
46
61
  }
47
- if (typeof minValue === 'number' && value < minValue) {
62
+ if (!isNotNumber(value) && value < minValue) {
48
63
  return returnValueIfInvalid;
49
64
  }
50
- if (typeof maxValue === 'number' && value > maxValue) {
65
+ if (!isNotNumber(value) && value > maxValue) {
51
66
  return returnValueIfInvalid;
52
67
  }
53
- return value;
68
+ // multiplying 1 is to make sure to convert from a numeric string to a number
69
+ return value * 1;
54
70
  }
55
71
 
56
72
  export function normalizeArray(value) {
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Verify if user is using MAC OS or not
3
+ * @returns {boolean} - true if Mac OS
4
+ */
5
+ export const isMacOSTest = ({ userAgent }) => {
6
+ return /(macintosh|macintel|macppc|mac68k|macos)/i.test(userAgent);
7
+ };
8
+
9
+ /**
10
+ * Verify if user is using iOS or not
11
+ * @returns {boolean} - true, if iOS
12
+ */
13
+ export const isiOSTest = ({ userAgent }) => {
14
+ return /(iphone|ipad|ipod)/i.test(userAgent);
15
+ };
16
+
17
+ /**
18
+ * Verify if user is using Windows OS or not
19
+ * @returns {boolean} - true, if Windows OS
20
+ */
21
+ export const isWindowsOSTest = ({ userAgent }) => {
22
+ return /(win32|win64|windows)/i.test(userAgent);
23
+ };
24
+
25
+ /**
26
+ * Verify if user is using Android OS or not
27
+ * @returns {boolean} - true, if Android OS
28
+ */
29
+ export const isAndroidOSTest = ({ userAgent }) => {
30
+ return /android/i.test(userAgent);
31
+ };
32
+
33
+ export const isMacOS = isMacOSTest(navigator);
34
+ export const isWindowsOS = isWindowsOSTest(navigator);
35
+ export const isiOS = isiOSTest(navigator);
36
+ export const isAndroidOS = isAndroidOSTest(navigator);
@@ -42,8 +42,15 @@ export {
42
42
  parseToFormattedParts,
43
43
  } from './linkify';
44
44
  export { isValidPageReference } from './pageReference';
45
+ export { isMacOS, isWindowsOS, isiOS, isAndroidOS } from './os';
46
+
45
47
  import { smartSetAttribute } from './smartSetAttribute';
46
48
 
49
+ export {
50
+ VALID_HEADING_LEVELS,
51
+ isHeadingLevelValid,
52
+ } from './ariaLevelHeadingUtils.js';
53
+
47
54
  /**
48
55
  * @param {HTMLElement} element Element to act on
49
56
  * @param {Object} values values and attributes to set, if the value is
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="slds-nav-vertical__section" onprivateoverflowregister={handleOverflowRegister}>
3
- <h2 id="vertical-navigation-section-heading" class="slds-nav-vertical__title">{label}</h2>
3
+ <h2 id="vertical-navigation-section-heading" class="slds-nav-vertical__title" aria-level={_privateHeadingAriaLevel}>{label}</h2>
4
4
  <div role="list" aria-describedby="vertical-navigation-section-heading">
5
5
  <slot></slot>
6
6
  </div>
@@ -1,5 +1,5 @@
1
1
  import { LightningElement, api, track } from 'lwc';
2
- import { guid } from 'lightning/utilsPrivate';
2
+ import { guid, isHeadingLevelValid } from 'lightning/utilsPrivate';
3
3
 
4
4
  export default class LightningVerticalNavigationSection extends LightningElement {
5
5
  headingId = guid();
@@ -28,4 +28,25 @@ export default class LightningVerticalNavigationSection extends LightningElement
28
28
  const item = event.detail;
29
29
  item.callbacks.updateAssistiveText(this.label);
30
30
  }
31
+
32
+ _privateHeadingAriaLevel;
33
+
34
+ /**
35
+ * Changes the 'aria-level' attribute value for the
36
+ * <h2> markup tag in the card's title element. Supported values
37
+ * are (1, 2, 3, 4, 5, 6).
38
+ *
39
+ * @type {string | number}
40
+ * @default 2
41
+ */
42
+ @api
43
+ get headingLevel() {
44
+ return this._privateHeadingAriaLevel;
45
+ }
46
+
47
+ set headingLevel(value) {
48
+ if (isHeadingLevelValid(value)) {
49
+ this._privateHeadingAriaLevel = value;
50
+ }
51
+ }
31
52
  }
@@ -1 +0,0 @@
1
- export default 'Provide at least the "label" property to show the toast.';
@@ -1 +0,0 @@
1
- export default 'Unable to show toast, missing toast config.';
@@ -1 +0,0 @@
1
- export default 'Unable to show toast, missing toast property\'s "{0}".';