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,398 +0,0 @@
1
- /* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
2
- Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
3
-
4
- /* The Input Control Container holds the `start` and `end` slot contents, as well as the input control itself */
5
-
6
- :host([data-render-mode="shadow"]) [part~='input-container'] {
7
- display: flex;
8
- align-items: center;
9
- position: relative;
10
- min-height: var(--sds-c-inputtext-sizing-height);
11
- padding-inline-end: var(--sds-c-inputtext-spacing-inline-end, var(--sds-c-inputtext-spacing-inline));
12
- padding-inline-start: var(--sds-c-inputtext-spacing-inline-start, var(--sds-c-inputtext-spacing-inline));
13
- background-color: var(--sds-c-inputtext-color-background, var(--sds-g-color-neutral-base-1));
14
- border-width: var(--sds-c-inputtext-sizing-border, var(--sds-g-sizing-border-1, 1px));
15
- border-style: solid;
16
- border-color: var(--sds-c-inputtext-color-border, var(--sds-g-color-neutral-base-contrast-3));
17
- border-radius: var(--sds-c-inputtext-radius-border);
18
- box-shadow: var(--sds-c-inputtext-shadow);
19
- }
20
-
21
- /* The Input element (in markup) */
22
-
23
- :host([data-render-mode="shadow"]) [part~='input'] {
24
- width: 100%;
25
- height: 100%;
26
- padding: 0;
27
- font-size: var(--sds-c-inputtext-font-size);
28
- color: var(--sds-c-inputtext-text-color);
29
- line-height: 1;
30
- border: none;
31
- background: transparent;
32
- }
33
-
34
- /* Placeholder Text */
35
-
36
- :host([data-render-mode="shadow"]) [part~='input']::placeholder {
37
- color: var(--sds-c-inputtext-text-color-placeholder);
38
- font-style: var(--sds-c-inputtext-font-style-placeholder);
39
- }
40
-
41
- /* Focus State */
42
-
43
- :host([data-render-mode="shadow"]) [part~='input-container']:focus-within {
44
- --sds-c-inputtext-color-border: var(
45
- --sds-c-inputtext-color-border-focus,
46
- var(--sds-g-color-palette-blue-50, #0176d3)
47
- );
48
- --sds-c-inputtext-shadow: var(--sds-c-inputtext-shadow-focus, 0 0 3px var(--sds-g-color-palette-blue-50, #0176d3));
49
- --sds-c-inputtext-color-background: var(--sds-c-inputtext-color-background-focus);
50
- --sds-c-inputtext-text-color: var(--sds-c-inputtext-text-color-focus);
51
- }
52
-
53
- :host([data-render-mode="shadow"]) [part~='input']:focus {
54
- outline: none;
55
- }
56
-
57
- /* Invalid state */
58
-
59
- :host([data-render-mode="shadow"][aria-invalid='true']) [part~='input-container'] {
60
- --sds-c-inputtext-color-border: var(--sds-c-inputtext-color-border-invalid);
61
- --sds-c-inputtext-color-background: var(--sds-c-inputtext-color-background-invalid);
62
- }
63
-
64
- :host([data-render-mode="shadow"][aria-invalid='true']) [part~='input'] {
65
- --sds-c-inputtext-text-color: var(--sds-c-inputtext-text-color-invalid);
66
- }
67
-
68
- /* Valid State */
69
-
70
- :host([data-render-mode="shadow"][aria-invalid='false']) [part~='input-container'] {
71
- --sds-c-inputtext-color-border: var(--sds-c-inputtext-color-border-valid);
72
- --sds-c-inputtext-color-background: var(--sds-c-inputtext-color-background-valid);
73
- }
74
-
75
- :host([data-render-mode="shadow"][aria-invalid='false']) [part~='input'] {
76
- --sds-c-inputtext-text-color: var(--sds-c-inputtext-text-color-valid);
77
- }
78
-
79
- /* Readonly State */
80
-
81
- :host([data-render-mode="shadow"][readonly]) [part~='input-container'] {
82
- --sds-c-inputtext-sizing-border: var(--sds-c-inputtext-sizing-border-readonly);
83
- --sds-c-inputtext-spacing-inline-start: var(
84
- --sds-c-inputtext-spacing-inline-start-readonly,
85
- var(--sds-c-inputtext-spacing-inline-readonly)
86
- );
87
- --sds-c-inputtext-spacing-inline-end: var(
88
- --sds-c-inputtext-spacing-inline-end-readonly,
89
- var(--sds-c-inputtext-spacing-inline-readonly)
90
- );
91
- }
92
-
93
- /* Disabled State */
94
-
95
- :host([data-render-mode="shadow"][disabled]) [part~='input-container'] {
96
- --sds-c-inputtext-text-color: #3e3e3c; /* TODO: Replace with Global Styling Hook Fallback */
97
- --sds-c-inputtext-color-background: #ecebea; /* TODO: Replace with Global Styling Hook Fallback */
98
- --sds-c-inputtext-color-border: #c9c7c5; /* TODO: Replace with Global Styling Hook Fallback */
99
- }
100
-
101
- @supports (--styling-hooks: '') {
102
- /**
103
- * Input Text
104
- */
105
- :host([data-render-mode="shadow"]) [part~='input-text'] {
106
- /* Host reassignments to composed slds-icon */
107
- --slds-c-icon-color-foreground: var(
108
- --slds-c-inputtext-icon-color-foreground,
109
- var(--sds-g-color-neutral-base-50, #747474)
110
- );
111
- --slds-c-icon-sizing: var(--slds-c-inputtext-icon-sizing, 14px);
112
- --sds-c-inputtext-sizing-height: var(
113
- --slds-c-inputtext-sizing-height,
114
- var(--sds-g-sizing-9, 2rem)
115
- );
116
- --sds-c-inputtext-color-background: var(
117
- --slds-c-inputtext-color-background,
118
- var(--sds-g-color-neutral-base-100, #ffffff)
119
- );
120
- --sds-c-inputtext-color-background-focus: var(
121
- --slds-c-inputtext-color-background-focus,
122
- var(--sds-g-color-neutral-base-100, #ffffff)
123
- );
124
- --sds-c-inputtext-text-color: var(--slds-c-inputtext-text-color);
125
- --sds-c-inputtext-font-size: var(
126
- --slds-c-inputtext-font-size,
127
- var(--sds-g-font-scale-neg-2, 0.8125rem)
128
- );
129
- --sds-c-inputtext-text-color-placeholder: var(
130
- --slds-c-inputtext-text-color-placeholder,
131
- var(--sds-g-color-neutral-base-50, #747474)
132
- );
133
- --sds-c-inputtext-color-border: var(
134
- --slds-c-inputtext-color-border,
135
- var(--sds-g-color-neutral-base-80, #c9c9c9)
136
- );
137
- --sds-c-inputtext-sizing-border: var(--slds-c-inputtext-sizing-border);
138
- --sds-c-inputtext-radius-border: var(
139
- --slds-c-inputtext-radius-border,
140
- var(--sds-g-radius-border-2, 0.25rem)
141
- );
142
-
143
- display: flex;
144
- flex-wrap: wrap;
145
- align-items: center;
146
- }
147
-
148
- /**
149
- * Input Container
150
- */
151
- :host([data-render-mode="shadow"]) [part~='input-container'] {
152
- flex: 1 0 100%;
153
- align-items: stretch;
154
- }
155
-
156
- :host([data-render-mode="shadow"]) [part~='input-container'][type~='range'] {
157
- border: none;
158
- display: inline-block;
159
- }
160
-
161
- :host([data-render-mode="shadow"]) [part~='input'][type~='range'] {
162
- min-height: calc(1.875rem + (1px * 2));
163
- margin: 0;
164
- }
165
-
166
- :host([data-render-mode="shadow"]) [part~='input-container'][type~='range']:focus-within,:host([data-render-mode="shadow"])
167
- [part~='input-container'][type~='range']:active {
168
- --sds-c-inputtext-color-border: var(--sds-g-color-brand-base-60, #1b96ff);
169
- --sds-c-inputtext-shadow: 0 0 3px var(--sds-g-color-brand-base-50, #0176d3);
170
- --sds-c-inputtext-color-background: var(--sds-g-color-neutral-base-100, #ffffff);
171
-
172
- outline: 0;
173
- border-width: var(--sds-c-inputtext-sizing-border, var(--sds-g-sizing-border-1, 1px));
174
- border-color: var(--sds-c-inputtext-color-border, var(--sds-g-color-neutral-base-contrast-3));
175
- }
176
-
177
- /**
178
- * Input
179
- */
180
- :host([data-render-mode="shadow"]) [part~='input'] {
181
- padding-inline-start: var(
182
- --slds-c-inputtext-spacing-inline-start,
183
- var(--sds-g-spacing-3, 0.75rem));
184
- padding-inline-end: var(
185
- --slds-c-inputtext-spacing-inline-end,
186
- var(--sds-g-spacing-4, 1rem));
187
- height: unset;
188
- font-family: var(--sds-g-font-family, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, 'Helvetica Neue', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol');
189
- }
190
-
191
- /**
192
- * Focus / active State
193
- */
194
- :host([data-render-mode="shadow"]) [part~="input-container"]:focus-within,:host([data-render-mode="shadow"])
195
- [part~="input-container"]:active {
196
- --sds-c-inputtext-color-border: var(--sds-g-color-brand-base-60, #1b96ff);
197
- --sds-c-inputtext-shadow: 0 0 3px var(--sds-g-color-brand-base-50, #0176d3);
198
- --sds-c-inputtext-color-background: var(--sds-g-color-neutral-base-100, #ffffff);
199
-
200
- outline: 0;
201
- }
202
-
203
- /**
204
- * Read Only State
205
- */
206
- :host([data-render-mode="shadow"][readonly]) [part~='input-text'] {
207
- --sds-c-inputtext-spacing-inline-start-readonly: 0;
208
- --sds-c-inputtext-color-border-focus: transparent;
209
- --slds-c-inputtext-color-border: transparent;
210
- --slds-c-inputtext-color-background: transparent;
211
- --slds-c-inputtext-color-background-focus: transparent;
212
- }
213
-
214
- /**
215
- * Invalid State
216
- *
217
- * Does not use --sds-c-inputtext-color-border-invalid due to this hook being
218
- * tied to :host([aria-invalid]) which this subsystem does not use. Instead, it
219
- * uses :host([invalid]).
220
- */
221
- :host([data-render-mode="shadow"][invalid]) [part~='input-text'] {
222
- --sds-c-inputtext-shadow: 0 0 0 var(--sds-g-sizing-border-1, 1px) inset
223
- var(--sds-g-color-error-base-50, #ea001e);
224
- --slds-c-inputtext-color-border: var(--sds-g-color-error-base-50, #ea001e);
225
- --slds-c-icon-color-foreground: var(--sds-g-color-error-base-50, #ea001e);
226
- }
227
-
228
- /**
229
- * Invalid State - Focus
230
- *
231
- * The following styling hooks are included in SDS and need to be reassigned
232
- * here to prevent a bug with the focus state border and box-shadow
233
- */
234
- :host([data-render-mode="shadow"][invalid]) [part~='input-container']:focus-within {
235
- --sds-c-inputtext-shadow:
236
- var(--sds-g-color-error-base-50, #ea001e) 0 0 0 var(--sds-g-sizing-border-1, 1px) inset,
237
- 0 0 var(--sds-g-sizing-border-3, 3px) var(--sds-g-color-brand-base-50, #0176d3);
238
- --sds-c-inputtext-color-border: var(--sds-g-color-error-base-50, #ea001e);
239
- }
240
-
241
- /**
242
- * Disabled State
243
- *
244
- * Both parts form the visible form control.
245
- */
246
- :host([data-render-mode="shadow"][disabled]) [part~='input-container'],:host([data-render-mode="shadow"][disabled]) [part~='input'] {
247
- cursor: not-allowed;
248
- --sds-c-inputtext-color-background: var(--sds-g-color-neutral-base-95, #f3f3f3);
249
- --sds-c-inputtext-color-border: var(--sds-g-color-neutral-base-80, #c9c9c9);
250
- --sds-c-inputtext-text-color: var(--sds-g-color-neutral-base-50, #747474);
251
- }
252
-
253
- /**
254
- * Label
255
- *
256
- * Add [part~='input-text'] to increase specificity and
257
- * avoid collisions with other components using [part~='label'] (e.g. slds-input-checkbox)
258
- */
259
- :host([data-render-mode="shadow"]) [part~='input-text'] [part~='label'] {
260
- padding-block-start: var(--sds-g-spacing-1, 0.25rem);
261
- padding-inline-end: var(--sds-g-spacing-2, 0.5rem);
262
- color: var(
263
- --slds-c-inputtext-label-color,
264
- var(--sds-g-color-neutral-base-30, #444444)
265
- );
266
- font-size: var(
267
- --slds-c-inputtext-label-font-size,
268
- var(--sds-g-font-scale-neg-3, 0.75rem)
269
- );
270
- margin-block-end: var(--sds-g-sizing-1, 0.125rem);
271
-
272
- /* We inline flex to control the spacing between elements and not have to rely on whitespace characters */
273
- display: inline-flex;
274
- }
275
-
276
- /**
277
- * Start
278
- *
279
- * Only expects an SLDS icon. We assign the SLDS Icon Styling Hook here
280
- * so we don't add spacing to other icons composed in the component, e.g.,
281
- * the icon in the inline help text.
282
- */
283
- :host([data-render-mode="shadow"]) [part~='start'] {
284
- --slds-c-icon-spacing-inline-end: var(--sds-g-spacing-2, 0.5rem);
285
- }
286
-
287
- /**
288
- * Label Inline Variant
289
- *
290
- * Note: all the 33% values you see are remnants of legacy SLDS. We need to
291
- * keep this implementation intact so visual output is the same when used
292
- * in a form that has non-shadow components. Attempting to refactor to a
293
- * modern solution like flex is proving tricky due to the presence of the
294
- * optional inline-help and the input needing to have exactly 33% of spacing
295
- * from the inline-start.
296
- *
297
- * Ref: https://github.com/salesforce-ux/design-system-internal/blob/240-winter-23/ui/components/form-element/horizontal/_index.scss#L63
298
- */
299
- @media (min-width: 48em) {
300
- :host([data-render-mode="shadow"][variant~='label-inline']) [part~='input-text'] {
301
- display: block;
302
- }
303
-
304
- :host([data-render-mode="shadow"][variant~='label-inline']) [part~='label'] {
305
- float: left;
306
-
307
- /* TODO: Get rid of these magic numbers */
308
- max-width: calc(33% - 1.125rem);
309
- padding-block-start: var(--sds-g-spacing-1, 0.25rem);
310
- }
311
-
312
- :host([data-render-mode="shadow"][variant~='label-inline']) [part~='input-container'] {
313
- margin-inline-start: 33%;
314
- }
315
-
316
- :host([data-render-mode="shadow"][variant~='label-inline']) [part~='inline-help'] {
317
- float: left;
318
- padding-block-start: var(--sds-g-spacing-1, 0.25rem);
319
- }
320
- }
321
-
322
- :host([data-render-mode="shadow"]) input[type="search"] + lightning-primitive-icon::part(icon) {
323
- left: var(--sds-g-spacing-3, 0.75rem);
324
- fill: var(--slds-g-color-neutral-base-50, #747474);
325
- }
326
-
327
- :host([data-render-mode="shadow"]) .slds-input-has-icon .slds-button_icon {
328
- background-color: transparent;
329
- }
330
-
331
- :host([data-render-mode="shadow"]) .slds-input-has-icon .slds-button_icon:focus,:host([data-render-mode="shadow"])
332
- .slds-input-has-icon .slds-button_icon:hover {
333
- --slds-c-icon-color-foreground: var(--sds-g-color-brand-base-30, #014486);
334
- }
335
-
336
- :host([data-render-mode="shadow"]) .slds-input-has-icon .slds-input__icon {
337
- width: 0.875rem;
338
- height: 0.875rem;
339
- position: absolute;
340
- top: 50%;
341
- margin-top: -0.4375rem;
342
- line-height: 1;
343
- border: 0;
344
- z-index: 2;
345
- }
346
-
347
- /**
348
- * Has Icon Left
349
- */
350
- :host([data-render-mode="shadow"]) .slds-input-has-icon_left {
351
- --slds-c-inputtext-spacing-inline-start: var(--sds-g-spacing-6, 2rem);
352
- }
353
-
354
- :host([data-render-mode="shadow"]) .slds-input-has-icon_left .slds-input__icon,:host([data-render-mode="shadow"])
355
- .slds-input-has-icon_left-right .slds-input__icon_left {
356
- inset-inline-start: var(--sds-g-spacing-3, 0.75rem);
357
- }
358
-
359
- /**
360
- * Has Icon Right
361
- */
362
- :host([data-render-mode="shadow"]) .slds-input-has-icon_right {
363
- --slds-c-inputtext-spacing-inline-end: var(--sds-g-spacing-6, 2rem);
364
- }
365
-
366
- :host([data-render-mode="shadow"]) .slds-input-has-icon_right .slds-input__icon,:host([data-render-mode="shadow"])
367
- .slds-input-has-icon_left-right .slds-input__icon_right {
368
- inset-inline-end: var(--sds-g-spacing-3, 0.75rem);
369
- }
370
-
371
- /**
372
- * Has Icon Left & Right
373
- */
374
- :host([data-render-mode="shadow"]) .slds-input-has-icon_left-right {
375
- --slds-c-inputtext-spacing-inline-start: var(--sds-g-spacing-6, 2rem);
376
- --slds-c-inputtext-spacing-inline-end: var(--sds-g-spacing-6, 2rem);
377
- }
378
-
379
- /**
380
- * A temporarily baked-in utility class until SLDS gets a proper utility package.
381
- *
382
- * This is a hybrid patch between synthetic and native shadow. The ideal final
383
- * outcome is the removal of this class and replacing the class with the SLDS
384
- * utility package solution.
385
- */
386
- :host([data-render-mode="shadow"]) .slds-assistive-text {
387
- position: absolute !important;
388
- margin: -1px !important;
389
- border: 0 !important;
390
- padding: 0 !important;
391
- width: 1px !important;
392
- height: 1px !important;
393
- overflow: hidden !important;
394
- clip: rect(0 0 0 0) !important;
395
- text-transform: none !important;
396
- white-space: nowrap !important;
397
- }
398
- }
@@ -1,6 +0,0 @@
1
- export function normalizeInput(value) {
2
- if (typeof value === 'number' || typeof value === 'string') {
3
- return String(value);
4
- }
5
- return '';
6
- }
@@ -1,131 +0,0 @@
1
- import { isSafari, isIE11, timeout } from 'lightning/utilsPrivate';
2
-
3
- /**
4
- * Purges the selection cache to the DOM.
5
- * @param input {HTMLInputElement}
6
- * @param cache {InputSelectionCache}
7
- */
8
- function restoreCacheToInput(input, cache) {
9
- input.setSelectionRange(
10
- cache._selectionStartCached,
11
- cache._selectionEndCached
12
- );
13
-
14
- cache.clearCache();
15
- }
16
-
17
- /**
18
- * This class provides a way to cache text selection in input fields.
19
- */
20
- export class InputSelectionCache {
21
- /**
22
- * Cached value for selectionStart
23
- * @type {number|null}
24
- */
25
- _selectionStartCached = null;
26
-
27
- /**
28
- * Cached value for selectionEnd
29
- * @type {number|null}
30
- */
31
- _selectionEndCached = null;
32
-
33
- /**
34
- * Updates the cached values.
35
- * @param {number} start The start of the selected range
36
- * @param {number} end The end of the selected range
37
- * @private
38
- */
39
- _cacheSelectionRange(start, end) {
40
- if (typeof start === 'number' && typeof end === 'number') {
41
- this._selectionStartCached = start;
42
- this._selectionEndCached = end;
43
- }
44
- }
45
-
46
- /**
47
- * Clears our cached selection.
48
- */
49
- clearCache() {
50
- this._selectionStartCached = null;
51
- this._selectionEndCached = null;
52
- }
53
-
54
- /**
55
- * True, if the DOM element has selection.
56
- * @param input {HTMLInputElement} The DOM element to operate on
57
- */
58
- hasSelection(input) {
59
- return (
60
- input.selectionStart !== null &&
61
- // If the start and end are the same, that's not selection, it's just the cursor position.
62
- input.selectionStart !== input.selectionEnd
63
- );
64
- }
65
-
66
- /**
67
- * True, if selection has been cached.
68
- */
69
- isCached() {
70
- return (
71
- this._selectionStartCached !== null &&
72
- this._selectionEndCached !== null
73
- );
74
- }
75
-
76
- /**
77
- * Cache the current text selection for this input field.
78
- * We ignore selection range of (0,0) because that indicates no selection and we don't want to restore it later.
79
- * @param input {HTMLInputElement} The DOM element to operate on
80
- */
81
- preserve(input) {
82
- if (!this.hasSelection(input) && this.isCached()) {
83
- // We already have cached selection but we're asking to preserve no selection,
84
- // so we must NOT overwrite our cache with no selection or we can't restore the previously selected text.
85
- // This happens if the browser doesn't preserve text selection automatically in the input.
86
- return;
87
- }
88
-
89
- // Only update cache if there is selection.
90
- if (this.hasSelection(input)) {
91
- this._cacheSelectionRange(input.selectionStart, input.selectionEnd);
92
- }
93
- }
94
-
95
- /**
96
- * Restore cached selection. This may happen async, so a promise is returned.
97
- * @param input {HTMLInputElement} The DOM element to operate on
98
- * @returns {Promise} A promise to be resolved when the selection is restored.
99
- * If the cache was empty, the promise is resolved immediately as a no-op.
100
- */
101
- restore(input) {
102
- // Bail early if we don't have a cached selection.
103
- if (!this.isCached()) {
104
- return Promise.resolve();
105
- }
106
-
107
- // @W-7962838 - Safari has a browser bug where setting the selection on inputs
108
- // as you focus them keeps it from scrolling into view in certain conditions.
109
- // This can be worked around by setting the text selection in a new call stack immediately after the focus.
110
- // https://bugs.webkit.org/show_bug.cgi?id=217350
111
- if (isSafari) {
112
- return timeout(0).then(() => {
113
- // running async, so revalidate our inputs
114
- if (this.isCached() && input) {
115
- restoreCacheToInput(input, this);
116
- }
117
- });
118
- }
119
-
120
- // W-6176985: IE11 input when set value, will move cursor to beginning.
121
- // This fix is only for input type=number on IE11, and force the cursor to the end.
122
- if (isIE11) {
123
- const length = input.value.length;
124
- input.setSelectionRange(length, length);
125
- return Promise.resolve();
126
- }
127
-
128
- restoreCacheToInput(input, this);
129
- return Promise.resolve();
130
- }
131
- }