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
@@ -20,6 +20,9 @@
20
20
  "actions"
21
21
  ],
22
22
  "properties": [
23
+ {
24
+ "name": "headingLevel"
25
+ },
23
26
  {
24
27
  "name": "label"
25
28
  },
@@ -352,6 +355,9 @@
352
355
  "minVersion": "0.0",
353
356
  "slotNames": [],
354
357
  "properties": [
358
+ {
359
+ "name": "disabled"
360
+ },
355
361
  {
356
362
  "name": "groupOrder"
357
363
  },
@@ -398,9 +404,15 @@
398
404
  {
399
405
  "name": "headingLevel"
400
406
  },
407
+ {
408
+ "name": "hideHeader"
409
+ },
401
410
  {
402
411
  "name": "iconName"
403
412
  },
413
+ {
414
+ "name": "label"
415
+ },
404
416
  {
405
417
  "name": "variant"
406
418
  }
@@ -860,6 +872,7 @@
860
872
  "minVersion": "54.0"
861
873
  },
862
874
  "experienceModelApi": {},
875
+ "f6Controller": {},
863
876
  "fieldDependencyManager": {},
864
877
  "fieldUtils": {},
865
878
  "fileDownload": {
@@ -1524,8 +1537,10 @@
1524
1537
  "iconUtils": {},
1525
1538
  "industriesActionPlanApi": {},
1526
1539
  "industriesActionablelistApi": {},
1540
+ "industriesAssessmentApi": {},
1527
1541
  "industriesCibApi": {},
1528
1542
  "industriesClmApi": {},
1543
+ "industriesDataloadingApi": {},
1529
1544
  "industriesDecisionMatrixDesignerApi": {},
1530
1545
  "industriesDocgenApi": {},
1531
1546
  "industriesEinsteinAIAcceleratorApi": {},
@@ -2302,13 +2317,13 @@
2302
2317
  "name": "disabled"
2303
2318
  },
2304
2319
  {
2305
- "name": "errorMessage"
2320
+ "name": "entityOptions"
2306
2321
  },
2307
2322
  {
2308
- "name": "fieldLevelHelp"
2323
+ "name": "errorMessage"
2309
2324
  },
2310
2325
  {
2311
- "name": "filterItems"
2326
+ "name": "fieldLevelHelp"
2312
2327
  },
2313
2328
  {
2314
2329
  "name": "items"
@@ -2339,19 +2354,7 @@
2339
2354
  "slotNames": [],
2340
2355
  "properties": [
2341
2356
  {
2342
- "name": "errorMessage"
2343
- },
2344
- {
2345
- "name": "fieldLevelHelp"
2346
- },
2347
- {
2348
- "name": "label"
2349
- },
2350
- {
2351
- "name": "required"
2352
- },
2353
- {
2354
- "name": "variant"
2357
+ "name": "disabled"
2355
2358
  }
2356
2359
  ],
2357
2360
  "methods": [
@@ -2364,7 +2367,7 @@
2364
2367
  "slotNames": [],
2365
2368
  "properties": [
2366
2369
  {
2367
- "name": "filterItems"
2370
+ "name": "entityOptions"
2368
2371
  },
2369
2372
  {
2370
2373
  "name": "items"
@@ -3560,6 +3563,11 @@
3560
3563
  {
3561
3564
  "name": "variant"
3562
3565
  }
3566
+ ],
3567
+ "methods": [
3568
+ {
3569
+ "name": "focus"
3570
+ }
3563
3571
  ]
3564
3572
  },
3565
3573
  "toastContainer": {
@@ -3588,6 +3596,9 @@
3588
3596
  {
3589
3597
  "name": "header"
3590
3598
  },
3599
+ {
3600
+ "name": "headingLevel"
3601
+ },
3591
3602
  {
3592
3603
  "name": "items"
3593
3604
  },
@@ -3662,6 +3673,7 @@
3662
3673
  "uiGraphQLApi": {
3663
3674
  "minVersion": "57.0"
3664
3675
  },
3676
+ "uiGraphQLBatchApi": {},
3665
3677
  "uiLayoutApi": {},
3666
3678
  "uiLearningContentPlatformApi": {},
3667
3679
  "uiListApi": {
@@ -3808,6 +3820,9 @@
3808
3820
  ""
3809
3821
  ],
3810
3822
  "properties": [
3823
+ {
3824
+ "name": "headingLevel"
3825
+ },
3811
3826
  {
3812
3827
  "name": "label"
3813
3828
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lightning-base-components",
3
- "version": "1.17.1-alpha",
3
+ "version": "1.17.3-alpha",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "external",
@@ -506,6 +506,10 @@
506
506
  "name": "@salesforce/label/LightningDatatable.chooseARow",
507
507
  "path": "scopedImports/@salesforce-label-LightningDatatable.chooseARow.js"
508
508
  },
509
+ {
510
+ "name": "@salesforce/label/LightningDatatable.chooseARowSelectAll",
511
+ "path": "scopedImports/@salesforce-label-LightningDatatable.chooseARowSelectAll.js"
512
+ },
509
513
  {
510
514
  "name": "@salesforce/label/LightningDatatable.save",
511
515
  "path": "scopedImports/@salesforce-label-LightningDatatable.save.js"
@@ -910,6 +914,10 @@
910
914
  "name": "@salesforce/label/LightningLookup.messageWhenMissingInformation",
911
915
  "path": "scopedImports/@salesforce-label-LightningLookup.messageWhenMissingInformation.js"
912
916
  },
917
+ {
918
+ "name": "@salesforce/label/LightningLookup.noAccess",
919
+ "path": "scopedImports/@salesforce-label-LightningLookup.noAccess.js"
920
+ },
913
921
  {
914
922
  "name": "@salesforce/label/LightningPicklist.available",
915
923
  "path": "scopedImports/@salesforce-label-LightningPicklist.available.js"
@@ -1067,16 +1075,8 @@
1067
1075
  "path": "scopedImports/@salesforce-label-LightningToast.errorLabel.js"
1068
1076
  },
1069
1077
  {
1070
- "name": "@salesforce/label/LightningToast.missingToastLabel",
1071
- "path": "scopedImports/@salesforce-label-LightningToast.missingToastLabel.js"
1072
- },
1073
- {
1074
- "name": "@salesforce/label/LightningToastContainer.missingToastProperty",
1075
- "path": "scopedImports/@salesforce-label-LightningToastContainer.missingToastProperty.js"
1076
- },
1077
- {
1078
- "name": "@salesforce/label/LightningToastContainer.missingToastConfig",
1079
- "path": "scopedImports/@salesforce-label-LightningToastContainer.missingToastConfig.js"
1078
+ "name": "@salesforce/label/LightningToast.close",
1079
+ "path": "scopedImports/@salesforce-label-LightningToast.close.js"
1080
1080
  },
1081
1081
  {
1082
1082
  "name": "@salesforce/label/Global_Entity.created_by",
@@ -1086,6 +1086,10 @@
1086
1086
  "name": "@salesforce/label/Global_Entity.last_modified_by",
1087
1087
  "path": "scopedImports/@salesforce-label-Global_Entity.last_modified_by.js"
1088
1088
  },
1089
+ {
1090
+ "name": "@salesforce/label/AddressAutocomplete.LookupButton",
1091
+ "path": "scopedImports/@salesforce-label-AddressAutocomplete.LookupButton.js"
1092
+ },
1089
1093
  {
1090
1094
  "name": "@salesforce/i18n/lang",
1091
1095
  "path": "scopedImports/@salesforce-i18n-lang.js"
@@ -0,0 +1 @@
1
+ export default 'Search Address';
@@ -0,0 +1 @@
1
+ export default 'Choose a Row';
@@ -0,0 +1 @@
1
+ export default 'No access';
@@ -0,0 +1 @@
1
+ export default 'Close';
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <section class={computedSectionClasses}>
3
3
  <div class="slds-accordion__summary">
4
- <h3 onkeydown={handleKeyDown} class="slds-accordion__summary-heading">
4
+ <h2 aria-level={_privateHeadingAriaLevel} onkeydown={handleKeyDown} class="slds-accordion__summary-heading">
5
5
  <button class="section-control slds-button slds-button_reset slds-accordion__summary-action"
6
6
  type="button"
7
7
  aria-expanded={computedAriaExpanded}
@@ -14,7 +14,7 @@
14
14
  </lightning-primitive-icon>
15
15
  <span class="slds-accordion__summary-content" title={label}>{label}</span>
16
16
  </button>
17
- </h3>
17
+ </h2>
18
18
  <slot name="actions"></slot>
19
19
  </div>
20
20
  <div id='lgt-accordion-section' hidden={computedHidden} aria-hidden={computedAriaHidden} class="slds-accordion__content">
@@ -1,7 +1,7 @@
1
1
  import { LightningElement, api, track } from 'lwc';
2
- import { classSet } from 'lightning/utils';
3
2
  import { generateUniqueId } from 'lightning/inputUtils';
4
- import { keyCodes } from 'lightning/utilsPrivate';
3
+ import { keyCodes, isHeadingLevelValid } from 'lightning/utilsPrivate';
4
+ import { classSet } from 'lightning/utils';
5
5
 
6
6
  /**
7
7
  * A single section that is nested in an accordion component.
@@ -30,6 +30,25 @@ export default class LightningAccordionSection extends LightningElement {
30
30
 
31
31
  @track privateIsOpen = false;
32
32
 
33
+ _privateHeadingAriaLevel;
34
+
35
+ /**
36
+ * Changes the 'aria-level' attribute value for the
37
+ * <h2> markup tag in the card's title element. Supported values
38
+ * are (1, 2, 3, 4, 5, 6).
39
+ * @type {string | number}
40
+ */
41
+ @api
42
+ get headingLevel() {
43
+ return this._privateHeadingAriaLevel;
44
+ }
45
+
46
+ set headingLevel(value) {
47
+ if (isHeadingLevelValid(value)) {
48
+ this._privateHeadingAriaLevel = value;
49
+ }
50
+ }
51
+
33
52
  /**
34
53
  * Section should have received focus, but hasn't yet.
35
54
  */
@@ -75,7 +75,7 @@
75
75
  <template if:false={hasInputPill}>
76
76
  <div class="slds-input__icon-group slds-input__icon-group_right">
77
77
  <template if:true={showInputActivityIndicator}>
78
- <div role="status" class="slds-spinner slds-spinner_brand slds-spinner_x-small slds-input__spinner">
78
+ <div class="slds-spinner slds-spinner_brand slds-spinner_x-small slds-input__spinner">
79
79
  <span class="slds-assistive-text">{i18n.loadingText}</span>
80
80
  <div class="slds-spinner__dot-a"></div>
81
81
  <div class="slds-spinner__dot-b"></div>
@@ -69,7 +69,6 @@ export default class LightningBaseCombobox extends LightningElement {
69
69
  @api inputMaxlength;
70
70
  @api showInputActivityIndicator = false;
71
71
  @api required = false;
72
- @api dropdownAlignment = 'left';
73
72
  @api placeholder = i18n.placeholder;
74
73
  @api inputLabel;
75
74
 
@@ -93,8 +92,10 @@ export default class LightningBaseCombobox extends LightningElement {
93
92
  _inputAriaControls;
94
93
  _activeElementDomId;
95
94
  _autocomplete = 'off';
95
+ _dropdownAlignment = 'left';
96
96
  originDisableDefaultHighlight;
97
97
  privateDisableDefaultHighlight;
98
+ _editingMode = false;
98
99
 
99
100
  constructor() {
100
101
  super();
@@ -114,6 +115,7 @@ export default class LightningBaseCombobox extends LightningElement {
114
115
  }
115
116
 
116
117
  connectedCallback() {
118
+ this.overrideDropdownAlignment();
117
119
  this.classList.add('slds-combobox_container');
118
120
  this._connected = true;
119
121
  this._keyboardInterface = this.dropdownKeyboardInterface();
@@ -124,6 +126,15 @@ export default class LightningBaseCombobox extends LightningElement {
124
126
  this._listBoxElementCache = undefined;
125
127
  }
126
128
 
129
+ @api
130
+ get dropdownAlignment() {
131
+ return this._dropdownAlignment;
132
+ }
133
+
134
+ set dropdownAlignment(value) {
135
+ this._dropdownAlignment = value;
136
+ }
137
+
127
138
  @api
128
139
  get inputControlsElement() {
129
140
  return this._inputAriaControls;
@@ -347,12 +358,14 @@ export default class LightningBaseCombobox extends LightningElement {
347
358
  synchronizeAttrs(input, {
348
359
  [ARIA_LABELLEDBY]: this.inputLabelledById,
349
360
  [ARIA_DESCRIBEDBY]: this.computedAriaDescribedBy,
350
- [ARIA_ACTIVEDESCENDANT]: this._activeElementDomId,
351
361
  [ARIA_CONTROLS]: this.computedInputControls,
352
362
  [ARIA_LABEL]: this.isUserInputDisabled
353
363
  ? this.computedButtonTriggerAriaLabel
354
364
  : this.inputLabel,
355
365
  [ARIA_INVALID]: this.computedAriaInvalid,
366
+ [ARIA_ACTIVEDESCENDANT]: this._editingMode
367
+ ? undefined
368
+ : this._activeElementDomId,
356
369
  });
357
370
  }
358
371
 
@@ -605,6 +618,7 @@ export default class LightningBaseCombobox extends LightningElement {
605
618
 
606
619
  handleOptionMouseEnter(event) {
607
620
  if (event.target.hasAttribute('aria-selected')) {
621
+ this._editingMode = false;
608
622
  this.highlightOption(event.target);
609
623
  }
610
624
  }
@@ -662,6 +676,10 @@ export default class LightningBaseCombobox extends LightningElement {
662
676
  if (this.dropdownDisabled) {
663
677
  return;
664
678
  }
679
+ // For details: https://developer.mozilla.org/en-US/docs/Web/API/Element/keydown_event
680
+ if (event.isComposing || event.keyCode === 229) {
681
+ return;
682
+ }
665
683
  if (this.hasInputPill) {
666
684
  this.handlePillKeyDown(event);
667
685
  } else {
@@ -888,6 +906,7 @@ export default class LightningBaseCombobox extends LightningElement {
888
906
  this._selectableItems < 3
889
907
  ? SMALL_MIN_HEIGHT
890
908
  : MEDIUM_MIN_HEIGHT,
909
+ keepInViewport: true,
891
910
  });
892
911
  }
893
912
 
@@ -953,7 +972,7 @@ export default class LightningBaseCombobox extends LightningElement {
953
972
 
954
973
  highlightDefaultItem() {
955
974
  this.removeHighlight();
956
- if (!this.privateDisableDefaultHighlight) {
975
+ if (!this.privateDisableDefaultHighlight && !this._editingMode) {
957
976
  // eslint-disable-next-line @lwc/lwc/no-async-operation
958
977
  requestAnimationFrame(() => {
959
978
  this.highlightOptionAndScrollIntoView(
@@ -1041,6 +1060,13 @@ export default class LightningBaseCombobox extends LightningElement {
1041
1060
  closeDropdown() {
1042
1061
  that.closeDropdown();
1043
1062
  },
1063
+ setEditingMode(isEditing) {
1064
+ that._editingMode = isEditing;
1065
+ if (isEditing) {
1066
+ that._activeElementDomId = null;
1067
+ }
1068
+ that.synchronizeA11y();
1069
+ },
1044
1070
  };
1045
1071
  }
1046
1072
 
@@ -1049,6 +1075,33 @@ export default class LightningBaseCombobox extends LightningElement {
1049
1075
  this.template.host.getAttribute('data-aria-invalid');
1050
1076
  return computeAriaInvalid(ariaInvalid, true);
1051
1077
  }
1078
+
1079
+ isShadowRoot(node) {
1080
+ return node && node.nodeType === 11;
1081
+ }
1082
+
1083
+ parentNodeContainsClass(host, className) {
1084
+ let element = host;
1085
+ while (element.parentNode) {
1086
+ element = this.isShadowRoot(element.parentNode)
1087
+ ? element.parentNode.host
1088
+ : element.parentNode;
1089
+ if (element.classList && element.classList.contains(className)) {
1090
+ return true;
1091
+ }
1092
+ }
1093
+ return false;
1094
+ }
1095
+
1096
+ overrideDropdownAlignment() {
1097
+ let isModal = this.parentNodeContainsClass(
1098
+ this.template.host,
1099
+ 'slds-modal'
1100
+ );
1101
+ if (isModal) {
1102
+ this._dropdownAlignment = 'auto';
1103
+ }
1104
+ }
1052
1105
  }
1053
1106
 
1054
1107
  function scrollIntoViewIfNeeded(element, scrollingParent) {
@@ -157,6 +157,31 @@ const eventKeyToHandlerMap = {
157
157
  Delete: handleDeletionKeys,
158
158
  };
159
159
 
160
+ const NON_EDITING_KEYS = [
161
+ 'Enter',
162
+ 'PageUp',
163
+ 'PageDown',
164
+ 'Home',
165
+ 'End',
166
+ 'Down',
167
+ 'Up',
168
+ 'ArrowUp',
169
+ 'ArrowDown',
170
+ 'Esc',
171
+ 'Escape',
172
+ 'Tab',
173
+ ];
174
+ const isAnEditingKey = (key) => {
175
+ return !NON_EDITING_KEYS.includes(key);
176
+ };
177
+ const handleEditingMode = ({ event, dropdownInterface }) => {
178
+ if (isAnEditingKey(event.key)) {
179
+ dropdownInterface.setEditingMode(true);
180
+ } else {
181
+ dropdownInterface.setEditingMode(false);
182
+ }
183
+ };
184
+
160
185
  export function handleKeyDownOnInput({
161
186
  event,
162
187
  currentIndex,
@@ -168,4 +193,5 @@ export function handleKeyDownOnInput({
168
193
  } else {
169
194
  handleTypedCharacters(parameters);
170
195
  }
196
+ handleEditingMode(parameters);
171
197
  }
@@ -23,11 +23,9 @@ Here is an example.
23
23
 
24
24
  #### Creating Links Using Breadcrumbs
25
25
 
26
- The behavior of a breadcrumb is similar to a link. If a link is not provided
27
- via the `href` attribute, the value defaults to `javascript:void(0);`. To
28
- provide custom navigation, use an `onclick` handler with `lightning-navigation`. If you provide a link in the `href` attribute,
29
- calling `event.preventDefault()` enables you to bypass the link and use your
30
- custom navigation instead.
26
+ The behavior of a breadcrumb is similar to a link for the purpose of navigation. If a link is not provided via the `href` attribute, the value defaults to `#`. Since a breadcrumb is used as navigation, we don't recommend leaving out the `href` attribute since `#` links to the same page when middle-clicked or opened in a new tab.
27
+
28
+ To provide custom navigation, use an `onclick` handler with `lightning-navigation`. If you provide a link in the `href` attribute, calling `event.preventDefault()` enables you to bypass the link and use your custom navigation instead.
31
29
 
32
30
  ```html
33
31
  <template>
@@ -67,7 +65,8 @@ handleNavigateToCustomPage2(event) {
67
65
 
68
66
  #### Generating Breadcrumbs with Iteration
69
67
 
70
- Iterate over a list of items using `for:each` to generate breadcrumbs.
68
+ Iterate over a list of items using `for:each` to generate breadcrumbs. If you don't provide a link with an `onclick` handler, `href` defaults to `#`.
69
+
71
70
  For example, you can create an array of breadcrumbs with label and name
72
71
  values.
73
72
 
@@ -1,2 +1,11 @@
1
1
  /* @import 'lightning/sldsCommon';
2
2
  @import './button-group.slds.css'; */
3
+
4
+ /* Fix for lihgtning-button-icon not being flush with lightning-button, for details see: W-11658757
5
+ *
6
+ * :host:not([data-render-mode]) - specifies that this style will only be applied in synthetic shadow mode
7
+ */
8
+
9
+ :host:not([data-render-mode]) .fix_button-group-flexbox {
10
+ display: inline-flex;
11
+ }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div part="button-group">
2
+ <div part="button-group" class="fix_button-group-flexbox">
3
3
  <slot onslotchange={handleSlotChange}></slot>
4
4
  </div>
5
5
  </template>
@@ -4,7 +4,8 @@
4
4
  onblur={handleButtonBlur}
5
5
  onclick={handleButtonClick}
6
6
  aria-live="polite"
7
- part="button">
7
+ part="button"
8
+ disabled={disabled}>
8
9
 
9
10
  <span class="slds-text-not-selected">
10
11
  <template if:true={iconNameWhenOff}>
@@ -22,6 +22,11 @@ export default class LightningButtonStateful extends LightningElement {
22
22
  isClicked: false,
23
23
  };
24
24
 
25
+ /**
26
+ * Passthrough to pass disabled attribute onto button
27
+ */
28
+ @api disabled;
29
+
25
30
  /**
26
31
  * The name of the icon to be used in the format 'utility:check' when the state is true.
27
32
  *
@@ -104,6 +109,11 @@ export default class LightningButtonStateful extends LightningElement {
104
109
  this.state.selected = normalizeBoolean(value);
105
110
  }
106
111
 
112
+ renderedCallback() {
113
+ // change host style to disable pointer event.
114
+ this.template.host.style.pointerEvents = this.disabled ? 'none' : '';
115
+ }
116
+
107
117
  /**
108
118
  * Sets focus on the button.
109
119
  */
@@ -58,7 +58,7 @@ For a View All link, set the href value of the tag to a URL to take the user to
58
58
  <lightning-button label="Old" slot="actions"></lightning-button>
59
59
  <p class="slds-p-horizontal_small">Card Body (custom component)</p>
60
60
  <div slot="footer">
61
- <a class="slds-card__footer-action" href="javascript:void(0);"
61
+ <a class="slds-card__footer-action" href="#"
62
62
  >View All
63
63
  <span class="slds-assistive-text">Accounts</span>
64
64
  </a>
@@ -111,4 +111,4 @@ This component has usage differences from its Aura counterpart. See [Base Compon
111
111
 
112
112
  #### Source Code
113
113
 
114
- `lightning-card` is available in the [Base Components Recipes GitHub repository](https://github.com/salesforce/base-components-recipes#documentation). It's transpiled into the `c` namespace so that you can use it in your own projects.
114
+ `lightning-card` is available in the [Base Components Recipes GitHub repository](https://github.com/salesforce/base-components-recipes#documentation). It's transpiled into the `c` namespace so that you can use it in your own projects.
@@ -1,5 +1,6 @@
1
1
  <template>
2
- <article class={computedWrapperClassNames} part="card">
2
+ <article class={computedWrapperClassNames} aria-label={label} part="card">
3
+ <template if:true={computedHidden}>
3
4
  <div class="slds-card__header slds-grid">
4
5
  <header class="slds-media slds-media_center slds-has-flexi-truncate" part="header">
5
6
  <template if:true={hasIcon}>
@@ -32,6 +33,7 @@
32
33
  </div>
33
34
  </header>
34
35
  </div>
36
+ </template>
35
37
  <div class="slds-card__body" part="body">
36
38
  <slot></slot>
37
39
  </div>
@@ -1,11 +1,7 @@
1
1
  import { LightningElement, api } from 'lwc';
2
2
  import { classSet } from 'lightning/utils';
3
- import {
4
- isNarrow,
5
- isBase,
6
- isHeadingLevelValid,
7
- DEFAULT_HEADING_LEVEL,
8
- } from './utils';
3
+ import { isNarrow, isBase } from './utils';
4
+ import { isHeadingLevelValid } from 'lightning/utilsPrivate';
9
5
 
10
6
  /**
11
7
  * Cards apply a container around a related grouping of information.
@@ -81,15 +77,7 @@ export default class LightningCard extends LightningElement {
81
77
  }
82
78
  }
83
79
 
84
- _privateHeadingAriaLevel = DEFAULT_HEADING_LEVEL;
85
-
86
- set headingLevel(value) {
87
- if (isHeadingLevelValid(value)) {
88
- this._privateHeadingAriaLevel = value;
89
- } else {
90
- this._privateHeadingAriaLevel = DEFAULT_HEADING_LEVEL;
91
- }
92
- }
80
+ _privateHeadingAriaLevel;
93
81
 
94
82
  /**
95
83
  * The headingLevel changes the 'aria-level' attribute value of
@@ -104,6 +92,12 @@ export default class LightningCard extends LightningElement {
104
92
  return this._privateHeadingAriaLevel;
105
93
  }
106
94
 
95
+ set headingLevel(value) {
96
+ if (isHeadingLevelValid(value)) {
97
+ this._privateHeadingAriaLevel = value;
98
+ }
99
+ }
100
+
107
101
  get titleSlot() {
108
102
  return this.template.querySelector('slot[name=title]');
109
103
  }
@@ -125,4 +119,46 @@ export default class LightningCard extends LightningElement {
125
119
  get hasStringTitle() {
126
120
  return !!this.title;
127
121
  }
122
+
123
+ privateHeaderLabel;
124
+
125
+ /**
126
+ * Assistive label for the card header. Only shown if `hideHeader` attribute is set to `true`.
127
+ * @type {string}
128
+ */
129
+ @api
130
+ get label() {
131
+ if (!this._hasTitle || this.hideHeader) {
132
+ return this.privateHeaderLabel;
133
+ }
134
+ return null;
135
+ }
136
+ set label(value) {
137
+ this.privateHeaderLabel = value;
138
+ }
139
+
140
+ get computedHidden() {
141
+ if (!this.label && this.hideHeader) {
142
+ console.warn(
143
+ 'A `lightning-card` with `hide-header` requires `label` to be set.'
144
+ );
145
+ }
146
+ return !this.hideHeader;
147
+ }
148
+
149
+ hiddenHeader = false;
150
+
151
+ /**
152
+ * Hides the header chunk of the card when set to `true`.
153
+ * Requires you to set the `label` attribute to supplement a non-rendered header. If `label` isn't set, you get a `console.warn` error.
154
+ * @type {boolean}
155
+ * @default {false}
156
+ */
157
+ @api
158
+ get hideHeader() {
159
+ return this.hiddenHeader;
160
+ }
161
+ set hideHeader(value) {
162
+ this.hiddenHeader = value;
163
+ }
128
164
  }
@@ -1,10 +1,3 @@
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 const DEFAULT_HEADING_LEVEL = '2';
7
-
8
1
  export function isNarrow(variant) {
9
2
  return typeof variant === 'string' && variant.toLowerCase() === 'narrow';
10
3
  }
@@ -12,10 +5,3 @@ export function isNarrow(variant) {
12
5
  export function isBase(variant) {
13
6
  return typeof variant === 'string' && variant.toLowerCase() === 'base';
14
7
  }
15
-
16
- export function isHeadingLevelValid(level) {
17
- return (
18
- (typeof level === 'string' || typeof level === 'number') &&
19
- VALID_HEADING_LEVELS.includes(String(level))
20
- );
21
- }