lightning-base-components 1.21.9-alpha → 1.22.1-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 (70) hide show
  1. package/metadata/raptor.json +2 -0
  2. package/package.json +3 -5
  3. package/scopedImports/@salesforce-internal-core.appVersion.js +1 -1
  4. package/src/lightning/accordionSection/button.slds.css +10 -10
  5. package/src/lightning/baseComboboxFormattedText/baseComboboxFormattedText.js-meta.xml +1 -1
  6. package/src/lightning/button/button.slds.css +10 -10
  7. package/src/lightning/buttonIcon/button-icon.slds.css +10 -10
  8. package/src/lightning/buttonIconStateful/button-icon.slds.css +10 -10
  9. package/src/lightning/buttonIconStateful/button.slds.css +10 -10
  10. package/src/lightning/buttonMenu/button-icon.slds.css +10 -10
  11. package/src/lightning/buttonMenu/button.slds.css +10 -10
  12. package/src/lightning/buttonStateful/button-stateful.slds.css +23 -0
  13. package/src/lightning/buttonStateful/button.slds.css +10 -10
  14. package/src/lightning/buttonStateful/buttonStateful.js-meta.xml +3 -0
  15. package/src/lightning/calendar/keyboard.js +11 -3
  16. package/src/lightning/combobox/combobox.js +5 -13
  17. package/src/lightning/datatable/__examples__/withVirtualization/withVirtualization.js +0 -1
  18. package/src/lightning/datatable/datatable.js +8 -26
  19. package/src/lightning/datatable/keyboard.js +11 -10
  20. package/src/lightning/datatable/renderManager.js +1 -3
  21. package/src/lightning/datatable/rows.js +16 -9
  22. package/src/lightning/datatable/state.js +0 -1
  23. package/src/lightning/datatable/virtualization.js +11 -14
  24. package/src/lightning/formattedAddress/formattedAddress.js +3 -2
  25. package/src/lightning/formattedDateTime/formattedDateTime.js +3 -2
  26. package/src/lightning/formattedDateTime/formattedDateTime.js-meta.xml +1 -1
  27. package/src/lightning/formattedLocation/formattedLocation.js +3 -2
  28. package/src/lightning/formattedPhone/formattedPhone.js +3 -2
  29. package/src/lightning/formattedTime/formattedTime.js +3 -2
  30. package/src/lightning/formattedUrl/formattedUrl.js +3 -2
  31. package/src/lightning/helptext/button-icon.slds.css +10 -10
  32. package/src/lightning/helptext/helptext.js-meta.xml +3 -0
  33. package/src/lightning/inputAddress/__docs__/inputAddress.md +44 -3
  34. package/src/lightning/inputAddress/inputAddress.js +8 -6
  35. package/src/lightning/inputName/inputName.js-meta.xml +3 -0
  36. package/src/lightning/interactiveDialogBase/button.slds.css +507 -0
  37. package/src/lightning/interactiveDialogBase/interactive-dialog-base.slds.css +45 -17
  38. package/src/lightning/interactiveDialogBase/interactiveDialogBase.lbc.native.css +6 -1
  39. package/src/lightning/interactiveDialogBase/modal-base.slds.css +242 -0
  40. package/src/lightning/interactiveDialogBase/modal-body.slds.css +60 -0
  41. package/src/lightning/interactiveDialogBase/modal-footer.slds.css +79 -0
  42. package/src/lightning/interactiveDialogBase/modal-header.slds.css +76 -0
  43. package/src/lightning/lookupAddress/lookupAddress.js-meta.xml +3 -0
  44. package/src/lightning/menuDivider/menuDivider.js-meta.xml +3 -0
  45. package/src/lightning/menuSubheader/menuSubheader.js-meta.xml +3 -0
  46. package/src/lightning/modal/modal.js-meta.xml +3 -0
  47. package/src/lightning/modalBase/modalBase.js +7 -5
  48. package/src/lightning/modalBody/modalBody.js-meta.xml +3 -0
  49. package/src/lightning/modalFooter/modalFooter.js-meta.xml +3 -0
  50. package/src/lightning/modalHeader/modalHeader.js-meta.xml +3 -0
  51. package/src/lightning/picklist/picklist.js +3 -2
  52. package/src/lightning/pill/pill.js +1 -1
  53. package/src/lightning/pillContainer/button.slds.css +10 -10
  54. package/src/lightning/primitiveDatatableTooltipBubble/primitiveDatatableTooltipBubble.html +1 -1
  55. package/src/lightning/primitiveFileDroppableZone/primitiveFileDroppableZone.js +3 -2
  56. package/src/lightning/primitiveInputFile/button.slds.css +10 -10
  57. package/src/lightning/primitiveInputFile/input-file.slds.css +3 -2
  58. package/src/lightning/primitiveInputToggle/input-toggle.slds.css +13 -7
  59. package/src/lightning/progressBar/progressBar.js-meta.xml +3 -0
  60. package/src/lightning/progressRing/progressRing.js-meta.xml +3 -0
  61. package/src/lightning/prompt/form-element.slds.css +319 -0
  62. package/src/lightning/prompt/input-text.slds.css +506 -0
  63. package/src/lightning/prompt/prompt.lbc.native.css +2 -0
  64. package/src/lightning/purifyLib/purify.js +838 -586
  65. package/src/lightning/radioGroup/radioGroup.js-meta.xml +3 -0
  66. package/src/lightning/textarea/textarea.js-meta.xml +3 -0
  67. package/src/lightning/toast/button-icon.slds.css +10 -10
  68. package/src/lightning/toast/toast.js-meta.xml +3 -0
  69. package/src/lightning/toastContainer/toastContainer.js-meta.xml +3 -0
  70. package/src/lightning/verticalNavigationOverflow/button.slds.css +10 -10
