lightning-base-components 1.18.2-alpha → 1.18.3-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/metadata/raptor.json +4 -0
  2. package/package.json +15 -1
  3. package/scopedImports/@salesforce-internal-core.appVersion.js +1 -1
  4. package/src/lightning/accordion/__docs__/accordion.md +2 -2
  5. package/src/lightning/avatar/__docs__/avatar.md +7 -7
  6. package/src/lightning/badge/__docs__/badge.md +2 -2
  7. package/src/lightning/baseCombobox/baseCombobox.js +62 -22
  8. package/src/lightning/breadcrumbs/__docs__/breadcrumbs.md +3 -3
  9. package/src/lightning/button/__docs__/button.md +15 -15
  10. package/src/lightning/buttonIcon/__docs__/buttonIcon.md +9 -9
  11. package/src/lightning/buttonIconStateful/__docs__/buttonIconStateful.md +9 -9
  12. package/src/lightning/buttonMenu/__docs__/buttonMenu.md +8 -8
  13. package/src/lightning/buttonStateful/__docs__/buttonStateful.md +12 -12
  14. package/src/lightning/calendar/calendar.css +2 -2
  15. package/src/lightning/calendar/calendar.js +4 -2
  16. package/src/lightning/card/__docs__/card.md +3 -3
  17. package/src/lightning/checkboxGroup/__docs__/checkboxGroup.md +2 -2
  18. package/src/lightning/datatable/__docs__/datatable.md +45 -35
  19. package/src/lightning/datatable/autoWidthStrategy.js +3 -0
  20. package/src/lightning/datatable/columnWidthManager.js +1 -1
  21. package/src/lightning/datatable/datatable.js +8 -7
  22. package/src/lightning/datatable/rowSelection.js +7 -4
  23. package/src/lightning/datatable/templates/table/table.html +1 -0
  24. package/src/lightning/datepicker/datepicker.css +2 -2
  25. package/src/lightning/datepicker/datepicker.js +4 -2
  26. package/src/lightning/datetimepicker/datetimepicker.css +2 -2
  27. package/src/lightning/datetimepicker/datetimepicker.js +4 -2
  28. package/src/lightning/dualListbox/dualListbox.js +16 -7
  29. package/src/lightning/formattedRichText/formatted-rich-text.slds.css +230 -0
  30. package/src/lightning/formattedRichText/formattedRichText.css +2 -0
  31. package/src/lightning/formattedRichText/formattedRichText.js +4 -2
  32. package/src/lightning/formattedText/formattedText.css +1 -0
  33. package/src/lightning/formattedText/formattedText.js +3 -2
  34. package/src/lightning/helptext/__docs__/helptext.md +2 -2
  35. package/src/lightning/icon/__docs__/icon.md +5 -5
  36. package/src/lightning/icon/icon.js +6 -1
  37. package/src/lightning/iconUtils/iconUtils.js +0 -12
  38. package/src/lightning/iconUtils/polyfill.js +5 -90
  39. package/src/lightning/input/__docs__/input.md +7 -7
  40. package/src/lightning/input/__examples__/checkboxbutton/checkboxbutton.css +6 -0
  41. package/src/lightning/input/__examples__/checkboxbutton/checkboxbutton.html +2 -1
  42. package/src/lightning/input/__examples__/checkboxbutton/checkboxbutton.js +1 -1
  43. package/src/lightning/input/__examples__/number/number.html +0 -5
  44. package/src/lightning/input/input.css +2 -4
  45. package/src/lightning/input/input.html +149 -239
  46. package/src/lightning/input/input.js +209 -532
  47. package/src/lightning/inputAddress/__docs__/inputAddress.md +3 -3
  48. package/src/lightning/inputUtils/inputUtils.js +15 -20
  49. package/src/lightning/inputUtils/normalize.js +7 -0
  50. package/src/lightning/{input/numberUtil.js → inputUtils/number.js} +1 -1
  51. package/src/lightning/inputUtils/utils.js +18 -0
  52. package/src/lightning/modalBody/__docs__/modalBody.md +9 -9
  53. package/src/lightning/modalFooter/__docs__/modalFooter.md +9 -9
  54. package/src/lightning/modalHeader/__docs__/modalHeader.md +9 -9
  55. package/src/lightning/overlayContainer/overlayContainer.js +4 -2
  56. package/src/lightning/pill/__docs__/pill.md +3 -3
  57. package/src/lightning/pillContainer/__docs__/pillContainer.md +14 -14
  58. package/src/lightning/primitiveIcon/primitiveIcon.js +8 -5
  59. package/src/lightning/radioGroup/__docs__/radioGroup.md +4 -4
  60. package/src/lightning/select/__docs__/select.md +2 -2
  61. package/src/lightning/shadowBaseClassPrivate/shadowBaseClassPrivate.js +1 -1
  62. package/src/lightning/sldsCommon/sldsCommon.css +144 -42
  63. package/src/lightning/sldsUtilsAlignment/sldsUtilsAlignment.css +10 -0
  64. package/src/lightning/sldsUtilsAlignment/sldsUtilsAlignment.js-meta.xml +4 -0
  65. package/src/lightning/sldsUtilsBorders/sldsUtilsBorders.css +18 -0
  66. package/src/lightning/sldsUtilsBorders/sldsUtilsBorders.js-meta.xml +4 -0
  67. package/src/lightning/sldsUtilsBox/sldsUtilsBox.css +24 -0
  68. package/src/lightning/sldsUtilsBox/sldsUtilsBox.js-meta.xml +4 -0
  69. package/src/lightning/sldsUtilsFloats/sldsUtilsFloats.css +20 -0
  70. package/src/lightning/sldsUtilsFloats/sldsUtilsFloats.js-meta.xml +4 -0
  71. package/src/lightning/sldsUtilsGrid/sldsUtilsGrid.css +259 -0
  72. package/src/lightning/sldsUtilsGrid/sldsUtilsGrid.js-meta.xml +4 -0
  73. package/src/lightning/sldsUtilsHyphenation/sldsUtilsHyphenation.css +8 -0
  74. package/src/lightning/sldsUtilsHyphenation/sldsUtilsHyphenation.js-meta.xml +4 -0
  75. package/src/lightning/sldsUtilsLineClamp/sldsUtilsLineClamp.css +57 -0
  76. package/src/lightning/sldsUtilsLineClamp/sldsUtilsLineClamp.js-meta.xml +4 -0
  77. package/src/lightning/sldsUtilsMargin/sldsUtilsMargin.css +313 -0
  78. package/src/lightning/sldsUtilsMargin/sldsUtilsMargin.js-meta.xml +4 -0
  79. package/src/lightning/sldsUtilsPadding/sldsUtilsPadding.css +308 -0
  80. package/src/lightning/sldsUtilsPadding/sldsUtilsPadding.js-meta.xml +4 -0
  81. package/src/lightning/sldsUtilsPosition/sldsUtilsPosition.css +18 -0
  82. package/src/lightning/sldsUtilsPosition/sldsUtilsPosition.js-meta.xml +4 -0
  83. package/src/lightning/sldsUtilsSizing/sldsUtilsSizing.css +1408 -0
  84. package/src/lightning/sldsUtilsSizing/sldsUtilsSizing.js-meta.xml +4 -0
  85. package/src/lightning/sldsUtilsThemes/sldsUtilsThemes.css +295 -0
  86. package/src/lightning/sldsUtilsThemes/sldsUtilsThemes.js-meta.xml +4 -0
  87. package/src/lightning/sldsUtilsTruncation/sldsUtilsTruncation.css +14 -0
  88. package/src/lightning/sldsUtilsTruncation/sldsUtilsTruncation.js-meta.xml +4 -0
  89. package/src/lightning/slider/__docs__/slider.md +2 -2
  90. package/src/lightning/tabset/__docs__/tabset.md +2 -2
  91. package/src/lightning/textarea/__docs__/textarea.md +2 -2
  92. package/src/lightning/timepicker/timepicker.js +4 -2
  93. package/src/lightning/toast/toast.js-meta.xml +2 -0
  94. package/src/lightning/toastContainer/__docs__/toastContainer.md +14 -34
  95. package/src/lightning/toastContainer/toastContainer.js +10 -15
  96. package/src/lightning/tooltipLibrary/tooltipLibrary.js +12 -5
  97. package/src/lightning/iconUtils/isIframeInEdge.js +0 -7
  98. package/src/lightning/iconUtils/supportsSvg.js +0 -16
  99. package/src/lightning/input/input-checkbox.slds.css +0 -395
  100. package/src/lightning/input/input-text.slds.css +0 -398
  101. package/src/lightning/input/normalize.js +0 -6
  102. package/src/lightning/input/selection.js +0 -131
  103. /package/src/lightning/formattedRichText/{__examples__disabled → __examples__}/basic/basic.html +0 -0
  104. /package/src/lightning/formattedRichText/{__examples__disabled → __examples__}/basic/basic.js +0 -0
  105. /package/src/lightning/{input/emailUtil.js → inputUtils/email.js} +0 -0
