lightning-base-components 1.18.7-alpha → 1.18.8-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 (113) hide show
  1. package/metadata/raptor.json +32 -9
  2. package/package.json +1 -1
  3. package/src/lightning/accordion/accordion.slds.css +26 -20
  4. package/src/lightning/accordionSection/accordion-section.slds.css +20 -14
  5. package/src/lightning/avatar/avatar.slds.css +10 -10
  6. package/src/lightning/baseCombobox/base-combobox.slds.css +23 -23
  7. package/src/lightning/baseCombobox/baseCombobox.css +1 -2
  8. package/src/lightning/baseCombobox/baseCombobox.html +7 -11
  9. package/src/lightning/baseCombobox/baseCombobox.js +84 -36
  10. package/src/lightning/breadcrumb/breadcrumb.js +4 -2
  11. package/src/lightning/breadcrumb/breadcrumb.slds.css +3 -3
  12. package/src/lightning/breadcrumbs/breadcrumbs.slds.css +5 -5
  13. package/src/lightning/button/button.slds.css +8 -2
  14. package/src/lightning/buttonGroup/button-group.slds.css +5 -5
  15. package/src/lightning/buttonIcon/button-icon.slds.css +9 -3
  16. package/src/lightning/buttonIconStateful/button-icon-stateful.slds.css +15 -9
  17. package/src/lightning/buttonMenu/button-menu.slds.css +13 -7
  18. package/src/lightning/buttonStateful/button-stateful.slds.css +11 -5
  19. package/src/lightning/calendar/calendar.js +15 -23
  20. package/src/lightning/calendar/calendar.slds.css +29 -23
  21. package/src/lightning/card/card.slds.css +68 -68
  22. package/src/lightning/combobox/combobox.slds.css +1 -1
  23. package/src/lightning/combobox/form-element.slds.css +8 -0
  24. package/src/lightning/datatable/datatable.js +4 -0
  25. package/src/lightning/datatable/keyboard.js +8 -4
  26. package/src/lightning/datatable/sort.js +1 -1
  27. package/src/lightning/datepicker/datepicker.js +1 -1
  28. package/src/lightning/datepicker/form-element.slds.css +8 -0
  29. package/src/lightning/datepicker/input-text.slds.css +23 -23
  30. package/src/lightning/datetimepicker/form-element.slds.css +8 -0
  31. package/src/lightning/datetimepicker/input-text.slds.css +23 -23
  32. package/src/lightning/dualListbox/form-element.slds.css +8 -0
  33. package/src/lightning/f6Controller/f6Controller.js +31 -22
  34. package/src/lightning/formattedDateTime/formattedDateTime.js +1 -1
  35. package/src/lightning/groupedCombobox/groupedCombobox.html +4 -0
  36. package/src/lightning/groupedCombobox/groupedCombobox.js +3 -2
  37. package/src/lightning/helptext/form-element.slds.css +8 -0
  38. package/src/lightning/helptext/help-text.slds.css +10 -4
  39. package/src/lightning/icon/icon.js +5 -1
  40. package/src/lightning/icon/icon.slds.css +3 -3
  41. package/src/lightning/input/__examples__/checkboxbutton/checkboxbutton.css +6 -0
  42. package/src/lightning/input/__examples__/checkboxbutton/checkboxbutton.html +2 -1
  43. package/src/lightning/input/__examples__/checkboxbutton/checkboxbutton.js +1 -1
  44. package/src/lightning/input/__examples__/number/number.html +0 -5
  45. package/src/lightning/input/form-element.slds.css +8 -0
  46. package/src/lightning/input/input.css +0 -2
  47. package/src/lightning/input/input.html +149 -239
  48. package/src/lightning/input/input.js +221 -539
  49. package/src/lightning/inputUtils/inputUtils.js +15 -20
  50. package/src/lightning/inputUtils/normalize.js +7 -0
  51. package/src/lightning/{input/numberUtil.js → inputUtils/number.js} +1 -1
  52. package/src/lightning/inputUtils/utils.js +18 -0
  53. package/src/lightning/layout/layout.js +1 -0
  54. package/src/lightning/layoutItem/layoutItem.js +1 -0
  55. package/src/lightning/modal/__docs__/modal.md +102 -3
  56. package/src/lightning/pill/avatar.slds.css +10 -10
  57. package/src/lightning/primitiveColorpickerButton/color-picker-button.slds.css +9 -9
  58. package/src/lightning/primitiveIcon/icon.slds.css +3 -3
  59. package/src/lightning/primitiveInputCheckbox/form-element.slds.css +289 -0
  60. package/src/lightning/{input → primitiveInputCheckbox}/input-checkbox.slds.css +18 -18
  61. package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.css +3 -0
  62. package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.html +48 -0
  63. package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.js +139 -0
  64. package/src/lightning/primitiveInputCheckboxButton/form-element.slds.css +289 -0
  65. package/src/lightning/primitiveInputCheckboxButton/input-checkbox-button.slds.css +126 -0
  66. package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.css +6 -0
  67. package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.html +24 -0
  68. package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.js +176 -0
  69. package/src/lightning/primitiveInputColor/form-element.slds.css +289 -0
  70. package/src/lightning/primitiveInputColor/input-color.slds.css +35 -0
  71. package/src/lightning/{input → primitiveInputColor}/input-text.slds.css +23 -23
  72. package/src/lightning/primitiveInputColor/primitiveInputColor.css +4 -0
  73. package/src/lightning/primitiveInputColor/primitiveInputColor.html +50 -0
  74. package/src/lightning/primitiveInputColor/primitiveInputColor.js +184 -0
  75. package/src/lightning/primitiveInputFile/button.slds.css +533 -0
  76. package/src/lightning/primitiveInputFile/form-element.slds.css +289 -0
  77. package/src/lightning/primitiveInputFile/input-file.slds.css +62 -0
  78. package/src/lightning/primitiveInputFile/primitiveInputFile.css +5 -0
  79. package/src/lightning/primitiveInputFile/primitiveInputFile.html +45 -0
  80. package/src/lightning/primitiveInputFile/primitiveInputFile.js +111 -0
  81. package/src/lightning/primitiveInputRadio/primitiveInputRadio.html +24 -0
  82. package/src/lightning/primitiveInputRadio/primitiveInputRadio.js +103 -0
  83. package/src/lightning/primitiveInputSimple/form-element.slds.css +289 -0
  84. package/src/lightning/primitiveInputSimple/input-text.slds.css +398 -0
  85. package/src/lightning/primitiveInputSimple/primitiveInputSimple.css +9 -0
  86. package/src/lightning/primitiveInputSimple/primitiveInputSimple.html +65 -0
  87. package/src/lightning/primitiveInputSimple/primitiveInputSimple.js +585 -0
  88. package/src/lightning/primitiveInputToggle/form-element.slds.css +289 -0
  89. package/src/lightning/primitiveInputToggle/input-toggle.slds.css +170 -0
  90. package/src/lightning/primitiveInputToggle/primitiveInputToggle.css +3 -0
  91. package/src/lightning/primitiveInputToggle/primitiveInputToggle.html +34 -0
  92. package/src/lightning/primitiveInputToggle/primitiveInputToggle.js +164 -0
  93. package/src/lightning/radioGroup/input-radio-group.slds.css +57 -57
  94. package/src/lightning/select/form-element.slds.css +8 -0
  95. package/src/lightning/select/select.js +1 -0
  96. package/src/lightning/select/select.slds.css +30 -22
  97. package/src/lightning/sldsCommon/sldsCommon.css +21 -0
  98. package/src/lightning/spinner/spinner.js +8 -4
  99. package/src/lightning/spinner/spinner.slds.css +34 -34
  100. package/src/lightning/tab/tab.css +2 -0
  101. package/src/lightning/tab/tab.js +37 -14
  102. package/src/lightning/tab/tab.slds.css +47 -0
  103. package/src/lightning/tabBar/tab-bar.slds.css +5 -5
  104. package/src/lightning/tabset/tabset.css +10 -0
  105. package/src/lightning/tabset/tabset.js +31 -7
  106. package/src/lightning/timepicker/form-element.slds.css +8 -0
  107. package/src/lightning/toast/button-icon.slds.css +9 -3
  108. package/src/lightning/toast/icon.slds.css +3 -3
  109. package/src/lightning/verticalNavigation/vertical-navigation.slds.css +1 -1
  110. package/src/lightning/baseCombobox/spinner.slds.css +0 -438
  111. /package/src/lightning/{input/emailUtil.js → inputUtils/email.js} +0 -0
  112. /package/src/lightning/{input → primitiveInputSimple}/normalize.js +0 -0
  113. /package/src/lightning/{input → primitiveInputSimple}/selection.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';