@@ -388,7 +388,8 @@ export default class LightningCombobox extends LightningShadowBaseClass {
388
388
  'lightning-base-combobox'
389
389
  );
390
390
  baseCombobox.inputLabelledByElement = this.ariaLabelledBy;
391
- baseCombobox.inputDescribedByElements = this.computedAriaDescribedBy;
391
+ baseCombobox.inputDescribedByElements = this.ariaDescribedBy;
392
+ baseCombobox.ariaErrorMessageElements = this.ariaErrorMessageElements;
392
393
  }
393
394
 
394
395
  get templateRootNode() {
@@ -409,19 +410,10 @@ export default class LightningCombobox extends LightningShadowBaseClass {
409
410
  .toString();
410
411
  }
411
412
 
412
- get computedAriaDescribedBy() {
413
- const describedByElements = [];
413
+ get ariaErrorMessageElements() {
414
+ if (!this._helpMessage) return null;
414
415
 
415
- if (this._helpMessage) {
416
- const helpText = this.template.querySelector('[data-help-text]');
417
- describedByElements.push(helpText);
418
- }
419
-
420
- if (typeof this.ariaDescribedBy === 'string') {
421
- describedByElements.push(this.ariaDescribedBy);
422
- }
423
-
424
- return describedByElements;
416
+ return this.template.querySelector('[data-help-text]');
425
417
  }
426
418
 
427
419
  handleSelect(event) {
@@ -17,7 +17,6 @@ export default class DatatableWithVirtualization extends LightningElement {
17
17
  renderConfig = {
18
18
  virtualize: 'vertical',
19
19
  bufferSize: 10,
20
- fixedHeight: true,
21
20
  };
22
21
 
23
22
  connectedCallback() {
@@ -131,7 +131,6 @@ import {
131
131
  } from './sort';
132
132
  import {
133
133
  getGridContainerFromScrollerY,
134
- getRowDataSelector,
135
134
  getScrollerX,
136
135
  getScrollerY,
137
136
  isLoadMore,
@@ -607,7 +606,7 @@ export default class LightningDatatable extends LightningElement {
607
606
 
608
607
  /**
609
608
  * Enables and configures advanced rendering modes.
610
- * It supports properties 'bufferSize', 'fixedHeight', and 'rowHeight'.
609
+ * It supports properties 'bufferSize' and 'rowHeight'.
611
610
  *
612
611
  * @type {RenderManagerConfig} value - config object for datatable rendering
613
612
  */
@@ -1242,9 +1241,12 @@ export default class LightningDatatable extends LightningElement {
1242
1241
  if (!this._hasSetInitialCustomTypes) {
1243
1242
  this.setCustomTypes();
1244
1243
  this._hasSetInitialCustomTypes = true;
1245
- // Return here since a re-render will occur
1246
- // for column updates if custom types added
1247
- if (this._privateTypes.privateCustomTypes.size) {
1244
+ // Return here since a re-render will occur on auto width
1245
+ // tables for column updates if custom types added
1246
+ if (
1247
+ this._privateTypes.privateCustomTypes.size &&
1248
+ widthsData.columnWidthsMode === 'auto'
1249
+ ) {
1248
1250
  return;
1249
1251
  }
1250
1252
  }
@@ -2071,28 +2073,8 @@ export default class LightningDatatable extends LightningElement {
2071
2073
  if (this.state.shouldResetHeights) {
2072
2074
  resetRowHeights(state);
2073
2075
  this.state.shouldResetHeights = false;
2074
- } else if (virtualizedRows && !state.fixedHeight) {
2075
- // if row heights aren't fixed, we need to update items
2076
- // in state to know where rows should be positioned
2076
+ } else if (virtualizedRows) {
2077
2077
  handleVariableRowHeights(this.template, state, this.renderedRows);
2078
- } else if (virtualizedRows && state.fixedHeight) {
2079
- // if heights are fixed, we only need to check height of first row
2080
- const rowElement = this.template.querySelector(
2081
- getRowDataSelector(this.renderedRows[0].key)
2082
- );
2083
- // increase height by 1 since first rendered row is missing an extra 1px border
2084
- if (rowElement) {
2085
- const height = rowElement.getBoundingClientRect().height + 1;
2086
- if (state.rowHeight !== height) {
2087
- state.rowHeight = height;
2088
- state.tableHeight = state.rowHeight * state.rows.length;
2089
- state.rows.forEach((row) => {
2090
- row.style = `position:absolute;top:${
2091
- row.rowIndex * height
2092
- }px;`;
2093
- });
2094
- }
2095
- }
2096
2078
  }
2097
2079
  }
2098
2080
 
@@ -920,7 +920,7 @@ export function handlePrimitiveDatatableCellFocus(event) {
920
920
  cellElement.parentElement.dataset.rowKeyValue,
921
921
  cellElement.dataset.colKeyValue
922
922
  );
923
- if (cell.mode === KEYBOARD_ACTION_MODE) {
923
+ if (cell.keyboardMode === KEYBOARD_ACTION_MODE) {
924
924
  // Tracked state change.
925
925
  setFocusToActionableElement(
926
926
  cell,
@@ -933,12 +933,13 @@ export function handlePrimitiveDatatableCellFocus(event) {
933
933
 
934
934
  export function handlePrimitiveDatatableCellKeydown(event) {
935
935
  const { state } = this;
936
- // Don't continue if clicking on a "lightning" element
936
+ const { target } = event;
937
+ // Don't continue if clicking on a cell factory
937
938
  // Or the outer td/th element and div equivalent
938
939
  const cellElement =
939
940
  state.renderModeInline &&
940
- !event.target.shadowRoot &&
941
- !event.target.getAttribute('role')
941
+ target.tagName !== 'LIGHTNING-PRIMITIVE-CELL-FACTORY' &&
942
+ !target.getAttribute('role')
942
943
  ? getCellElementFromEventTarget(event.target)
943
944
  : undefined;
944
945
 
@@ -948,18 +949,18 @@ export function handlePrimitiveDatatableCellKeydown(event) {
948
949
 
949
950
  const cellElementChild = getCellElementChild(cellElement);
950
951
  const cell = getCellByKeys(
951
- this.state,
952
+ state,
952
953
  cellElement.parentElement.dataset.rowKeyValue,
953
954
  cellElement.dataset.colKeyValue
954
955
  );
955
- const { mode } = cell;
956
+ const { keyboardMode } = cell;
956
957
  const { keyCode, shiftKey } = event;
957
958
 
958
959
  // if it is in Action mode, then traverse to the next or previous
959
960
  // focusable element.
960
961
  // if there is no focusable element, or reach outside of the range, then move to
961
962
  // previous or next cell.
962
- if (mode === KEYBOARD_ACTION_MODE) {
963
+ if (keyboardMode === KEYBOARD_ACTION_MODE) {
963
964
  let passThroughEvent = keyCode !== keyCodes.shift;
964
965
  if (keyCode === keyCodes.left) {
965
966
  if (canMoveLeft(cell)) {
@@ -1013,7 +1014,7 @@ export function handlePrimitiveDatatableCellKeydown(event) {
1013
1014
  if (passThroughEvent) {
1014
1015
  fireCellKeydown(cell, cellElementChild, event);
1015
1016
  }
1016
- } else if (mode === KEYBOARD_NAVIGATION_MODE) {
1017
+ } else if (keyboardMode === KEYBOARD_NAVIGATION_MODE) {
1017
1018
  // click the header, press enter, it does not go to action mode without this code.
1018
1019
  if (
1019
1020
  keyCode === keyCodes.left ||
@@ -1090,7 +1091,7 @@ function resetCurrentInputIndex(
1090
1091
  // it moves focus out of table
1091
1092
  if (
1092
1093
  incomingMode === KEYBOARD_ACTION_MODE &&
1093
- cell.mode === KEYBOARD_ACTION_MODE
1094
+ cell.keyboardMode === KEYBOARD_ACTION_MODE
1094
1095
  ) {
1095
1096
  // Tracked state change.
1096
1097
  setFocusToActionableElement(
@@ -1127,7 +1128,7 @@ function setFocusToActionableElement(cell, cellElementChild, activeInputIndex) {
1127
1128
  function setMode(cell, cellElementChild, keyboardMode, info) {
1128
1129
  const normalizedInfo = info || { action: 'none' };
1129
1130
  // Tracked state changes.
1130
- cell.mode = keyboardMode;
1131
+ cell.keyboardMode = keyboardMode;
1131
1132
  if (keyboardMode === KEYBOARD_ACTION_MODE) {
1132
1133
  cell.internalTabIndex = 0;
1133
1134
  // focus without changing tabIndex doesn't work W-6185168
@@ -79,7 +79,6 @@ export class RenderManager {
79
79
  'non-negative',
80
80
  DEFAULT_BUFFER_SIZE
81
81
  );
82
- state.fixedHeight = normalizeBoolean(config.fixedHeight);
83
82
  if (typeof rowHeight === 'number') {
84
83
  state.rowHeight = rowHeight;
85
84
  this.threshold = ROW_THRESHOLD * rowHeight;
@@ -149,7 +148,6 @@ export class RenderManager {
149
148
  bufferSize,
150
149
  renderedRowCount,
151
150
  rows,
152
- fixedHeight,
153
151
  rowHeight,
154
152
  heightCache,
155
153
  } = state;
@@ -161,7 +159,7 @@ export class RenderManager {
161
159
 
162
160
  // if using variable heights, see if we can get more
163
161
  // accurate estimate based on known row heights
164
- if (!fixedHeight && heightCache[firstVisibleKey]) {
162
+ if (heightCache[firstVisibleKey]) {
165
163
  let i = firstVisibleIndex;
166
164
  let currentHeight = 0;
167
165
  let knownRowHeight = rows[i] && heightCache[rows[i].key];
@@ -404,13 +404,13 @@ export function updateCell(state, rowIndex, colIndex) {
404
404
  cell.typeAttribute0 = getRowNumberError(rowErrors, cell.scopeColValue);
405
405
  }
406
406
 
407
- let cellClass = cell.class;
407
+ let cellClass = cell.class || '';
408
+ if (cell.hasTreeData && !cellClass) {
409
+ cellClass += (cellClass.length ? ' ' : '') + TREE__ITEM_CLASS;
410
+ }
408
411
  if (cell.displayReadOnlyIcon || cell.editable) {
409
412
  cellClass += (cellClass.length ? ' ' : '') + CELL_EDIT_CLASS;
410
413
  }
411
- if (cell.hasTreeData) {
412
- cellClass += (cellClass.length ? ' ' : '') + TREE__ITEM_CLASS;
413
- }
414
414
  if (hasError) {
415
415
  cellClass += (cellClass.length ? ' ' : '') + HAS_ERROR_CLASS;
416
416
  }
@@ -423,7 +423,7 @@ export function updateCell(state, rowIndex, colIndex) {
423
423
  }
424
424
 
425
425
  cell.class = cellClass;
426
- cell.style = computeCellStyles(cell, col, renderModeRoleBased);
426
+ cell.style = computeCellStyles(cell, col, renderModeRoleBased, cell.style);
427
427
 
428
428
  if (cell.isInlined) {
429
429
  updateInlineCell(cell);
@@ -442,14 +442,19 @@ export function updateCell(state, rowIndex, colIndex) {
442
442
  * @param {Object} types - instance of DatatableTypes from `./types.js`
443
443
  * @param {Object} col - column definition
444
444
  * @param {Boolean} renderModeRoleBased - render mode of datatable (div || table)
445
+ * @param {String} initValue - default value for cell styles
445
446
  * @returns {String} - styles to be set on the cell
446
447
  */
447
- function computeCellStyles(cell, col, renderModeRoleBased) {
448
- let cellStyle = '';
448
+ function computeCellStyles(cell, col, renderModeRoleBased, initValue = '') {
449
+ let cellStyle = initValue;
450
+ if (cellStyle && !cellStyle.endsWith(';')) {
451
+ cellStyle += ';';
452
+ }
453
+
449
454
  if (cell.isCustomBareLayout) {
450
455
  // When a custom type is not using the standard layout,
451
456
  // remove the padding that comes with the standard layout
452
- cellStyle = 'padding: 0;';
457
+ cellStyle += 'padding: 0;';
453
458
  }
454
459
 
455
460
  // Width needs to be managed when rendering as divs
@@ -475,7 +480,9 @@ export function recomputeCellStyles(state) {
475
480
  state.rows.forEach((row) => {
476
481
  row.cells.forEach((cell, colIndex) => {
477
482
  const colData = columns[colIndex];
478
- cell.style = computeCellStyles(cell, colData, true);
483
+ const cellAttrs = getCellAttributesValues(colData);
484
+ const style = resolveAttributeValue(cellAttrs.style, row) || '';
485
+ cell.style = computeCellStyles(cell, colData, true, style);
479
486
  });
480
487
  });
481
488
  }
@@ -74,7 +74,6 @@ export function getDefaultState() {
74
74
  rowHeight: 30.5,
75
75
  renderedRowCount: 0,
76
76
  firstVisibleIndex: 0, // first row that should be visible in viewport
77
- fixedHeight: false, // by default, assume that not all rows are same height
78
77
  heightCache: {}, // cache of row heights
79
78
  offsets: [0],
80
79
  offsetRanges: [],
@@ -12,7 +12,7 @@ export function addTableHeight(state, prevData, newData) {
12
12
 
13
13
  /**
14
14
  * resets state properties relevant to virtualization
15
- * rowHeights when fixedHeight is false
15
+ * rowHeights
16
16
  *
17
17
  * @param {Object} state - datatable state
18
18
  */
@@ -43,7 +43,7 @@ export function resetRowHeights(state) {
43
43
 
44
44
  /**
45
45
  * updates state properties relevant to virtualization
46
- * rowHeights when fixedHeight is false
46
+ * rowHeights
47
47
  *
48
48
  * @param {Node} template - the custom element root `this.template` from datatable.js
49
49
  * @param {Object} state - datatable state
@@ -71,7 +71,7 @@ export function handleVariableRowHeights(template, state, renderedRows) {
71
71
  if (rowElement) {
72
72
  // first rendered row needs height increased by 1 to account for missing border
73
73
  let height = rowElement.getBoundingClientRect().height;
74
- if (row.rowIndex === currentRange.start) {
74
+ if (row.rowIndex && row.rowIndex === currentRange.start) {
75
75
  height++;
76
76
  }
77
77
  state.heightCache[row.key] = height;
@@ -102,10 +102,7 @@ export function handleVariableRowHeights(template, state, renderedRows) {
102
102
  * for a given scrollTop value
103
103
  */
104
104
  export function findFirstVisibleIndex(state, scrollTop) {
105
- const { offsetRanges, offsets, rowHeight, fixedHeight, virtualize } = state;
106
- if (virtualize && fixedHeight) {
107
- return Math.floor(scrollTop / rowHeight);
108
- }
105
+ const { offsetRanges, offsets, rowHeight } = state;
109
106
  let start = 0;
110
107
  let end = offsetRanges.length - 1;
111
108
 
@@ -133,7 +130,7 @@ export function findFirstVisibleIndex(state, scrollTop) {
133
130
  // use scrollTop and rowHeight to calculate firstVisibleIndex
134
131
  const diff = scrollTop - endOffset;
135
132
  const extraRows = Math.floor(diff / rowHeight);
136
- state._firstRowOffset = diff % rowHeight;
133
+ state.firstRowOffset = diff % rowHeight;
137
134
  return prevRange.end + extraRows;
138
135
  }
139
136
  // update start or end for next round of binary search
@@ -319,7 +316,7 @@ function checkOverlap(range1, range2) {
319
316
 
320
317
  /**
321
318
  * updates scrollTop and top values for rows when
322
- * using virtualization with fixedHeight of false
319
+ * using virtualization
323
320
  */
324
321
  function updateVirtualizeStyles(template, state, renderedRows) {
325
322
  // update scrollTop so firstVisibleIndex is correctly placed in viewport
@@ -328,12 +325,12 @@ function updateVirtualizeStyles(template, state, renderedRows) {
328
325
  state.offsets[state.firstVisibleIndex] + state.firstRowOffset;
329
326
 
330
327
  // update top of rendered rows based on offsets
331
- // all but first rendered row will need to subtract
332
- // 1 from offset to account for missing top border
333
- // on first rendered row
328
+ // if first rendered row isn't first row we need to
329
+ // add 1 to its offset to account for missing top border
330
+ const addOffset = !!renderedRows[0].rowIndex;
334
331
  renderedRows.forEach((row, index) => {
335
- let top = state.offsets[row.rowIndex] - 1;
336
- if (!index) {
332
+ let top = state.offsets[row.rowIndex];
333
+ if (addOffset && !index) {
337
334
  top = top + 1; // reset first rendered row to offset in state
338
335
  }
339
336
  row.style = `position:absolute;top:${top}px;`;
@@ -1,5 +1,6 @@
1
1
  import locale from '@salesforce/i18n/locale';
2
- import { LightningElement, api, track } from 'lwc';
2
+ import { api, track } from 'lwc';
3
+ import LightningShadowBaseClass from 'lightning/shadowBaseClassPrivate';
3
4
  import { normalizeBoolean } from 'lightning/utilsPrivate';
4
5
  import { addressFormat } from 'lightning/internationalizationLibrary';
5
6
 
@@ -10,7 +11,7 @@ const MAP_HOST = 'https://www.google.com/maps?q=';
10
11
  * The link is opened in a new tab.
11
12
  * A static map can be displayed with the address for better context.
12
13
  */
13
- export default class LightningFormattedAddress extends LightningElement {
14
+ export default class LightningFormattedAddress extends LightningShadowBaseClass {
14
15
  @track
15
16
  state = {
16
17
  street: '',
@@ -1,4 +1,5 @@
1
- import { LightningElement, api, track } from 'lwc';
1
+ import { api, track } from 'lwc';
2
+ import LightningShadowBaseClass from 'lightning/shadowBaseClassPrivate';
2
3
  import { dateTimeFormat } from 'lightning/internationalizationLibrary';
3
4
  import {
4
5
  normalizeBoolean,
@@ -9,7 +10,7 @@ import {
9
10
  /**
10
11
  * Displays formatted date and time.
11
12
  */
12
- export default class LightningFormattedDateTime extends LightningElement {
13
+ export default class LightningFormattedDateTime extends LightningShadowBaseClass {
13
14
  /**
14
15
  * The value to be formatted, which can be a Date object, timestamp, or an ISO8601 formatted string.
15
16
  * @type {object}
@@ -4,6 +4,6 @@
4
4
  <minApiVersion>0.0</minApiVersion>
5
5
  <support>GA</support>
6
6
  <capabilities>
7
- <capability>lightning__ServerRenderable</capability>
7
+ <capability>lightning__ServerRenderableWithHydration</capability>
8
8
  </capabilities>
9
9
  </LightningComponentBundle>
@@ -1,10 +1,11 @@
1
- import { LightningElement, api } from 'lwc';
1
+ import { api } from 'lwc';
2
+ import LightningShadowBaseClass from 'lightning/shadowBaseClassPrivate';
2
3
  import { toFormattedLocation } from 'lightning/utilsPrivate';
3
4
 
4
5
  /**
5
6
  * Displays a geolocation in decimal degrees using the format [latitude, longitude].
6
7
  */
7
- export default class LightningFormattedLocation extends LightningElement {
8
+ export default class LightningFormattedLocation extends LightningShadowBaseClass {
8
9
  /**
9
10
  * The latitude of the geolocation. Latitude values must be within -90 and 90.
10
11
  * @type {number}
@@ -1,10 +1,11 @@
1
- import { LightningElement, api } from 'lwc';
1
+ import { api } from 'lwc';
2
+ import LightningShadowBaseClass from 'lightning/shadowBaseClassPrivate';
2
3
  import { toNorthAmericanPhoneNumber } from 'lightning/utilsPrivate';
3
4
 
4
5
  /**
5
6
  * Displays a phone number as a hyperlink with the tel: URL scheme.
6
7
  */
7
- export default class LightningFormattedPhone extends LightningElement {
8
+ export default class LightningFormattedPhone extends LightningShadowBaseClass {
8
9
  /**
9
10
  * Sets the phone number to display.
10
11
  * @type {number}
@@ -1,10 +1,11 @@
1
- import { LightningElement, track, api } from 'lwc';
1
+ import { track, api } from 'lwc';
2
+ import LightningShadowBaseClass from 'lightning/shadowBaseClassPrivate';
2
3
  import { normalizeISOTime } from 'lightning/internationalizationLibrary';
3
4
 
4
5
  /**
5
6
  * Displays a formatted time in user's locale format.
6
7
  */
7
- export default class FormattedTime extends LightningElement {
8
+ export default class FormattedTime extends LightningShadowBaseClass {
8
9
  @track _formattedTimeValue = null;
9
10
  _inputValue = null;
10
11
 
@@ -1,11 +1,12 @@
1
- import { LightningElement, api, track } from 'lwc';
1
+ import { api, track } from 'lwc';
2
+ import LightningShadowBaseClass from 'lightning/shadowBaseClassPrivate';
2
3
  import { makeAbsoluteUrl } from 'lightning/utilsPrivate';
3
4
  import { updateRawLinkInfo } from 'lightning/routingService';
4
5
 
5
6
  /**
6
7
  * Displays a URL as a hyperlink.
7
8
  */
8
- export default class LightningFormattedUrl extends LightningElement {
9
+ export default class LightningFormattedUrl extends LightningShadowBaseClass {
9
10
  /**
10
11
  * Specifies where to open the link. Options include _blank, _parent, _self, and _top.
11
12
  * This value defaults to _self.
@@ -283,7 +283,7 @@ Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
283
283
 
284
284
  /* Text color */
285
285
  --sds-c-button-text-color: var(--slds-c-button-neutral-text-color, var(--slds-g-color-accent-2));
286
- --sds-c-button-text-color-hover: var(--slds-c-button-neutral-text-color-hover, var(--slds-g-color-accent-3));
286
+ --sds-c-button-text-color-hover: var(--slds-c-button-neutral-text-color-hover, var(--slds-s-button-color-hover, var(--slds-g-color-accent-3)));
287
287
  --sds-c-button-text-color-focus: var(--slds-c-button-neutral-text-color-focus, var(--slds-g-color-accent-3));
288
288
  --sds-c-button-text-color-active: var(
289
289
  --slds-c-button-neutral-text-color-active,
@@ -318,36 +318,36 @@ Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
318
318
  :host([data-render-mode="shadow"][variant='brand']) [part~='button'] {
319
319
  --slds-c-button-neutral-color-background: var(
320
320
  --slds-c-button-brand-color-background,
321
- var(--slds-g-color-accent-container-2)
321
+ var(--slds-g-color-accent-container-1)
322
322
  );
323
323
  --slds-c-button-neutral-color-background-hover: var(
324
324
  --slds-c-button-brand-color-background-hover,
325
- var(--slds-g-color-accent-container-3)
325
+ var(--slds-g-color-accent-container-2)
326
326
  );
327
327
  --slds-c-button-neutral-color-background-focus: var(
328
328
  --slds-c-button-brand-color-background-focus,
329
- var(--slds-g-color-accent-container-3)
329
+ var(--slds-g-color-accent-container-2)
330
330
  );
331
331
  --slds-c-button-neutral-color-background-active: var(
332
332
  --slds-c-button-brand-color-background-active,
333
- var(--slds-g-color-accent-container-3)
333
+ var(--slds-g-color-accent-container-2)
334
334
  );
335
335
 
336
336
  --slds-c-button-neutral-color-border: var(
337
337
  --slds-c-button-brand-color-border,
338
- var(--slds-g-color-border-accent-2)
338
+ var(--slds-g-color-border-accent-1)
339
339
  );
340
340
  --slds-c-button-neutral-color-border-hover: var(
341
341
  --slds-c-button-brand-color-border-hover,
342
- var(--slds-g-color-border-accent-3)
342
+ var(--slds-g-color-border-accent-2)
343
343
  );
344
344
  --slds-c-button-neutral-color-border-focus: var(
345
345
  --slds-c-button-brand-color-border-focus,
346
- var(--slds-g-color-border-accent-3)
346
+ var(--slds-g-color-border-accent-2)
347
347
  );
348
348
  --slds-c-button-neutral-color-border-active: var(
349
349
  --slds-c-button-brand-color-border-active,
350
- var(--slds-g-color-border-accent-3)
350
+ var(--slds-g-color-border-accent-2)
351
351
  );
352
352
 
353
353
  /* Since the text color is white for all states, bypassing inheritence and setting the color value from SDS */
@@ -399,7 +399,7 @@ Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
399
399
  --slds-c-button-neutral-color-border-hover: var(--slds-g-color-border-success-2);
400
400
  --slds-c-button-neutral-color-border-focus: var(--slds-g-color-border-success-2);
401
401
  --slds-c-button-neutral-color-border-active: var(--slds-g-color-border-success-2);
402
- --slds-c-button-neutral-text-color: var(--slds-g-color-on-success-2);
402
+ --slds-c-button-neutral-text-color: var(--slds-g-color-on-success-1);
403
403
  --slds-c-button-neutral-text-color-hover: var(--slds-g-color-on-success-1);
404
404
  --slds-c-button-neutral-text-color-focus: var(--slds-g-color-on-success-1);
405
405
  --slds-c-button-neutral-text-color-active: var(--slds-g-color-on-success-1);
@@ -3,4 +3,7 @@
3
3
  <isExposed>true</isExposed>
4
4
  <minApiVersion>0.0</minApiVersion>
5
5
  <support>GA</support>
6
+ <capabilities>
7
+ <capability>lightning__ServerRenderableWithHydration</capability>
8
+ </capabilities>
6
9
  </LightningComponentBundle>
@@ -149,6 +149,7 @@ To enable autocompletion of the address fields using an address lookup field, in
149
149
  ```html
150
150
  <template>
151
151
  <lightning-input-address
152
+ show-address-lookup
152
153
  address-label="Address"
153
154
  street-label="Street"
154
155
  city-label="City"
@@ -159,7 +160,6 @@ To enable autocompletion of the address fields using an address lookup field, in
159
160
  city="San Francisco"
160
161
  country="US"
161
162
  province="CA"
162
- show-address-lookup
163
163
  >
164
164
  </lightning-input-address>
165
165
  </template>
@@ -167,9 +167,50 @@ To enable autocompletion of the address fields using an address lookup field, in
167
167
 
168
168
  When you start typing an address in the lookup field, a dropdown menu displays matching addresses returned by the Google Maps Places API. Select an address from the dropdown to populate the address fields.
169
169
 
170
- Using `show-address-lookup` is not supported in Playground, Experience Builder sites, Lightning Out,
170
+ Using `show-address-lookup` is not supported in Experience Builder sites, Lightning Out,
171
171
  Lightning Components for Visualforce, and standalone apps. While it may work, these targets are not optimized and not officially supported.
172
172
 
173
+ #### Using Compact Address Fields
174
+
175
+ By default, the Street address field is a textarea field. Use compact address fields if you want to separate the Street address field into two input fields instead.
176
+
177
+ To display compact address fields, include the `show-compact-address` attribute. Use `street-label` to provide a label for the first line of address, and use `subpremise-label` for the second line of address. You can add supplementary information on this field, such as a building number or unit name.
178
+
179
+ ```html
180
+ <lightning-input-address
181
+ show-compact-address
182
+ address-label="Address"
183
+ street-label="Street Line 1"
184
+ subpremise-label="Street Line 2"
185
+ city-label="City"
186
+ country-label="Country"
187
+ province-label="Province"
188
+ postal-code-label="Postal Code"></lightning-input-address>
189
+ ```
190
+
191
+ #### Using the Compact Address Fields with Address Lookup
192
+
193
+ To enable compact address fields with address lookup, include the `show-address-lookup` and `show-compact-address` attributes. These attributes enable the first street address field as a lookup field.
194
+
195
+ To provide a label on the second input field, use the `subpremise-label` attribute. You can provide a subpremise value using the `subpremise` attribute. The first input field continues to use `street-label`.
196
+
197
+ ```html
198
+ <lightning-input-address
199
+ show-address-lookup
200
+ show-compact-address
201
+ address-label="Address"
202
+ street-label="Street Line 1"
203
+ subpremise-label="Street Line 2"
204
+ city-label="City"
205
+ country-label="Country"
206
+ province-label="Province"
207
+ postal-code-label="Postal Code"></lightning-input-address>
208
+ ```
209
+
210
+ When you start typing an address in the lookup field, a dropdown menu displays matching addresses returned by the Google Maps Places API. Select an address from the dropdown to populate the address fields.
211
+
212
+ The `subpremise` field doesn't require a value for submission. You can add supplementary information on this field, such as a building number or unit name.
213
+
173
214
  #### Validating Required Fields
174
215
 
175
216
  When you set `required`, a red asterisk is displayed on every address
@@ -279,7 +320,7 @@ See [Input: Styling Hooks Overview](https://www.lightningdesignsystem.com/compon
279
320
 
280
321
  #### Usage Considerations
281
322
 
282
- Using `show-address-lookup` is not supported in Playground, Experience Builder sites, Lightning Out,
323
+ Using `show-address-lookup` is not supported in Experience Builder sites, Lightning Out,
283
324
  Lightning Components for Visualforce, and standalone apps.
284
325
 
285
326
  When working with address fields such as with the `MailingAddress` field on Salesforce records, consider using the record form components. The `lightning-record-form`, `lightning-record-view-form`, and `lightning-record-edit-form` components provide a form-based UI that's metadata-driven. The components are automatically wired up to your record data, labels, and field-level help text. For more information, see [Work with Records Using Base Components](https://developer.salesforce.com/docs/platform/lwc/guide/data-get-user-input-intro).
@@ -60,7 +60,7 @@ export default class LightningInputAddress extends LightningShadowBaseClass {
60
60
 
61
61
  /**
62
62
  * The label for the subpremise field.
63
- * Visible only when using show-compact-address-lookup.
63
+ * Use this attribute with show-compact-address.
64
64
  * @type {string}
65
65
  */
66
66
  @api subpremiseLabel;
@@ -97,7 +97,7 @@ export default class LightningInputAddress extends LightningShadowBaseClass {
97
97
 
98
98
  /**
99
99
  * The placeholder for the subpremise field.
100
- * Visible only when using show-compact-address-lookup.
100
+ * Use this attribute with show-compact-address.
101
101
  * @type {string}
102
102
  */
103
103
  @api subpremisePlaceholder;
@@ -211,7 +211,7 @@ export default class LightningInputAddress extends LightningShadowBaseClass {
211
211
  /**
212
212
  * The value for the street field.
213
213
  * Maximum length is 255 characters when rendered as a textarea.
214
- * Maximum length is 80 characters when rendered as an input (when using show-compact-address-lookup).
214
+ * Maximum length is 80 characters when rendered as an input using show-compact-address.
215
215
  * @type {string}
216
216
  *
217
217
  */
@@ -226,6 +226,7 @@ export default class LightningInputAddress extends LightningShadowBaseClass {
226
226
  /**
227
227
  * The value for the subpremise field.
228
228
  * Maximum length is 80 characters.
229
+ * Use this attribute with show-compact-address.
229
230
  * @type {string}
230
231
  */
231
232
  @api
@@ -306,7 +307,8 @@ export default class LightningInputAddress extends LightningShadowBaseClass {
306
307
  }
307
308
 
308
309
  /**
309
- * If present, address lookup using Google Maps is enabled.
310
+ * If present, an address lookup field using Google Maps is displayed.
311
+ * When used with show-compact-address, the first street field functions as the address lookup field.
310
312
  * @type {boolean}
311
313
  * @default false
312
314
  */
@@ -320,8 +322,8 @@ export default class LightningInputAddress extends LightningShadowBaseClass {
320
322
 
321
323
  /**
322
324
  * If present, the street field is rendered as two separate inputs instead of a single textarea.
323
- * In addition, the search field is no longer rendered as a separate input and its functionality
324
- * is moved to the street field.
325
+ * To provide a label for the first street field, use street-label.
326
+ * To provide a label for the second street field, use subpremise-label.
325
327
  * @type {boolean}
326
328
  * @default false
327
329
  */