@@ -1,6 +1,4 @@
1
1
  import labelA11yTriggerText from '@salesforce/label/LightningColorPicker.a11yTriggerText';
2
- import labelInputFileBodyText from '@salesforce/label/LightningInputFile.bodyText';
3
- import labelInputFileButtonLabel from '@salesforce/label/LightningInputFile.buttonLabel';
4
2
  import labelMessageToggleActive from '@salesforce/label/LightningControl.activeCapitalized';
5
3
  import labelMessageToggleInactive from '@salesforce/label/LightningControl.inactiveCapitalized';
6
4
  import labelRequired from '@salesforce/label/LightningControl.required';
@@ -13,20 +11,17 @@ import labelHelpTextAlternativeText from '@salesforce/label/LightningInput.helpt
13
11
  import userTimeZone from '@salesforce/i18n/timeZone';
14
12
  import formFactor from '@salesforce/client/formFactor';
15
13
 
16
- import { LightningElement, api, track } from 'lwc';
14
+ import { api, track } from 'lwc';
15
+ import LightningShadowBaseClass from 'lightning/shadowBaseClassPrivate';
17
16
  import { classSet, formatLabel } from 'lightning/utils';
18
17
  import {
19
18
  assert,
20
19
  classListMutation,
21
- getRealDOMId,
22
20
  reflectAttribute,
23
- isSafari,
24
21
  isNativeComponent,
25
- isNotUndefinedOrNull,
26
22
  isUndefinedOrNull,
27
23
  normalizeAriaAttribute,
28
24
  normalizeBoolean,
29
- normalizeKeyValue,
30
25
  normalizeString,
31
26
  synchronizeAttrs,
32
27
  decorateInputForDragon,
@@ -34,7 +29,6 @@ import {
34
29
  computeAriaInvalid,
35
30
  } from 'lightning/utilsPrivate';
36
31
  import AriaObserver from 'lightning/ariaObserver';
37
- import { normalizeInput } from './normalize';
38
32
  import {
39
33
  normalizeDate,
40
34
  normalizeDateTimeToUTC,
@@ -47,26 +41,14 @@ import {
47
41
  InteractingState,
48
42
  normalizeVariant,
49
43
  VARIANT,
50
- } from 'lightning/inputUtils';
51
- import {
52
- calculateFractionDigitsFromStep,
53
- formatNumber,
54
- fromIsoDecimal,
55
- hasValidNumberShortcut,
56
- hasValidNumberSymbol,
57
- increaseNumberByStep,
44
+ normalizeInput,
58
45
  isValidNumber,
59
- isValidNumberCharacter,
60
- stringifyNumber,
61
- toIsoDecimal,
62
- } from './numberUtil';
63
- import { isValidEmail, isValidMultipleEmails } from './emailUtil';
64
- import { InputSelectionCache } from './selection';
46
+ isValidEmail,
47
+ isValidMultipleEmails,
48
+ } from 'lightning/inputUtils';
65
49
 
66
50
  const i18n = {
67
51
  a11yTriggerText: labelA11yTriggerText,
68
- inputFileBodyText: labelInputFileBodyText,
69
- inputFileButtonLabel: labelInputFileButtonLabel,
70
52
  messageToggleActive: labelMessageToggleActive,
71
53
  messageToggleInactive: labelMessageToggleInactive,
72
54
  numberIncrementCounter: labelNumberIncrementCounter,
@@ -106,13 +88,12 @@ const VALID_NUMBER_FORMATTERS = [
106
88
  'percent-fixed',
107
89
  'currency',
108
90
  ];
109
- const DEFAULT_COLOR = '#000000';
110
91
  const DEFAULT_FORMATTER = VALID_NUMBER_FORMATTERS[0];
111
92
 
112
93
  /**
113
94
  * Represents interactive controls that accept user input depending on the type attribute.
114
95
  */
115
- export default class LightningInput extends LightningElement {
96
+ export default class LightningInput extends LightningShadowBaseClass {
116
97
  static delegatesFocus = true;
117
98
 
118
99
  /**
@@ -301,12 +282,12 @@ export default class LightningInput extends LightningElement {
301
282
  @track _ariaInvalid;
302
283
  @track _autocomplete;
303
284
 
285
+ _shouldShowHelpMessage = true;
286
+ _helpMessageChanged = false;
304
287
  _formatter = DEFAULT_FORMATTER;
305
288
  _showRawNumber = false;
306
289
  _initialValueSet = false;
307
- _files = null;
308
290
  _rendered;
309
- _selectionCache;
310
291
 
311
292
  constructor() {
312
293
  super();
@@ -314,15 +295,11 @@ export default class LightningInput extends LightningElement {
314
295
 
315
296
  // Native Shadow Root will return [native code].
316
297
  // Our synthetic method will return the function source.
317
- this.isNative = isNativeComponent(this);
318
-
319
- // The selection cache allows us an input to remember what text was selected
320
- // in cases where we change the text on blur or in browsers (Safari) that
321
- // don't track it properly.
322
- this._selectionCache = new InputSelectionCache();
298
+ this._isNativeShadow = isNativeComponent(this);
323
299
  }
324
300
 
325
301
  connectedCallback() {
302
+ super.connectedCallback();
326
303
  if (!this.ariaObserver) {
327
304
  this.ariaObserver = new AriaObserver(this);
328
305
  }
@@ -334,15 +311,11 @@ export default class LightningInput extends LightningElement {
334
311
 
335
312
  this.classList.add('slds-form-element');
336
313
 
337
- this._updateClassList();
338
- this._validateRequiredAttributes();
314
+ this.updateClassListForVariant();
315
+ this.validateRequiredAttributes();
339
316
 
340
317
  this.interactingState = new InteractingState();
341
318
  this.interactingState.onleave(() => this.reportValidity());
342
-
343
- if (this.isTypeNumber) {
344
- this._updateNumberValue(this._value);
345
- }
346
319
  }
347
320
 
348
321
  disconnectedCallback() {
@@ -356,18 +329,15 @@ export default class LightningInput extends LightningElement {
356
329
  }
357
330
 
358
331
  renderedCallback() {
359
- // For W-7962838: In Safari, focus doesn't scroll input into view.
360
- // Attach the event listener used to cache the selected text when selection changes.
361
- if (isSafari) {
362
- this._inputElement.addEventListener(
363
- 'select',
364
- this.handleSelect.bind(this)
365
- );
366
- }
367
-
368
332
  if (this.isConnected) {
369
333
  this.ariaObserver.sync(this.isNativeShadow);
370
334
 
335
+ // If the help message changed, the help message element needs to be (un)related
336
+ if (this._helpMessageChanged) {
337
+ this.connectAriaDescribedBy();
338
+ this._helpMessageChanged = false;
339
+ }
340
+
371
341
  if (!this._rendered) {
372
342
  this.connectAriaDescribedBy();
373
343
  this.connectAriaLabelledBy();
@@ -378,10 +348,6 @@ export default class LightningInput extends LightningElement {
378
348
  if (!this._initialValueSet && this._inputElement) {
379
349
  this._rendered = true;
380
350
 
381
- if (this.isTypeNumber) {
382
- this._numberRawValue = fromIsoDecimal(this._value);
383
- }
384
-
385
351
  this._setInputValue(this._displayedValue);
386
352
  if (this.isTypeCheckable) {
387
353
  this._inputElement.checked = this._checked;
@@ -397,17 +363,7 @@ export default class LightningInput extends LightningElement {
397
363
  * @type {number}
398
364
  *
399
365
  */
400
- @api
401
- get formatFractionDigits() {
402
- return this._formatFractionDigits;
403
- }
404
-
405
- set formatFractionDigits(value) {
406
- this._formatFractionDigits = value;
407
- if (this._rendered && this.isTypeNumber) {
408
- this._setInputValue(this._displayedValue);
409
- }
410
- }
366
+ @api formatFractionDigits;
411
367
 
412
368
  /**
413
369
  * A space-separated list of element IDs whose presence or content is controlled by the
@@ -651,15 +607,22 @@ export default class LightningInput extends LightningElement {
651
607
  */
652
608
  @api
653
609
  get formatter() {
610
+ // Formatters are applicable to the number type
611
+ // If the primitive exists, retrieve value from primitive-input-simple
612
+ if (this.isTypeNumber && this._primitiveComponent) {
613
+ return this._primitiveComponent.formatter;
614
+ }
654
615
  return this._formatter;
655
616
  }
656
617
 
657
618
  set formatter(value) {
658
- this._formatter = normalizeString(value, {
659
- fallbackValue: DEFAULT_FORMATTER,
660
- validValues: VALID_NUMBER_FORMATTERS,
661
- });
662
- this._updateInputDisplayValueIfTypeNumber();
619
+ this._formatter = value;
620
+
621
+ // If the primitive exists, retrieve value from primitive-input-simple
622
+ // The primitive will normalize the value
623
+ if (this.isTypeNumber && this._primitiveComponent) {
624
+ this._primitiveComponent.formatter = this._formatter;
625
+ }
663
626
  }
664
627
 
665
628
  /**
@@ -843,7 +806,6 @@ export default class LightningInput extends LightningElement {
843
806
  }
844
807
 
845
808
  this._updateProxyInputAttributes('step');
846
- this._updateInputDisplayValueIfTypeNumber();
847
809
  }
848
810
 
849
811
  /**
@@ -865,7 +827,11 @@ export default class LightningInput extends LightningElement {
865
827
  this._checked = normalizeBoolean(value);
866
828
 
867
829
  if (this._rendered) {
868
- this._inputElement.checked = this._checked;
830
+ if (this.isTypeCheckbox) {
831
+ this._primitiveComponent.checked = this._checked;
832
+ } else {
833
+ this._inputElement.checked = this._checked;
834
+ }
869
835
  }
870
836
 
871
837
  // Update proxy input should be set after _inputElement is updated.
@@ -896,29 +862,29 @@ export default class LightningInput extends LightningElement {
896
862
  */
897
863
  @api
898
864
  get value() {
865
+ if (this.isTypeSimple) {
866
+ const subcomponent = this._primitiveComponent;
867
+ if (subcomponent) {
868
+ return subcomponent.value;
869
+ }
870
+ }
899
871
  return this._value;
900
872
  }
901
873
 
902
874
  set value(value) {
903
- const previousValue = this._value;
904
-
905
- this._value = normalizeInput(value);
906
-
907
- if (this._rendered && this.isTypeNumber) {
908
- this._value = stringifyNumber(value);
909
- // the extra check for whether the value has changed is done for cases
910
- // when the same value is set back in a change handler, this is to avoid
911
- // the raw number from changing formatting under the user
912
- // (eg. if the user typed 1,000 we want to preserve that formatting as the user
913
- // types the value)
914
- if (this.validity.badInput || this._value !== previousValue) {
915
- this._updateNumberValue(value);
916
- }
917
- }
918
-
919
- this._updateProxyInputAttributes('value');
920
875
  // Setting value of a type='file' isn't allowed
921
876
  if (!this.isTypeFile) {
877
+ this._value = normalizeInput(value);
878
+
879
+ if (this.isTypeSimple) {
880
+ const subcomponent = this._primitiveComponent;
881
+ if (subcomponent) {
882
+ subcomponent.value = this._value;
883
+ }
884
+ }
885
+
886
+ this._updateProxyInputAttributes('value');
887
+
922
888
  // Again, due to the interop layer we need to check whether the value being set
923
889
  // is different, otherwise we're duplicating the sets on the input, which result
924
890
  // in different bugs like Japanese IME duplication of characters in Safari (likely a browser bug) or
@@ -949,7 +915,7 @@ export default class LightningInput extends LightningElement {
949
915
 
950
916
  set variant(value) {
951
917
  this._variant = normalizeVariant(value);
952
- this._updateClassList();
918
+ this.updateClassListForVariant();
953
919
  reflectAttribute(this, 'variant', this._variant);
954
920
  }
955
921
 
@@ -1053,7 +1019,7 @@ export default class LightningInput extends LightningElement {
1053
1019
  @api
1054
1020
  get files() {
1055
1021
  if (this.isTypeFile) {
1056
- return this._files;
1022
+ return this._primitiveComponent.files;
1057
1023
  }
1058
1024
  return null;
1059
1025
  }
@@ -1068,6 +1034,14 @@ export default class LightningInput extends LightningElement {
1068
1034
  return this._constraint.validity;
1069
1035
  }
1070
1036
 
1037
+ /**
1038
+ * Not moving selectionStart and selectionEnd to the inner component. Looks like
1039
+ * one of the expected error/fail cases is that the component throws an error in the console,
1040
+ * if the user attempts to set it on a non-supported type (like range, file, checkbox).
1041
+ * That can only happen from `lightning-input`. To avoid duplicating code, it's best to keep
1042
+ * this here.
1043
+ */
1044
+
1071
1045
  /**
1072
1046
  * Specifies the index of the first character to select in the input element.
1073
1047
  * This attribute is supported only for text type.
@@ -1142,9 +1116,13 @@ export default class LightningInput extends LightningElement {
1142
1116
  }
1143
1117
  if (this._rendered && !this.isNativeInput) {
1144
1118
  this._inputElement.showHelpMessage(message);
1145
- } else {
1146
- this._helpMessage = message;
1119
+ return;
1120
+ }
1121
+ if (this._rendered && this.isTypePrimitiveInput) {
1122
+ this._shouldShowHelpMessage = false;
1123
+ this._helpMessageChanged = true;
1147
1124
  }
1125
+ this._helpMessage = message;
1148
1126
  });
1149
1127
  }
1150
1128
 
@@ -1177,195 +1155,47 @@ export default class LightningInput extends LightningElement {
1177
1155
  }
1178
1156
  }
1179
1157
 
1180
- get isNativeInput() {
1181
- return !(
1182
- this.isTypeDesktopDate ||
1183
- this.isTypeDesktopDateTime ||
1184
- this.isTypeDesktopTime
1185
- );
1186
- }
1187
-
1188
- get computedAriaLabel() {
1189
- const ariaValues = [];
1190
-
1191
- // merge all date & time arias on mobile since it's displayed as a single field
1192
- if (this.isTypeMobileDateTime) {
1193
- ariaValues.push(this.dateAriaLabel);
1194
- ariaValues.push(this.timeAriaLabel);
1195
- }
1196
- if (this.ariaLabel) {
1197
- ariaValues.push(this.ariaLabel);
1198
- }
1199
-
1200
- return normalizeAriaAttribute(ariaValues);
1201
- }
1202
-
1203
- get computedAriaLabelledBy() {
1204
- const ariaValues = [];
1205
-
1206
- if (this.isTypeFile) {
1207
- ariaValues.push(this.computedUniqueFileElementLabelledById);
1208
- }
1209
- // merge all date & time arias on mobile since it's displayed as a single field
1210
- if (this.isTypeMobileDateTime) {
1211
- ariaValues.push(this.dateAriaLabelledBy);
1212
- ariaValues.push(this.timeAriaLabelledBy);
1213
- }
1214
- if (this.ariaLabelledBy) {
1215
- ariaValues.push(this.ariaLabelledBy);
1158
+ get primitiveSelector() {
1159
+ if (this.isTypeSimple) {
1160
+ return 'lightning-primitive-input-simple';
1216
1161
  }
1217
-
1218
- return normalizeAriaAttribute(ariaValues);
1219
- }
1220
-
1221
- get computedAriaDescribedBy() {
1222
- const ariaValues = [];
1223
-
1224
- if (this._helpMessage) {
1225
- ariaValues.push(this.computedUniqueHelpElementId);
1162
+ if (this.isTypeCheckboxButton) {
1163
+ return 'lightning-primitive-input-checkbox-button';
1226
1164
  }
1227
- // The toggle type is described by a secondary element
1228
1165
  if (this.isTypeToggle) {
1229
- ariaValues.push(this.computedUniqueToggleElementDescribedById);
1230
- }
1231
- // merge all date & time arias on mobile since it's displayed as a single field
1232
- if (this.isTypeMobileDateTime) {
1233
- ariaValues.push(this.dateAriaDescribedBy);
1234
- ariaValues.push(this.timeAriaDescribedBy);
1166
+ return 'lightning-primitive-input-toggle';
1235
1167
  }
1236
- if (this.ariaDescribedBy) {
1237
- ariaValues.push(this.ariaDescribedBy);
1238
- }
1239
-
1240
- return normalizeAriaAttribute(ariaValues);
1241
- }
1242
-
1243
- get computedAriaInvalid() {
1244
- // W-8796658: aria-invalid should always follow the visual indication of errors
1245
- return computeAriaInvalid(
1246
- this._helpMessage,
1247
- this.value,
1248
- this.ariaInvalid
1249
- );
1250
- }
1251
-
1252
- get isLabelHidden() {
1253
- return this.variant === VARIANT.LABEL_HIDDEN;
1254
- }
1255
-
1256
- get isLabelStacked() {
1257
- return this.variant === VARIANT.LABEL_STACKED;
1258
- }
1259
-
1260
- get accesskey() {
1261
- return this._accesskey;
1262
- }
1263
-
1264
- get colorInputElementValue() {
1265
- return this.validity.valid && this.value ? this.value : DEFAULT_COLOR;
1266
- }
1267
-
1268
- get colorInputStyle() {
1269
- return `background: ${this.value || '#5679C0'};`;
1270
- }
1271
-
1272
- get computedUniqueHelpElementId() {
1273
- return getRealDOMId(this.template.querySelector('[data-help-message]'));
1274
- }
1275
-
1276
- get computedUniqueToggleElementDescribedById() {
1277
- if (this.isTypeToggle) {
1278
- const toggle = this.template.querySelector(
1279
- '[data-toggle-description]'
1280
- );
1281
- return getRealDOMId(toggle);
1168
+ if (this.isTypeColor) {
1169
+ return 'lightning-primitive-input-color';
1282
1170
  }
1283
- return null;
1284
- }
1285
-
1286
- get computedUniqueFormLabelId() {
1287
- if (this.isTypeFile) {
1288
- const formLabel = this.template.querySelector('[data-form-label]');
1289
- return getRealDOMId(formLabel);
1171
+ if (this.isTypeCheckbox) {
1172
+ return 'lightning-primitive-input-checkbox';
1290
1173
  }
1291
- return null;
1292
- }
1293
-
1294
- get computedUniqueFileSelectorLabelId() {
1295
- if (this.isTypeFile) {
1296
- const fileBodyLabel = this.template.querySelector(
1297
- '[data-file-selector-label]'
1298
- );
1299
- return getRealDOMId(fileBodyLabel);
1174
+ if (this.isTypeRadio) {
1175
+ return 'lightning-primitive-input-radio';
1300
1176
  }
1301
- return null;
1302
- }
1303
-
1304
- get computedUniqueFileElementLabelledById() {
1305
1177
  if (this.isTypeFile) {
1306
- const labelIds = [
1307
- this.computedUniqueFormLabelId,
1308
- this.computedUniqueFileSelectorLabelId,
1309
- ];
1310
- return labelIds.join(' ');
1178
+ return 'lightning-primitive-input-file';
1311
1179
  }
1312
1180
  return null;
1313
1181
  }
1314
1182
 
1315
- get computedFormElementClass() {
1316
- const classes = classSet('slds-form-element__control slds-grow');
1317
-
1318
- if (this.isTypeSearch) {
1319
- classes.add('slds-input-has-icon slds-input-has-icon_left-right');
1320
- }
1321
-
1322
- return classes.toString();
1323
- }
1324
-
1325
- get i18n() {
1326
- return i18n;
1183
+ get shouldShowHelpMessage() {
1184
+ return this._shouldShowHelpMessage && this._helpMessage;
1327
1185
  }
1328
1186
 
1329
- get computedLabelClass() {
1330
- const classnames = classSet('slds-form-element__label');
1331
- if (this.isTypeCheckable || this.isTypeFile) {
1332
- // do nothing
1333
- } else if (this.isTypeToggle) {
1334
- classnames.add('slds-m-bottom_none');
1335
- } else {
1336
- classnames.add('slds-no-flex');
1337
- }
1338
- return classnames
1339
- .add({ 'slds-assistive-text': this.isLabelHidden })
1340
- .toString();
1341
- }
1187
+ /************************* INPUT TYPE GETTERS *************************/
1342
1188
 
1343
- get computedNumberClass() {
1344
- return classSet('slds-input')
1345
- .add({ 'slds-is-disabled': this.disabled })
1346
- .toString();
1347
- }
1348
-
1349
- get computedColorLabelClass() {
1350
- return classSet(
1351
- 'slds-form-element__label slds-color-picker__summary-label'
1352
- )
1353
- .add({ 'slds-assistive-text': this.isLabelHidden })
1354
- .toString();
1355
- }
1356
-
1357
- get computedCheckboxClass() {
1358
- return classSet('slds-checkbox')
1359
- .add({ 'slds-checkbox_standalone': !this.isStandardVariant })
1360
- .toString();
1361
- }
1362
-
1363
- get normalizedMax() {
1364
- return this._normalizeDateTimeString(this.max);
1365
- }
1366
-
1367
- get normalizedMin() {
1368
- return this._normalizeDateTimeString(this.min);
1189
+ get isTypePrimitiveInput() {
1190
+ return (
1191
+ this.isTypeSimple ||
1192
+ this.isTypeCheckboxButton ||
1193
+ this.isTypeCheckbox ||
1194
+ this.isTypeToggle ||
1195
+ this.isTypeColor ||
1196
+ this.isTypeRadio ||
1197
+ this.isTypeFile
1198
+ );
1369
1199
  }
1370
1200
 
1371
1201
  get isTypeNumber() {
@@ -1394,10 +1224,6 @@ export default class LightningInput extends LightningElement {
1394
1224
  );
1395
1225
  }
1396
1226
 
1397
- get isTypeSearch() {
1398
- return this.type === 'search';
1399
- }
1400
-
1401
1227
  get isTypeToggle() {
1402
1228
  return this.type === 'toggle';
1403
1229
  }
@@ -1476,6 +1302,85 @@ export default class LightningInput extends LightningElement {
1476
1302
  );
1477
1303
  }
1478
1304
 
1305
+ get isNativeInput() {
1306
+ return !(
1307
+ this.isTypeDesktopDate ||
1308
+ this.isTypeDesktopDateTime ||
1309
+ this.isTypeDesktopTime
1310
+ );
1311
+ }
1312
+
1313
+ get _primitiveComponent() {
1314
+ return this.template.querySelector(this.primitiveSelector);
1315
+ }
1316
+ /************************* GETTERS *************************/
1317
+
1318
+ /*** Accessibility ***/
1319
+
1320
+ get computedAriaLabel() {
1321
+ const ariaValues = [];
1322
+
1323
+ // merge all date & time arias on mobile since it's displayed as a single field
1324
+ if (this.isTypeMobileDateTime) {
1325
+ ariaValues.push(this.dateAriaLabel);
1326
+ ariaValues.push(this.timeAriaLabel);
1327
+ }
1328
+ if (this.ariaLabel) {
1329
+ ariaValues.push(this.ariaLabel);
1330
+ }
1331
+
1332
+ return normalizeAriaAttribute(ariaValues);
1333
+ }
1334
+
1335
+ get computedAriaInvalid() {
1336
+ // W-8796658: aria-invalid should always follow the visual indication of errors
1337
+ return computeAriaInvalid(
1338
+ this._helpMessage,
1339
+ this.value,
1340
+ this.ariaInvalid
1341
+ );
1342
+ }
1343
+
1344
+ /****** ******/
1345
+
1346
+ get isLabelHidden() {
1347
+ return this.variant === VARIANT.LABEL_HIDDEN;
1348
+ }
1349
+
1350
+ get isLabelStacked() {
1351
+ return this.variant === VARIANT.LABEL_STACKED;
1352
+ }
1353
+
1354
+ get accesskey() {
1355
+ return this._accesskey;
1356
+ }
1357
+
1358
+ get i18n() {
1359
+ return i18n;
1360
+ }
1361
+
1362
+ get computedLabelClass() {
1363
+ const classnames = classSet('slds-form-element__label');
1364
+ if (this.isTypeCheckable || this.isTypeFile) {
1365
+ // do nothing
1366
+ } else if (this.isTypeToggle) {
1367
+ classnames.add('slds-m-bottom_none');
1368
+ } else {
1369
+ classnames.add('slds-no-flex');
1370
+ }
1371
+ return classnames
1372
+ .add({ 'slds-assistive-text': this.isLabelHidden })
1373
+ .toString();
1374
+ }
1375
+
1376
+ get normalizedMax() {
1377
+ return this._normalizeDateTimeString(this.max);
1378
+ }
1379
+
1380
+ get normalizedMin() {
1381
+ return this._normalizeDateTimeString(this.min);
1382
+ }
1383
+
1479
1384
  get _inputElement() {
1480
1385
  if (!this._cachedInputElement || this._inputElementRefreshNeeded) {
1481
1386
  this._inputDragonDecorated = false;
@@ -1492,6 +1397,8 @@ export default class LightningInput extends LightningElement {
1492
1397
  inputElement = this.template.querySelector(
1493
1398
  'lightning-timepicker'
1494
1399
  );
1400
+ } else if (this.isTypePrimitiveInput) {
1401
+ inputElement = this._primitiveComponent.inputElement;
1495
1402
  } else {
1496
1403
  inputElement = this.template.querySelector('input');
1497
1404
  this._inputDragonDecorated = true;
@@ -1530,34 +1437,8 @@ export default class LightningInput extends LightningElement {
1530
1437
 
1531
1438
  get _displayedValue() {
1532
1439
  if (this.isTypeNumber) {
1533
- // When only a symbol is entered by the user, set the display value as the user's input.
1534
- // This will not affect the value dispatched by input via the change event, as it only dispatches a valid decimal number.
1535
- // Due to the above, in integrations like input-field, the user's initial input of a symbol
1536
- // like a minus sign will not be overwritten by an empty string value.
1537
- // See description in PR for more details: https://github.com/salesforce-experience-platform/lightning-components/pull/3843
1538
- if (
1539
- this._inputElement.value.length === 1 &&
1540
- hasValidNumberSymbol(this._inputElement.value)
1541
- ) {
1542
- return this._inputElement.value;
1543
- }
1544
-
1545
- // If the number is not valid (bad input, step mismatch, etc.) show the raw number as
1546
- // well, otherwise the formatted value ends up being 'NaN' which makes it hard to
1547
- // see mistakes
1548
- if (this._showRawNumber || !this.validity.valid) {
1549
- if (
1550
- hasValidNumberShortcut(this._numberRawValue) &&
1551
- isValidNumber(this._numberRawValue)
1552
- ) {
1553
- this._numberRawValue = fromIsoDecimal(this._value);
1554
- }
1555
- return this._numberRawValue;
1556
- }
1557
- return formatNumber(
1558
- this._value,
1559
- this._buildFormatNumberOptions(this.formatter)
1560
- );
1440
+ const subcomponent = this._primitiveComponent;
1441
+ return subcomponent.getDisplayedValue();
1561
1442
  }
1562
1443
 
1563
1444
  if (
@@ -1571,18 +1452,6 @@ export default class LightningInput extends LightningElement {
1571
1452
  return this._value;
1572
1453
  }
1573
1454
 
1574
- /**
1575
- * Gets the value for the actual 'type' attribute on the input element.
1576
- */
1577
- get _internalType() {
1578
- // Maps number->text to support shorthand input strings like '1k'.
1579
- if (this.isTypeNumber || this.isTypeEmail) {
1580
- return 'text';
1581
- }
1582
-
1583
- return this._type;
1584
- }
1585
-
1586
1455
  get isStandardVariant() {
1587
1456
  return (
1588
1457
  this.variant === VARIANT.STANDARD ||
@@ -1590,34 +1459,14 @@ export default class LightningInput extends LightningElement {
1590
1459
  );
1591
1460
  }
1592
1461
 
1593
- get _showClearButton() {
1594
- return (
1595
- this.isTypeSearch &&
1596
- isNotUndefinedOrNull(this._value) &&
1597
- this._value !== ''
1598
- );
1599
- }
1600
-
1601
1462
  get _ignoreRequired() {
1602
1463
  // If uploading via the drop zone or via the input directly, we should
1603
1464
  // ignore the required flag as a file has been uploaded
1604
1465
  return (
1605
- this.isTypeFile &&
1606
- this._required &&
1607
- (this.fileUploadedViaDroppableZone ||
1608
- (this._files && this._files.length > 0))
1466
+ this.isTypeFile && this._required && this.files && this.files.length
1609
1467
  );
1610
1468
  }
1611
1469
 
1612
- get _inputMode() {
1613
- if (this.isTypeNumber) {
1614
- return 'decimal';
1615
- } else if (this.isTypeEmail) {
1616
- return 'email';
1617
- }
1618
- return null;
1619
- }
1620
-
1621
1470
  get _constraint() {
1622
1471
  if (!this._constraintApi) {
1623
1472
  const overrides = {
@@ -1761,37 +1610,6 @@ export default class LightningInput extends LightningElement {
1761
1610
  return this.template.host.getRootNode();
1762
1611
  }
1763
1612
 
1764
- handleFileClick() {
1765
- this._setInputValue(null);
1766
- this._updateValueAndValidityAttribute(null);
1767
- }
1768
-
1769
- handleDropFiles(event) {
1770
- // drop doesn't trigger focus nor blur, so set state to interacting
1771
- // and auto leave when there's no more action
1772
- this.interactingState.interacting();
1773
-
1774
- this.fileUploadedViaDroppableZone = true;
1775
- this._files = event.dataTransfer && event.dataTransfer.files;
1776
-
1777
- this._updateProxyInputAttributes('required');
1778
-
1779
- this._dispatchChangeEventWithDetail({
1780
- files: this._files,
1781
- });
1782
- }
1783
-
1784
- /**
1785
- * Handle text selection.
1786
- * Dynamically bound to the select event by `renderedCallback`.
1787
- * This allows us to cache text selection in Safari, which doesn't preserve selection.
1788
- */
1789
- handleSelect() {
1790
- if (isSafari) {
1791
- this._selectionCache.preserve(this._inputElement);
1792
- }
1793
- }
1794
-
1795
1613
  handleFocus() {
1796
1614
  this.interactingState.enter();
1797
1615
 
@@ -1799,24 +1617,11 @@ export default class LightningInput extends LightningElement {
1799
1617
  this._isColorPickerPanelOpen = false;
1800
1618
  }
1801
1619
 
1802
- // Focusing a number input causes the value displayed to be modified.
1803
- // Changing the value resets selection, so we save and restore selection.
1804
- if (this._rendered && this.isTypeNumber) {
1805
- this._showRawNumber = true;
1806
- this._selectionCache.preserve(this._inputElement);
1807
- this._inputElement.value = this._displayedValue;
1808
- this._selectionCache.restore(this._inputElement);
1809
- }
1810
-
1811
1620
  this.dispatchEvent(new CustomEvent('focus'));
1812
1621
  }
1813
1622
 
1814
1623
  handleBlur(event) {
1815
1624
  this.interactingState.leave();
1816
- if (this._rendered && this.isTypeNumber) {
1817
- this._showRawNumber = false;
1818
- this._setInputValue(this._displayedValue);
1819
- }
1820
1625
 
1821
1626
  if (
1822
1627
  !event.relatedTarget ||
@@ -1834,87 +1639,34 @@ export default class LightningInput extends LightningElement {
1834
1639
 
1835
1640
  handleChange(event) {
1836
1641
  event.stopPropagation();
1837
-
1838
1642
  this._dispatchCommitEvent();
1839
-
1840
- if (this.isTypeSimple && this.value === event.target.value) {
1841
- return;
1842
- }
1843
-
1844
1643
  this._dispatchChangeEvent();
1845
1644
  }
1846
1645
 
1847
- handleInput(event) {
1848
- event.stopPropagation();
1849
-
1850
- if (this.isTypeNumber) {
1851
- // for invalid numbers the value might stay the same as the user
1852
- // changed the invalid input, so we need to update the raw value
1853
- this._numberRawValue = this._inputElement.value;
1854
- }
1855
-
1856
- if (this.isTypeSimple && this.value === event.target.value) {
1857
- return;
1858
- }
1859
-
1860
- this._dispatchChangeEvent();
1646
+ handleCommit() {
1647
+ this._dispatchCommitEvent();
1861
1648
  }
1862
1649
 
1863
- handleKeyDown(event) {
1864
- if (this.isTypeNumber) {
1865
- // we're letting "Shift" through to prevent capital letters, other special symbols for type="number"
1866
- const hasMetaOrCtrlModifier = event.metaKey || event.ctrlKey;
1867
- // need to check that event.key is valid for "autofill" cases
1868
- if (!hasMetaOrCtrlModifier && !this.readOnly && event.key) {
1869
- const key = normalizeKeyValue(event.key);
1870
-
1871
- if (key.length === 1 && !isValidNumberCharacter(key)) {
1872
- event.preventDefault();
1873
- }
1874
-
1875
- if (key === 'ArrowUp') {
1876
- event.preventDefault();
1877
- this._numberStepUpAndDispatchEvents(1);
1878
- } else if (key === 'ArrowDown') {
1879
- event.preventDefault();
1880
- this._numberStepUpAndDispatchEvents(-1);
1881
- }
1882
- }
1883
- }
1884
- }
1650
+ handlePrimitiveInputFileChange() {
1651
+ const detail = {
1652
+ files: this.files,
1653
+ value: this._inputElement.value,
1654
+ };
1655
+ this._updateProxyInputAttributes('required');
1656
+ this._updateValueAndValidityAttribute(detail.value);
1885
1657
 
1886
- handleColorChange(event) {
1887
- const selectedColor = event.detail.color;
1888
- if (selectedColor !== this._inputElement.value) {
1889
- this._setInputValue(selectedColor);
1890
- this._updateValueAndValidityAttribute(selectedColor);
1891
- this.focus();
1892
- this._dispatchChangeEventWithDetail({ value: selectedColor });
1893
- this._dispatchCommitEvent();
1894
- }
1895
- this.template
1896
- .querySelector('lightning-primitive-colorpicker-button')
1897
- .focus();
1658
+ this.dispatchEvent(
1659
+ new CustomEvent('change', {
1660
+ composed: true,
1661
+ bubbles: true,
1662
+ detail,
1663
+ })
1664
+ );
1898
1665
  }
1899
1666
 
1900
- _clearAndSetFocusOnInput(event) {
1901
- // TODO: Discuss this, it seems the wrong thing to do.
1902
- // button is removed from template, but
1903
- // event still is propagated, For example, captured by panel,
1904
- // then cause panel think is clicked outside.
1905
- event.stopPropagation();
1906
-
1667
+ handlePrimitiveInputSimpleChange() {
1907
1668
  this.interactingState.enter();
1908
- this._setInputValue('');
1909
- this._updateValueAndValidityAttribute('');
1910
-
1911
- this._inputElement.focus();
1912
-
1913
- this._dispatchChangeEventWithDetail({
1914
- value: this._value,
1915
- });
1916
-
1917
- this._dispatchCommitEvent();
1669
+ this._updateProxyInputAttributes('value');
1918
1670
  }
1919
1671
 
1920
1672
  _dispatchCommitEvent() {
@@ -1951,7 +1703,11 @@ export default class LightningInput extends LightningElement {
1951
1703
  }
1952
1704
  }
1953
1705
 
1954
- _validateRequiredAttributes() {
1706
+ /**
1707
+ * Label is a required attribute.
1708
+ * Throw error if an invalid value is passed to the label attribute
1709
+ */
1710
+ validateRequiredAttributes() {
1955
1711
  const { label } = this;
1956
1712
  assert(
1957
1713
  typeof label === 'string' && label.length,
@@ -1973,6 +1729,8 @@ export default class LightningInput extends LightningElement {
1973
1729
  }
1974
1730
 
1975
1731
  _dispatchChangeEvent() {
1732
+ // TODO: investigate removing this in a future update
1733
+ // possibly phase out the interactingState entirely
1976
1734
  this.interactingState.enter();
1977
1735
 
1978
1736
  const detail = {};
@@ -1980,20 +1738,10 @@ export default class LightningInput extends LightningElement {
1980
1738
  if (this.isTypeCheckable) {
1981
1739
  this._updateCheckedAndValidityAttribute(this._inputElement.checked);
1982
1740
  detail.checked = this._checked;
1983
- } else if (this.isTypeFile) {
1984
- this._files = this._inputElement.files;
1985
-
1986
- // LWC does not proxy dom elements any more. So there is no need to call lwc.unwrap here anymore
1987
- detail.files = this._files;
1988
-
1989
- this._updateProxyInputAttributes('required');
1990
1741
  }
1991
1742
 
1992
1743
  if (!this.isTypeCheckable) {
1993
- if (this.isTypeNumber) {
1994
- this._numberRawValue = this._inputElement.value;
1995
- detail.value = toIsoDecimal(this._inputElement.value);
1996
- } else {
1744
+ if (!this.isTypeNumber) {
1997
1745
  detail.value = this._inputElement.value;
1998
1746
  }
1999
1747
 
@@ -2047,36 +1795,9 @@ export default class LightningInput extends LightningElement {
2047
1795
  }
2048
1796
 
2049
1797
  /**
2050
- * Increases (if increment is positive, decreases otherwise) the number value of the input by the increment
2051
- * multiple of the given 'step'. Additionally dispatches the 'change' and 'commit' events.
2052
- *
2053
- * @param {Number} increment A multiple of the step to increase, when step is 'any',
2054
- * the step is assumed to be 1.
2055
- * @private
1798
+ * Updates the class list on the host element based on the variant
2056
1799
  */
2057
- _numberStepUpAndDispatchEvents(increment) {
2058
- if (this._readOnly || this._disabled) {
2059
- return;
2060
- }
2061
- this._value = increaseNumberByStep({
2062
- value: this._value,
2063
- step: this.step,
2064
- increment,
2065
- fractionDigits: this._buildFormatNumberOptions(this.formatter)
2066
- .minimumFractionDigits,
2067
- });
2068
-
2069
- // Raw value is the value the user entered (we preserve a user's input),
2070
- // since we're generating a new value we're overriding it
2071
- this._numberRawValue = fromIsoDecimal(this._value);
2072
-
2073
- this._setInputValue(this._displayedValue);
2074
-
2075
- this._dispatchChangeEvent();
2076
- this._dispatchCommitEvent();
2077
- }
2078
-
2079
- _updateClassList() {
1800
+ updateClassListForVariant() {
2080
1801
  classListMutation(this.classList, {
2081
1802
  'slds-form-element_stacked': this.variant === VARIANT.LABEL_STACKED,
2082
1803
  'slds-form-element_horizontal':
@@ -2084,39 +1805,6 @@ export default class LightningInput extends LightningElement {
2084
1805
  });
2085
1806
  }
2086
1807
 
2087
- _updateNumberValue(value) {
2088
- const newValue = stringifyNumber(value);
2089
- this._value = newValue;
2090
- this._numberRawValue = fromIsoDecimal(newValue);
2091
- }
2092
-
2093
- _buildFormatNumberOptions(formatter) {
2094
- const options = {
2095
- style: formatter,
2096
- };
2097
- // Use the min/max fraction digits from the formatFractionDigits provided by the user if available.
2098
- // Otherwise, use the number of digits calculated from step
2099
- if (this._formatFractionDigits !== undefined) {
2100
- options.minimumFractionDigits = this._formatFractionDigits;
2101
- options.maximumFractionDigits = this._formatFractionDigits;
2102
- } else {
2103
- let digitsFromStep = calculateFractionDigitsFromStep(this._step);
2104
- // if formatting percentages, when calculating digits from step, take into
2105
- // consideration that the formatted number is effectively multiplied by 10^2, ie. 0.1 is 10%
2106
- // so we need to subtract 2 digits;
2107
- if (formatter === 'percent' && typeof digitsFromStep === 'number') {
2108
- digitsFromStep -= 2;
2109
- if (digitsFromStep < 0) {
2110
- digitsFromStep = 0;
2111
- }
2112
- }
2113
-
2114
- options.minimumFractionDigits = digitsFromStep;
2115
- options.maximumFractionDigits = digitsFromStep;
2116
- }
2117
- return options;
2118
- }
2119
-
2120
1808
  _normalizeDateTimeString(value) {
2121
1809
  let result = value;
2122
1810
  if (this.isTypeDate) {
@@ -2129,14 +1817,6 @@ export default class LightningInput extends LightningElement {
2129
1817
  return result;
2130
1818
  }
2131
1819
 
2132
- _updateInputA11y(elem) {
2133
- synchronizeAttrs(elem, {
2134
- [ARIA_LABELLEDBY]: this.computedAriaLabelledBy,
2135
- [ARIA_DESCRIBEDBY]: this.computedAriaDescribedBy,
2136
- [ARIA_LABEL]: this.computedAriaLabel,
2137
- });
2138
- }
2139
-
2140
1820
  _updateDateOrTimePickerA11y(elem) {
2141
1821
  synchronizeAttrs(elem, {
2142
1822
  ariaLabelledByElement: this._ariaLabelledBy,
@@ -2164,7 +1844,6 @@ export default class LightningInput extends LightningElement {
2164
1844
  _synchronizeA11y() {
2165
1845
  // each of these templates are mutually exclusive and are selected
2166
1846
  // depending on the [type] of input.
2167
- const input = this.template.querySelector('input');
2168
1847
  const datepicker = this.template.querySelector('lightning-datepicker');
2169
1848
  const timepicker = this.template.querySelector('lightning-timepicker');
2170
1849
  const datetimepicker = this.template.querySelector(
@@ -2172,9 +1851,7 @@ export default class LightningInput extends LightningElement {
2172
1851
  );
2173
1852
  // determine which template type is present,
2174
1853
  // and update a11y props accordingly
2175
- if (input) {
2176
- this._updateInputA11y(input);
2177
- } else if (datepicker) {
1854
+ if (datepicker) {
2178
1855
  this._updateDateOrTimePickerA11y(datepicker);
2179
1856
  } else if (timepicker) {
2180
1857
  this._updateDateOrTimePickerA11y(timepicker);