@@ -18,15 +16,11 @@ import { classSet, formatLabel } from 'lightning/utils';
18
16
  import {
19
17
  assert,
20
18
  classListMutation,
21
- getRealDOMId,
22
19
  reflectAttribute,
23
- isSafari,
24
20
  isNativeComponent,
25
- isNotUndefinedOrNull,
26
21
  isUndefinedOrNull,
27
22
  normalizeAriaAttribute,
28
23
  normalizeBoolean,
29
- normalizeKeyValue,
30
24
  normalizeString,
31
25
  synchronizeAttrs,
32
26
  decorateInputForDragon,
@@ -34,7 +28,6 @@ import {
34
28
  computeAriaInvalid,
35
29
  } from 'lightning/utilsPrivate';
36
30
  import AriaObserver from 'lightning/ariaObserver';
37
- import { normalizeInput } from './normalize';
38
31
  import {
39
32
  normalizeDate,
40
33
  normalizeDateTimeToUTC,
@@ -47,26 +40,14 @@ import {
47
40
  InteractingState,
48
41
  normalizeVariant,
49
42
  VARIANT,
50
- } from 'lightning/inputUtils';
51
- import {
52
- calculateFractionDigitsFromStep,
53
- formatNumber,
54
- fromIsoDecimal,
55
- hasValidNumberShortcut,
56
- hasValidNumberSymbol,
57
- increaseNumberByStep,
43
+ normalizeInput,
58
44
  isValidNumber,
59
- isValidNumberCharacter,
60
- stringifyNumber,
61
- toIsoDecimal,
62
- } from './numberUtil';
63
- import { isValidEmail, isValidMultipleEmails } from './emailUtil';
64
- import { InputSelectionCache } from './selection';
45
+ isValidEmail,
46
+ isValidMultipleEmails,
47
+ } from 'lightning/inputUtils';
65
48
 
66
49
  const i18n = {
67
50
  a11yTriggerText: labelA11yTriggerText,
68
- inputFileBodyText: labelInputFileBodyText,
69
- inputFileButtonLabel: labelInputFileButtonLabel,
70
51
  messageToggleActive: labelMessageToggleActive,
71
52
  messageToggleInactive: labelMessageToggleInactive,
72
53
  numberIncrementCounter: labelNumberIncrementCounter,
@@ -106,7 +87,6 @@ const VALID_NUMBER_FORMATTERS = [
106
87
  'percent-fixed',
107
88
  'currency',
108
89
  ];
109
- const DEFAULT_COLOR = '#000000';
110
90
  const DEFAULT_FORMATTER = VALID_NUMBER_FORMATTERS[0];
111
91
 
112
92
  /**
@@ -301,12 +281,12 @@ export default class LightningInput extends LightningElement {
301
281
  @track _ariaInvalid;
302
282
  @track _autocomplete;
303
283
 
284
+ _shouldShowHelpMessage = true;
285
+ _helpMessageChanged = false;
304
286
  _formatter = DEFAULT_FORMATTER;
305
287
  _showRawNumber = false;
306
288
  _initialValueSet = false;
307
- _files = null;
308
289
  _rendered;
309
- _selectionCache;
310
290
 
311
291
  constructor() {
312
292
  super();
@@ -314,12 +294,7 @@ export default class LightningInput extends LightningElement {
314
294
 
315
295
  // Native Shadow Root will return [native code].
316
296
  // 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();
297
+ this._isNativeShadow = isNativeComponent(this);
323
298
  }
324
299
 
325
300
  connectedCallback() {
@@ -334,21 +309,18 @@ export default class LightningInput extends LightningElement {
334
309
 
335
310
  this.classList.add('slds-form-element');
336
311
 
337
- this._updateClassList();
338
- this._validateRequiredAttributes();
312
+ this.updateClassListForVariant();
313
+ this.validateRequiredAttributes();
339
314
 
340
315
  this.interactingState = new InteractingState();
341
316
  this.interactingState.onleave(() => this.reportValidity());
342
-
343
- if (this.isTypeNumber) {
344
- this._updateNumberValue(this._value);
345
- }
346
317
  }
347
318
 
348
319
  disconnectedCallback() {
349
320
  this._rendered = false;
350
321
  this._initialValueSet = false;
351
322
  this._cachedInputElement = undefined;
323
+ this.cachedPrimitiveComponent = undefined;
352
324
  if (this.ariaObserver) {
353
325
  this.ariaObserver.disconnect();
354
326
  this.ariaObserver = undefined;
@@ -356,18 +328,15 @@ export default class LightningInput extends LightningElement {
356
328
  }
357
329
 
358
330
  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
331
  if (this.isConnected) {
369
332
  this.ariaObserver.sync(this.isNativeShadow);
370
333
 
334
+ // If the help message changed, the help message element needs to be (un)related
335
+ if (this._helpMessageChanged) {
336
+ this.connectAriaDescribedBy();
337
+ this._helpMessageChanged = false;
338
+ }
339
+
371
340
  if (!this._rendered) {
372
341
  this.connectAriaDescribedBy();
373
342
  this.connectAriaLabelledBy();
@@ -378,10 +347,6 @@ export default class LightningInput extends LightningElement {
378
347
  if (!this._initialValueSet && this._inputElement) {
379
348
  this._rendered = true;
380
349
 
381
- if (this.isTypeNumber) {
382
- this._numberRawValue = fromIsoDecimal(this._value);
383
- }
384
-
385
350
  this._setInputValue(this._displayedValue);
386
351
  if (this.isTypeCheckable) {
387
352
  this._inputElement.checked = this._checked;
@@ -397,17 +362,7 @@ export default class LightningInput extends LightningElement {
397
362
  * @type {number}
398
363
  *
399
364
  */
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
- }
365
+ @api formatFractionDigits;
411
366
 
412
367
  /**
413
368
  * A space-separated list of element IDs whose presence or content is controlled by the
@@ -651,15 +606,22 @@ export default class LightningInput extends LightningElement {
651
606
  */
652
607
  @api
653
608
  get formatter() {
609
+ // Formatters are applicable to the number type
610
+ // If the primitive exists, retrieve value from primitive-input-simple
611
+ if (this.isTypeNumber && this._primitiveComponent) {
612
+ return this._primitiveComponent.formatter;
613
+ }
654
614
  return this._formatter;
655
615
  }
656
616
 
657
617
  set formatter(value) {
658
- this._formatter = normalizeString(value, {
659
- fallbackValue: DEFAULT_FORMATTER,
660
- validValues: VALID_NUMBER_FORMATTERS,
661
- });
662
- this._updateInputDisplayValueIfTypeNumber();
618
+ this._formatter = value;
619
+
620
+ // If the primitive exists, retrieve value from primitive-input-simple
621
+ // The primitive will normalize the value
622
+ if (this.isTypeNumber && this._primitiveComponent) {
623
+ this._primitiveComponent.formatter = this._formatter;
624
+ }
663
625
  }
664
626
 
665
627
  /**
@@ -843,7 +805,6 @@ export default class LightningInput extends LightningElement {
843
805
  }
844
806
 
845
807
  this._updateProxyInputAttributes('step');
846
- this._updateInputDisplayValueIfTypeNumber();
847
808
  }
848
809
 
849
810
  /**
@@ -865,7 +826,11 @@ export default class LightningInput extends LightningElement {
865
826
  this._checked = normalizeBoolean(value);
866
827
 
867
828
  if (this._rendered) {
868
- this._inputElement.checked = this._checked;
829
+ if (this.isTypeCheckbox) {
830
+ this._primitiveComponent.checked = this._checked;
831
+ } else {
832
+ this._inputElement.checked = this._checked;
833
+ }
869
834
  }
870
835
 
871
836
  // Update proxy input should be set after _inputElement is updated.
@@ -896,29 +861,29 @@ export default class LightningInput extends LightningElement {
896
861
  */
897
862
  @api
898
863
  get value() {
864
+ if (this.isTypeSimple) {
865
+ const subcomponent = this._primitiveComponent;
866
+ if (subcomponent) {
867
+ return subcomponent.value;
868
+ }
869
+ }
899
870
  return this._value;
900
871
  }
901
872
 
902
873
  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
874
  // Setting value of a type='file' isn't allowed
921
875
  if (!this.isTypeFile) {
876
+ this._value = normalizeInput(value);
877
+
878
+ if (this.isTypeSimple) {
879
+ const subcomponent = this._primitiveComponent;
880
+ if (subcomponent) {
881
+ subcomponent.value = this._value;
882
+ }
883
+ }
884
+
885
+ this._updateProxyInputAttributes('value');
886
+
922
887
  // Again, due to the interop layer we need to check whether the value being set
923
888
  // is different, otherwise we're duplicating the sets on the input, which result
924
889
  // in different bugs like Japanese IME duplication of characters in Safari (likely a browser bug) or
@@ -949,7 +914,7 @@ export default class LightningInput extends LightningElement {
949
914
 
950
915
  set variant(value) {
951
916
  this._variant = normalizeVariant(value);
952
- this._updateClassList();
917
+ this.updateClassListForVariant();
953
918
  reflectAttribute(this, 'variant', this._variant);
954
919
  }
955
920
 
@@ -1053,7 +1018,7 @@ export default class LightningInput extends LightningElement {
1053
1018
  @api
1054
1019
  get files() {
1055
1020
  if (this.isTypeFile) {
1056
- return this._files;
1021
+ return this._primitiveComponent.files;
1057
1022
  }
1058
1023
  return null;
1059
1024
  }
@@ -1068,6 +1033,14 @@ export default class LightningInput extends LightningElement {
1068
1033
  return this._constraint.validity;
1069
1034
  }
1070
1035
 
1036
+ /**
1037
+ * Not moving selectionStart and selectionEnd to the inner component. Looks like
1038
+ * one of the expected error/fail cases is that the component throws an error in the console,
1039
+ * if the user attempts to set it on a non-supported type (like range, file, checkbox).
1040
+ * That can only happen from `lightning-input`. To avoid duplicating code, it's best to keep
1041
+ * this here.
1042
+ */
1043
+
1071
1044
  /**
1072
1045
  * Specifies the index of the first character to select in the input element.
1073
1046
  * This attribute is supported only for text type.
@@ -1142,9 +1115,13 @@ export default class LightningInput extends LightningElement {
1142
1115
  }
1143
1116
  if (this._rendered && !this.isNativeInput) {
1144
1117
  this._inputElement.showHelpMessage(message);
1145
- } else {
1146
- this._helpMessage = message;
1118
+ return;
1147
1119
  }
1120
+ if (this._rendered && this.isTypePrimitiveInput) {
1121
+ this._shouldShowHelpMessage = false;
1122
+ this._helpMessageChanged = true;
1123
+ }
1124
+ this._helpMessage = message;
1148
1125
  });
1149
1126
  }
1150
1127
 
@@ -1177,195 +1154,47 @@ export default class LightningInput extends LightningElement {
1177
1154
  }
1178
1155
  }
1179
1156
 
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);
1157
+ get primitiveSelector() {
1158
+ if (this.isTypeSimple) {
1159
+ return 'lightning-primitive-input-simple';
1216
1160
  }
1217
-
1218
- return normalizeAriaAttribute(ariaValues);
1219
- }
1220
-
1221
- get computedAriaDescribedBy() {
1222
- const ariaValues = [];
1223
-
1224
- if (this._helpMessage) {
1225
- ariaValues.push(this.computedUniqueHelpElementId);
1161
+ if (this.isTypeCheckboxButton) {
1162
+ return 'lightning-primitive-input-checkbox-button';
1226
1163
  }
1227
- // The toggle type is described by a secondary element
1228
1164
  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);
1235
- }
1236
- if (this.ariaDescribedBy) {
1237
- ariaValues.push(this.ariaDescribedBy);
1165
+ return 'lightning-primitive-input-toggle';
1238
1166
  }
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);
1167
+ if (this.isTypeColor) {
1168
+ return 'lightning-primitive-input-color';
1282
1169
  }
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);
1170
+ if (this.isTypeCheckbox) {
1171
+ return 'lightning-primitive-input-checkbox';
1290
1172
  }
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);
1173
+ if (this.isTypeRadio) {
1174
+ return 'lightning-primitive-input-radio';
1300
1175
  }
1301
- return null;
1302
- }
1303
-
1304
- get computedUniqueFileElementLabelledById() {
1305
1176
  if (this.isTypeFile) {
1306
- const labelIds = [
1307
- this.computedUniqueFormLabelId,
1308
- this.computedUniqueFileSelectorLabelId,
1309
- ];
1310
- return labelIds.join(' ');
1177
+ return 'lightning-primitive-input-file';
1311
1178
  }
1312
1179
  return null;
1313
1180
  }
1314
1181
 
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;
1182
+ get shouldShowHelpMessage() {
1183
+ return this._shouldShowHelpMessage && this._helpMessage;
1327
1184
  }
1328
1185
 
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
- }
1186
+ /************************* INPUT TYPE GETTERS *************************/
1342
1187
 
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);
1188
+ get isTypePrimitiveInput() {
1189
+ return (
1190
+ this.isTypeSimple ||
1191
+ this.isTypeCheckboxButton ||
1192
+ this.isTypeCheckbox ||
1193
+ this.isTypeToggle ||
1194
+ this.isTypeColor ||
1195
+ this.isTypeRadio ||
1196
+ this.isTypeFile
1197
+ );
1369
1198
  }
1370
1199
 
1371
1200
  get isTypeNumber() {
@@ -1394,10 +1223,6 @@ export default class LightningInput extends LightningElement {
1394
1223
  );
1395
1224
  }
1396
1225
 
1397
- get isTypeSearch() {
1398
- return this.type === 'search';
1399
- }
1400
-
1401
1226
  get isTypeToggle() {
1402
1227
  return this.type === 'toggle';
1403
1228
  }
@@ -1463,19 +1288,104 @@ export default class LightningInput extends LightningElement {
1463
1288
  }
1464
1289
 
1465
1290
  get isTypeSimple() {
1291
+ const type = this.type;
1466
1292
  return (
1467
- !this.isTypeCheckbox &&
1468
- !this.isTypeCheckboxButton &&
1469
- !this.isTypeToggle &&
1470
- !this.isTypeRadio &&
1471
- !this.isTypeFile &&
1472
- !this.isTypeColor &&
1473
- !this.isTypeDesktopDate &&
1474
- !this.isTypeDesktopDateTime &&
1475
- !this.isTypeDesktopTime
1293
+ type === 'text' ||
1294
+ type === 'number' ||
1295
+ type === 'email' ||
1296
+ type === 'tel' ||
1297
+ type === 'url' ||
1298
+ type === 'search' ||
1299
+ type === 'password' ||
1300
+ type === 'range' ||
1301
+ !type
1302
+ );
1303
+ }
1304
+
1305
+ get isNativeInput() {
1306
+ return !(
1307
+ this.isTypeDesktopDate ||
1308
+ this.isTypeDesktopDateTime ||
1309
+ this.isTypeDesktopTime
1310
+ );
1311
+ }
1312
+
1313
+ get _primitiveComponent() {
1314
+ if (!this.cachedPrimitiveComponent) {
1315
+ this.cachedPrimitiveComponent = this.template.querySelector(
1316
+ this.primitiveSelector
1317
+ );
1318
+ }
1319
+ return this.cachedPrimitiveComponent;
1320
+ }
1321
+ /************************* GETTERS *************************/
1322
+
1323
+ /*** Accessibility ***/
1324
+
1325
+ get computedAriaLabel() {
1326
+ const ariaValues = [];
1327
+
1328
+ // merge all date & time arias on mobile since it's displayed as a single field
1329
+ if (this.isTypeMobileDateTime) {
1330
+ ariaValues.push(this.dateAriaLabel);
1331
+ ariaValues.push(this.timeAriaLabel);
1332
+ }
1333
+ if (this.ariaLabel) {
1334
+ ariaValues.push(this.ariaLabel);
1335
+ }
1336
+
1337
+ return normalizeAriaAttribute(ariaValues);
1338
+ }
1339
+
1340
+ get computedAriaInvalid() {
1341
+ // W-8796658: aria-invalid should always follow the visual indication of errors
1342
+ return computeAriaInvalid(
1343
+ this._helpMessage,
1344
+ this.value,
1345
+ this.ariaInvalid
1476
1346
  );
1477
1347
  }
1478
1348
 
1349
+ /****** ******/
1350
+
1351
+ get isLabelHidden() {
1352
+ return this.variant === VARIANT.LABEL_HIDDEN;
1353
+ }
1354
+
1355
+ get isLabelStacked() {
1356
+ return this.variant === VARIANT.LABEL_STACKED;
1357
+ }
1358
+
1359
+ get accesskey() {
1360
+ return this._accesskey;
1361
+ }
1362
+
1363
+ get i18n() {
1364
+ return i18n;
1365
+ }
1366
+
1367
+ get computedLabelClass() {
1368
+ const classnames = classSet('slds-form-element__label');
1369
+ if (this.isTypeCheckable || this.isTypeFile) {
1370
+ // do nothing
1371
+ } else if (this.isTypeToggle) {
1372
+ classnames.add('slds-m-bottom_none');
1373
+ } else {
1374
+ classnames.add('slds-no-flex');
1375
+ }
1376
+ return classnames
1377
+ .add({ 'slds-assistive-text': this.isLabelHidden })
1378
+ .toString();
1379
+ }
1380
+
1381
+ get normalizedMax() {
1382
+ return this._normalizeDateTimeString(this.max);
1383
+ }
1384
+
1385
+ get normalizedMin() {
1386
+ return this._normalizeDateTimeString(this.min);
1387
+ }
1388
+
1479
1389
  get _inputElement() {
1480
1390
  if (!this._cachedInputElement || this._inputElementRefreshNeeded) {
1481
1391
  this._inputDragonDecorated = false;
@@ -1492,6 +1402,8 @@ export default class LightningInput extends LightningElement {
1492
1402
  inputElement = this.template.querySelector(
1493
1403
  'lightning-timepicker'
1494
1404
  );
1405
+ } else if (this.isTypePrimitiveInput) {
1406
+ inputElement = this._primitiveComponent.inputElement;
1495
1407
  } else {
1496
1408
  inputElement = this.template.querySelector('input');
1497
1409
  this._inputDragonDecorated = true;
@@ -1530,34 +1442,8 @@ export default class LightningInput extends LightningElement {
1530
1442
 
1531
1443
  get _displayedValue() {
1532
1444
  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
- );
1445
+ const subcomponent = this._primitiveComponent;
1446
+ return subcomponent.getDisplayedValue();
1561
1447
  }
1562
1448
 
1563
1449
  if (
@@ -1571,18 +1457,6 @@ export default class LightningInput extends LightningElement {
1571
1457
  return this._value;
1572
1458
  }
1573
1459
 
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
1460
  get isStandardVariant() {
1587
1461
  return (
1588
1462
  this.variant === VARIANT.STANDARD ||
@@ -1590,34 +1464,14 @@ export default class LightningInput extends LightningElement {
1590
1464
  );
1591
1465
  }
1592
1466
 
1593
- get _showClearButton() {
1594
- return (
1595
- this.isTypeSearch &&
1596
- isNotUndefinedOrNull(this._value) &&
1597
- this._value !== ''
1598
- );
1599
- }
1600
-
1601
1467
  get _ignoreRequired() {
1602
1468
  // If uploading via the drop zone or via the input directly, we should
1603
1469
  // ignore the required flag as a file has been uploaded
1604
1470
  return (
1605
- this.isTypeFile &&
1606
- this._required &&
1607
- (this.fileUploadedViaDroppableZone ||
1608
- (this._files && this._files.length > 0))
1471
+ this.isTypeFile && this._required && this.files && this.files.length
1609
1472
  );
1610
1473
  }
1611
1474
 
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
1475
  get _constraint() {
1622
1476
  if (!this._constraintApi) {
1623
1477
  const overrides = {
@@ -1761,37 +1615,6 @@ export default class LightningInput extends LightningElement {
1761
1615
  return this.template.host.getRootNode();
1762
1616
  }
1763
1617
 
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
1618
  handleFocus() {
1796
1619
  this.interactingState.enter();
1797
1620
 
@@ -1799,24 +1622,11 @@ export default class LightningInput extends LightningElement {
1799
1622
  this._isColorPickerPanelOpen = false;
1800
1623
  }
1801
1624
 
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
1625
  this.dispatchEvent(new CustomEvent('focus'));
1812
1626
  }
1813
1627
 
1814
1628
  handleBlur(event) {
1815
1629
  this.interactingState.leave();
1816
- if (this._rendered && this.isTypeNumber) {
1817
- this._showRawNumber = false;
1818
- this._setInputValue(this._displayedValue);
1819
- }
1820
1630
 
1821
1631
  if (
1822
1632
  !event.relatedTarget ||
@@ -1834,87 +1644,34 @@ export default class LightningInput extends LightningElement {
1834
1644
 
1835
1645
  handleChange(event) {
1836
1646
  event.stopPropagation();
1837
-
1838
1647
  this._dispatchCommitEvent();
1839
-
1840
- if (this.isTypeSimple && this.value === event.target.value) {
1841
- return;
1842
- }
1843
-
1844
1648
  this._dispatchChangeEvent();
1845
1649
  }
1846
1650
 
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();
1651
+ handleCommit() {
1652
+ this._dispatchCommitEvent();
1861
1653
  }
1862
1654
 
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
- }
1655
+ handlePrimitiveInputFileChange() {
1656
+ const detail = {
1657
+ files: this.files,
1658
+ value: this._inputElement.value,
1659
+ };
1660
+ this._updateProxyInputAttributes('required');
1661
+ this._updateValueAndValidityAttribute(detail.value);
1885
1662
 
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();
1663
+ this.dispatchEvent(
1664
+ new CustomEvent('change', {
1665
+ composed: true,
1666
+ bubbles: true,
1667
+ detail,
1668
+ })
1669
+ );
1898
1670
  }
1899
1671
 
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
-
1672
+ handlePrimitiveInputSimpleChange() {
1907
1673
  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();
1674
+ this._updateProxyInputAttributes('value');
1918
1675
  }
1919
1676
 
1920
1677
  _dispatchCommitEvent() {
@@ -1951,7 +1708,11 @@ export default class LightningInput extends LightningElement {
1951
1708
  }
1952
1709
  }
1953
1710
 
1954
- _validateRequiredAttributes() {
1711
+ /**
1712
+ * Label is a required attribute.
1713
+ * Throw error if an invalid value is passed to the label attribute
1714
+ */
1715
+ validateRequiredAttributes() {
1955
1716
  const { label } = this;
1956
1717
  assert(
1957
1718
  typeof label === 'string' && label.length,
@@ -1973,6 +1734,8 @@ export default class LightningInput extends LightningElement {
1973
1734
  }
1974
1735
 
1975
1736
  _dispatchChangeEvent() {
1737
+ // TODO: investigate removing this in a future update
1738
+ // possibly phase out the interactingState entirely
1976
1739
  this.interactingState.enter();
1977
1740
 
1978
1741
  const detail = {};
@@ -1980,20 +1743,10 @@ export default class LightningInput extends LightningElement {
1980
1743
  if (this.isTypeCheckable) {
1981
1744
  this._updateCheckedAndValidityAttribute(this._inputElement.checked);
1982
1745
  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
1746
  }
1991
1747
 
1992
1748
  if (!this.isTypeCheckable) {
1993
- if (this.isTypeNumber) {
1994
- this._numberRawValue = this._inputElement.value;
1995
- detail.value = toIsoDecimal(this._inputElement.value);
1996
- } else {
1749
+ if (!this.isTypeNumber) {
1997
1750
  detail.value = this._inputElement.value;
1998
1751
  }
1999
1752
 
@@ -2047,36 +1800,9 @@ export default class LightningInput extends LightningElement {
2047
1800
  }
2048
1801
 
2049
1802
  /**
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
1803
+ * Updates the class list on the host element based on the variant
2056
1804
  */
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() {
1805
+ updateClassListForVariant() {
2080
1806
  classListMutation(this.classList, {
2081
1807
  'slds-form-element_stacked': this.variant === VARIANT.LABEL_STACKED,
2082
1808
  'slds-form-element_horizontal':
@@ -2084,39 +1810,6 @@ export default class LightningInput extends LightningElement {
2084
1810
  });
2085
1811
  }
2086
1812
 
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
1813
  _normalizeDateTimeString(value) {
2121
1814
  let result = value;
2122
1815
  if (this.isTypeDate) {
@@ -2129,14 +1822,6 @@ export default class LightningInput extends LightningElement {
2129
1822
  return result;
2130
1823
  }
2131
1824
 
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
1825
  _updateDateOrTimePickerA11y(elem) {
2141
1826
  synchronizeAttrs(elem, {
2142
1827
  ariaLabelledByElement: this._ariaLabelledBy,
@@ -2164,7 +1849,6 @@ export default class LightningInput extends LightningElement {
2164
1849
  _synchronizeA11y() {
2165
1850
  // each of these templates are mutually exclusive and are selected
2166
1851
  // depending on the [type] of input.
2167
- const input = this.template.querySelector('input');
2168
1852
  const datepicker = this.template.querySelector('lightning-datepicker');
2169
1853
  const timepicker = this.template.querySelector('lightning-timepicker');
2170
1854
  const datetimepicker = this.template.querySelector(
@@ -2172,9 +1856,7 @@ export default class LightningInput extends LightningElement {
2172
1856
  );
2173
1857
  // determine which template type is present,
2174
1858
  // and update a11y props accordingly
2175
- if (input) {
2176
- this._updateInputA11y(input);
2177
- } else if (datepicker) {
1859
+ if (datepicker) {
2178
1860
  this._updateDateOrTimePickerA11y(datepicker);
2179
1861
  } else if (timepicker) {
2180
1862
  this._updateDateOrTimePickerA11y(timepicker);