@momentum-design/components 0.141.1 → 0.141.3
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.
- package/dist/browser/index.js +218 -178
- package/dist/browser/index.js.map +3 -3
- package/dist/components/checkbox/checkbox.component.js +5 -0
- package/dist/components/combobox/combobox.component.js +20 -7
- package/dist/components/datepicker/datepicker.component.js +28 -4
- package/dist/components/formfieldwrapper/formfieldwrapper.component.d.ts +4 -0
- package/dist/components/formfieldwrapper/formfieldwrapper.component.js +16 -0
- package/dist/components/input/input.component.js +15 -1
- package/dist/components/numberinput/numberinput.component.js +11 -0
- package/dist/components/password/password.component.js +3 -0
- package/dist/components/radio/radio.component.js +7 -0
- package/dist/components/searchfield/searchfield.component.js +10 -0
- package/dist/components/skeleton/skeleton.component.d.ts +2 -0
- package/dist/components/skeleton/skeleton.component.js +2 -0
- package/dist/components/skeleton/skeleton.styles.js +15 -7
- package/dist/components/slider/slider.component.d.ts +1 -5
- package/dist/components/slider/slider.component.js +32 -24
- package/dist/components/textarea/textarea.component.js +14 -5
- package/dist/components/timepicker/timepicker.component.js +28 -0
- package/dist/components/toggle/toggle.component.js +5 -0
- package/dist/custom-elements.json +31 -7
- package/dist/react/skeleton/index.d.ts +2 -0
- package/dist/react/skeleton/index.js +2 -0
- package/package.json +1 -1
|
@@ -175,6 +175,10 @@ class Checkbox extends KeyDownHandledMixin(KeyToActionMixin(AutoFocusOnMountMixi
|
|
|
175
175
|
handleKeyDown(event) {
|
|
176
176
|
var _a;
|
|
177
177
|
const action = this.getActionForKeyEvent(event);
|
|
178
|
+
if (this.softDisabled && action === ACTIONS.ENTER) {
|
|
179
|
+
event.preventDefault();
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
178
182
|
if (this.getKeyboardNavMode() === NAV_MODES.DEFAULT) {
|
|
179
183
|
if ((this.readonly || this.softDisabled) && action === ACTIONS.SPACE) {
|
|
180
184
|
event.preventDefault();
|
|
@@ -260,6 +264,7 @@ class Checkbox extends KeyDownHandledMixin(KeyToActionMixin(AutoFocusOnMountMixi
|
|
|
260
264
|
aria-checked="${this.indeterminate ? 'mixed' : this.checked}"
|
|
261
265
|
.indeterminate="${this.indeterminate}"
|
|
262
266
|
.disabled="${this.disabled}"
|
|
267
|
+
aria-disabled="${this.disabled || this.softDisabled}"
|
|
263
268
|
?readonly="${this.readonly}"
|
|
264
269
|
aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
|
|
265
270
|
tabindex="${this.disabled ? -1 : this.tabIndex}"
|
|
@@ -262,6 +262,8 @@ class Combobox extends KeyDownHandledMixin(KeyToActionMixin(CaptureDestroyEventF
|
|
|
262
262
|
}
|
|
263
263
|
/** @internal */
|
|
264
264
|
openPopover() {
|
|
265
|
+
if (this.disabled || this.softDisabled || this.readonly)
|
|
266
|
+
return;
|
|
265
267
|
this.isOpen = true;
|
|
266
268
|
}
|
|
267
269
|
/** @internal */
|
|
@@ -313,7 +315,7 @@ class Combobox extends KeyDownHandledMixin(KeyToActionMixin(CaptureDestroyEventF
|
|
|
313
315
|
}
|
|
314
316
|
/** @internal */
|
|
315
317
|
handleTriggerClick() {
|
|
316
|
-
if (this.disabled) {
|
|
318
|
+
if (this.disabled || this.softDisabled || this.readonly) {
|
|
317
319
|
return;
|
|
318
320
|
}
|
|
319
321
|
// Toggle dropdown when clicking the trigger button
|
|
@@ -492,10 +494,10 @@ class Combobox extends KeyDownHandledMixin(KeyToActionMixin(CaptureDestroyEventF
|
|
|
492
494
|
listbox.setAttribute('aria-label', this.label || this.dataAriaLabel || '');
|
|
493
495
|
(_b = this.visualCombobox) === null || _b === void 0 ? void 0 : _b.setAttribute('aria-controls', this.listboxId);
|
|
494
496
|
}
|
|
495
|
-
if (changedProperties.has('disabled') ||
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
497
|
+
if (changedProperties.has('disabled') ||
|
|
498
|
+
changedProperties.has('softDisabled') ||
|
|
499
|
+
changedProperties.has('readonly')) {
|
|
500
|
+
if (this.disabled || this.softDisabled || this.readonly) {
|
|
499
501
|
this.closePopover();
|
|
500
502
|
}
|
|
501
503
|
}
|
|
@@ -645,6 +647,8 @@ class Combobox extends KeyDownHandledMixin(KeyToActionMixin(CaptureDestroyEventF
|
|
|
645
647
|
* @internal
|
|
646
648
|
*/
|
|
647
649
|
handleBlurChange() {
|
|
650
|
+
if (this.disabled || this.softDisabled || this.readonly)
|
|
651
|
+
return;
|
|
648
652
|
const options = this.getVisibleOptions(this.filteredValue);
|
|
649
653
|
const activeIndex = options.findIndex(option => option.hasAttribute('data-focused'));
|
|
650
654
|
if (activeIndex !== -1) {
|
|
@@ -691,6 +695,8 @@ class Combobox extends KeyDownHandledMixin(KeyToActionMixin(CaptureDestroyEventF
|
|
|
691
695
|
}
|
|
692
696
|
/** @internal */
|
|
693
697
|
handleInputKeydown(event) {
|
|
698
|
+
if (this.disabled || this.softDisabled || this.readonly)
|
|
699
|
+
return;
|
|
694
700
|
const options = this.getVisibleOptions(this.filteredValue).filter(option => !option.hasAttribute('disabled'));
|
|
695
701
|
const activeIndex = options.findIndex(option => option.hasAttribute('data-focused'));
|
|
696
702
|
const isSpatialNavigation = this.getKeyboardNavMode() === NAV_MODES.SPATIAL;
|
|
@@ -817,6 +823,8 @@ class Combobox extends KeyDownHandledMixin(KeyToActionMixin(CaptureDestroyEventF
|
|
|
817
823
|
/** @internal */
|
|
818
824
|
handleInputChange(event) {
|
|
819
825
|
var _a;
|
|
826
|
+
if (this.preventSoftDisabledChange(event, this.filteredValue))
|
|
827
|
+
return;
|
|
820
828
|
event.preventDefault();
|
|
821
829
|
event.stopPropagation();
|
|
822
830
|
this.filteredValue = event.target.value;
|
|
@@ -835,6 +843,8 @@ class Combobox extends KeyDownHandledMixin(KeyToActionMixin(CaptureDestroyEventF
|
|
|
835
843
|
/** @internal */
|
|
836
844
|
handleOptionsClick(event) {
|
|
837
845
|
var _a;
|
|
846
|
+
if (this.disabled || this.softDisabled || this.readonly)
|
|
847
|
+
return;
|
|
838
848
|
event.preventDefault();
|
|
839
849
|
event.stopPropagation();
|
|
840
850
|
// ensure we get the actual option element even if the click target is a child node
|
|
@@ -848,7 +858,7 @@ class Combobox extends KeyDownHandledMixin(KeyToActionMixin(CaptureDestroyEventF
|
|
|
848
858
|
}
|
|
849
859
|
/** @internal */
|
|
850
860
|
shouldDisplayPopover(optionsLength) {
|
|
851
|
-
if (this.disabled || this.readonly) {
|
|
861
|
+
if (this.disabled || this.softDisabled || this.readonly) {
|
|
852
862
|
return false;
|
|
853
863
|
}
|
|
854
864
|
if (optionsLength || this.noResultText) {
|
|
@@ -904,13 +914,14 @@ class Combobox extends KeyDownHandledMixin(KeyToActionMixin(CaptureDestroyEventF
|
|
|
904
914
|
role="${ROLE.COMBOBOX}"
|
|
905
915
|
?readonly="${this.readonly}"
|
|
906
916
|
?required="${this.required}"
|
|
917
|
+
@beforeinput=${this.preventSoftDisabledInput}
|
|
907
918
|
@input=${this.handleInputChange}
|
|
908
919
|
@keydown=${this.handleInputKeydown}
|
|
909
920
|
@blur="${this.handleBlurChange}"
|
|
910
921
|
aria-autocomplete="${AUTOCOMPLETE_LIST}"
|
|
911
922
|
aria-controls=""
|
|
912
923
|
aria-describedby="${ifDefined(this.helpText ? FORMFIELD_DEFAULTS.HELPER_TEXT_ID : '')}"
|
|
913
|
-
aria-disabled="${this.disabled
|
|
924
|
+
aria-disabled="${this.disabled || this.softDisabled}"
|
|
914
925
|
aria-expanded="${this.isOpen ? 'true' : 'false'}"
|
|
915
926
|
aria-haspopup="${ROLE.LISTBOX}"
|
|
916
927
|
aria-invalid="${this.helpTextType === VALIDATION.ERROR ? 'true' : 'false'}"
|
|
@@ -938,6 +949,7 @@ class Combobox extends KeyDownHandledMixin(KeyToActionMixin(CaptureDestroyEventF
|
|
|
938
949
|
@click="${this.handleTriggerClick}"
|
|
939
950
|
?disabled="${this.disabled}"
|
|
940
951
|
?readonly="${this.readonly}"
|
|
952
|
+
?soft-disabled="${this.softDisabled}"
|
|
941
953
|
help-text-type="${this.helpTextType}"
|
|
942
954
|
>
|
|
943
955
|
${this.renderBaseInput()}
|
|
@@ -945,6 +957,7 @@ class Combobox extends KeyDownHandledMixin(KeyToActionMixin(CaptureDestroyEventF
|
|
|
945
957
|
<mdc-buttonsimple
|
|
946
958
|
@click="${this.handleTriggerClick}"
|
|
947
959
|
part="combobox-button"
|
|
960
|
+
?soft-disabled="${this.softDisabled}"
|
|
948
961
|
?disabled="${this.disabled}"
|
|
949
962
|
tabindex="-1"
|
|
950
963
|
aria-expanded="${this.isOpen ? 'true' : 'false'}"
|
|
@@ -175,6 +175,17 @@ class DatePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
|
|
|
175
175
|
}
|
|
176
176
|
willUpdate(changedProperties) {
|
|
177
177
|
super.willUpdate(changedProperties);
|
|
178
|
+
if (changedProperties.has('disabled') ||
|
|
179
|
+
changedProperties.has('softDisabled') ||
|
|
180
|
+
changedProperties.has('readonly')) {
|
|
181
|
+
if (this.disabled || this.softDisabled || this.readonly) {
|
|
182
|
+
this.closePopover();
|
|
183
|
+
if (this.pendingDigitTimeout)
|
|
184
|
+
clearTimeout(this.pendingDigitTimeout);
|
|
185
|
+
this.pendingDigits = '';
|
|
186
|
+
this.parseValueToInternal();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
178
189
|
if (changedProperties.has('value') && !this.displayPopover) {
|
|
179
190
|
this.parseValueToInternal();
|
|
180
191
|
this.syncFormValue();
|
|
@@ -289,6 +300,8 @@ class DatePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
|
|
|
289
300
|
}
|
|
290
301
|
}
|
|
291
302
|
commitValue() {
|
|
303
|
+
if (this.disabled || this.softDisabled || this.readonly)
|
|
304
|
+
return;
|
|
292
305
|
const newVal = this.internalToValue();
|
|
293
306
|
if (newVal) {
|
|
294
307
|
const clampedVal = this.clampValueToRange(newVal);
|
|
@@ -335,7 +348,7 @@ class DatePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
|
|
|
335
348
|
}
|
|
336
349
|
// -- Popover handling --
|
|
337
350
|
handleCalendarButtonClick() {
|
|
338
|
-
if (this.disabled || this.readonly)
|
|
351
|
+
if (this.disabled || this.softDisabled || this.readonly)
|
|
339
352
|
return;
|
|
340
353
|
if (this.displayPopover) {
|
|
341
354
|
this.closePopover();
|
|
@@ -345,7 +358,7 @@ class DatePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
|
|
|
345
358
|
this.displayPopover = true;
|
|
346
359
|
}
|
|
347
360
|
handleSelectTriggerClick() {
|
|
348
|
-
if (this.disabled || this.readonly)
|
|
361
|
+
if (this.disabled || this.softDisabled || this.readonly)
|
|
349
362
|
return;
|
|
350
363
|
if (this.displayPopover) {
|
|
351
364
|
this.closePopover();
|
|
@@ -354,7 +367,7 @@ class DatePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
|
|
|
354
367
|
this.displayPopover = true;
|
|
355
368
|
}
|
|
356
369
|
handleSelectKeydown(event) {
|
|
357
|
-
if (this.disabled || this.readonly)
|
|
370
|
+
if (this.disabled || this.softDisabled || this.readonly)
|
|
358
371
|
return;
|
|
359
372
|
if (event.key === KEYS.ENTER || event.key === KEYS.SPACE || event.key === KEYS.ARROW_DOWN) {
|
|
360
373
|
event.preventDefault();
|
|
@@ -383,6 +396,8 @@ class DatePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
|
|
|
383
396
|
this.focusBackToTrigger();
|
|
384
397
|
}
|
|
385
398
|
handleDateSelected(event) {
|
|
399
|
+
if (this.disabled || this.softDisabled || this.readonly)
|
|
400
|
+
return;
|
|
386
401
|
const { detail } = event;
|
|
387
402
|
const mode = this.effectiveSelectionMode;
|
|
388
403
|
if (mode === SELECTION_MODE.WEEK || mode === SELECTION_MODE.RANGE) {
|
|
@@ -451,8 +466,11 @@ class DatePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
|
|
|
451
466
|
this.requestUpdate();
|
|
452
467
|
}
|
|
453
468
|
handleSpinbuttonKeydown(event, field) {
|
|
454
|
-
if (this.readonly)
|
|
469
|
+
if (this.disabled || this.softDisabled || this.readonly) {
|
|
470
|
+
if (event.key === KEYS.ARROW_UP || event.key === KEYS.ARROW_DOWN)
|
|
471
|
+
event.preventDefault();
|
|
455
472
|
return;
|
|
473
|
+
}
|
|
456
474
|
const range = this.getFieldRange(field);
|
|
457
475
|
const currentVal = parseInt(this.getFieldValue(field), 10) || 0;
|
|
458
476
|
switch (event.key) {
|
|
@@ -661,6 +679,9 @@ class DatePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
|
|
|
661
679
|
autocomplete="off"
|
|
662
680
|
?disabled="${this.disabled}"
|
|
663
681
|
?readonly="${this.readonly}"
|
|
682
|
+
aria-disabled="${this.disabled || this.softDisabled}"
|
|
683
|
+
@beforeinput="${this.preventSoftDisabledInput}"
|
|
684
|
+
@input="${(event) => this.preventSoftDisabledChange(event, value)}"
|
|
664
685
|
tabindex="${this.disabled ? '-1' : '0'}"
|
|
665
686
|
@keydown="${(e) => this.handleSpinbuttonKeydown(e, field)}"
|
|
666
687
|
@focus="${this.handleSpinbuttonFocus}"
|
|
@@ -691,8 +712,10 @@ class DatePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
|
|
|
691
712
|
prefix-icon="${CALENDAR_ICON}"
|
|
692
713
|
aria-label="${this.localeCalendarLabel}"
|
|
693
714
|
aria-expanded="${this.displayPopover ? 'true' : 'false'}"
|
|
715
|
+
aria-disabled="${this.disabled || this.softDisabled}"
|
|
694
716
|
aria-haspopup="dialog"
|
|
695
717
|
?disabled="${this.disabled}"
|
|
718
|
+
?soft-disabled="${this.softDisabled}"
|
|
696
719
|
size="20"
|
|
697
720
|
@click="${this.handleCalendarButtonClick}"
|
|
698
721
|
></mdc-button>
|
|
@@ -710,6 +733,7 @@ class DatePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
|
|
|
710
733
|
class="mdc-focus-ring"
|
|
711
734
|
role="combobox"
|
|
712
735
|
aria-expanded="${this.displayPopover ? 'true' : 'false'}"
|
|
736
|
+
aria-disabled="${this.disabled || this.softDisabled}"
|
|
713
737
|
aria-haspopup="dialog"
|
|
714
738
|
aria-label="${this.localeCalendarLabel}"
|
|
715
739
|
tabindex="${this.disabled ? '-1' : '0'}"
|
|
@@ -107,6 +107,10 @@ declare class FormfieldWrapper extends FormfieldWrapper_base {
|
|
|
107
107
|
softDisabled: boolean;
|
|
108
108
|
/** @internal */
|
|
109
109
|
protected shouldRenderLabel: Boolean;
|
|
110
|
+
/** @internal */
|
|
111
|
+
protected preventSoftDisabledInput(event: InputEvent): void;
|
|
112
|
+
/** @internal */
|
|
113
|
+
protected preventSoftDisabledChange(event: Event, value: string): boolean;
|
|
110
114
|
/**
|
|
111
115
|
* creates the label element when the label property is set.
|
|
112
116
|
* id is used to link the label with the input field.
|
|
@@ -94,6 +94,22 @@ class FormfieldWrapper extends DisabledMixin(Component) {
|
|
|
94
94
|
/** @internal */
|
|
95
95
|
this.shouldRenderLabel = true;
|
|
96
96
|
}
|
|
97
|
+
/** @internal */
|
|
98
|
+
preventSoftDisabledInput(event) {
|
|
99
|
+
if (this.softDisabled) {
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/** @internal */
|
|
104
|
+
preventSoftDisabledChange(event, value) {
|
|
105
|
+
if (!this.softDisabled)
|
|
106
|
+
return false;
|
|
107
|
+
// Restore edits from non-cancelable beforeinput events, including IME composition.
|
|
108
|
+
const input = event.currentTarget;
|
|
109
|
+
input.value = value;
|
|
110
|
+
event.stopImmediatePropagation();
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
97
113
|
/**
|
|
98
114
|
* creates the label element when the label property is set.
|
|
99
115
|
* id is used to link the label with the input field.
|
|
@@ -208,6 +208,8 @@ class Input extends CharacterLimitMixin(KeyToActionMixin(AutoFocusOnMountMixin(F
|
|
|
208
208
|
* @internal
|
|
209
209
|
*/
|
|
210
210
|
onInput(event) {
|
|
211
|
+
if (this.preventSoftDisabledChange(event, this.value))
|
|
212
|
+
return;
|
|
211
213
|
this.updateValue();
|
|
212
214
|
this.setInputValidity();
|
|
213
215
|
this.checkValidity();
|
|
@@ -230,6 +232,8 @@ class Input extends CharacterLimitMixin(KeyToActionMixin(AutoFocusOnMountMixin(F
|
|
|
230
232
|
* @internal
|
|
231
233
|
*/
|
|
232
234
|
onChange(event) {
|
|
235
|
+
if (this.preventSoftDisabledChange(event, this.value))
|
|
236
|
+
return;
|
|
233
237
|
this.updateValue();
|
|
234
238
|
this.setInputValidity();
|
|
235
239
|
const EventConstructor = event.constructor;
|
|
@@ -242,6 +246,11 @@ class Input extends CharacterLimitMixin(KeyToActionMixin(AutoFocusOnMountMixin(F
|
|
|
242
246
|
*/
|
|
243
247
|
handleKeyDown(event) {
|
|
244
248
|
var _a;
|
|
249
|
+
if (this.softDisabled) {
|
|
250
|
+
if (this.getActionForKeyEvent(event) === ACTIONS.ENTER)
|
|
251
|
+
event.preventDefault();
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
245
254
|
if (this.getActionForKeyEvent(event) === ACTIONS.ENTER && this.getKeyboardNavMode() === NAV_MODES.DEFAULT) {
|
|
246
255
|
(_a = this.form) === null || _a === void 0 ? void 0 : _a.requestSubmit();
|
|
247
256
|
}
|
|
@@ -296,6 +305,8 @@ class Input extends CharacterLimitMixin(KeyToActionMixin(AutoFocusOnMountMixin(F
|
|
|
296
305
|
*/
|
|
297
306
|
clearInputText() {
|
|
298
307
|
var _a;
|
|
308
|
+
if (this.disabled || this.softDisabled || this.readonly)
|
|
309
|
+
return;
|
|
299
310
|
this.value = '';
|
|
300
311
|
// focus the input field after clearing the text
|
|
301
312
|
(_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.focus();
|
|
@@ -319,7 +330,8 @@ class Input extends CharacterLimitMixin(KeyToActionMixin(AutoFocusOnMountMixin(F
|
|
|
319
330
|
size="${DEFAULTS.CLEAR_BUTTON_SIZE}"
|
|
320
331
|
aria-label="${this.clearAriaLabel}"
|
|
321
332
|
@click=${this.clearInputText}
|
|
322
|
-
?disabled=${this.disabled || this.readonly || !showBtn}
|
|
333
|
+
?disabled=${this.disabled || this.softDisabled || this.readonly || !showBtn}
|
|
334
|
+
?soft-disabled=${this.softDisabled}
|
|
323
335
|
></mdc-button>
|
|
324
336
|
`;
|
|
325
337
|
}
|
|
@@ -334,6 +346,7 @@ class Input extends CharacterLimitMixin(KeyToActionMixin(AutoFocusOnMountMixin(F
|
|
|
334
346
|
.value="${live(this.value)}"
|
|
335
347
|
?disabled="${this.disabled}"
|
|
336
348
|
?readonly="${this.readonly}"
|
|
349
|
+
aria-disabled="${this.disabled || this.softDisabled}"
|
|
337
350
|
?required="${this.required}"
|
|
338
351
|
type="${type}"
|
|
339
352
|
aria-labelledby="${ifDefined(this.label ? DEFAULTS.HEADING_ID : undefined)}"
|
|
@@ -349,6 +362,7 @@ class Input extends CharacterLimitMixin(KeyToActionMixin(AutoFocusOnMountMixin(F
|
|
|
349
362
|
pattern=${ifDefined(this.pattern)}
|
|
350
363
|
list=${ifDefined(this.list)}
|
|
351
364
|
size=${ifDefined(this.size)}
|
|
365
|
+
@beforeinput=${this.preventSoftDisabledInput}
|
|
352
366
|
@input=${this.onInput}
|
|
353
367
|
@change=${this.onChange}
|
|
354
368
|
@keydown=${this.handleKeyDown}
|
|
@@ -164,6 +164,12 @@ class NumberInput extends Input {
|
|
|
164
164
|
*/
|
|
165
165
|
handleKeyDown(event) {
|
|
166
166
|
const isStepKey = event.key === KEYS.ARROW_UP || event.key === KEYS.ARROW_DOWN;
|
|
167
|
+
if (this.softDisabled) {
|
|
168
|
+
if (isStepKey)
|
|
169
|
+
event.preventDefault();
|
|
170
|
+
super.handleKeyDown(event);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
167
173
|
if (this.step === DEFAULTS.STEP_ANY && isStepKey && !this.disabled && !this.readonly) {
|
|
168
174
|
event.preventDefault();
|
|
169
175
|
this.stepBy(event.key === KEYS.ARROW_UP ? 'increment' : 'decrement');
|
|
@@ -179,6 +185,8 @@ class NumberInput extends Input {
|
|
|
179
185
|
* Stepping already clamps, so this only covers manual keyboard entry.
|
|
180
186
|
*/
|
|
181
187
|
onChange(event) {
|
|
188
|
+
if (this.preventSoftDisabledChange(event, this.value))
|
|
189
|
+
return;
|
|
182
190
|
if (this.clamp === CLAMP.AUTO && this.clampInputToRange()) {
|
|
183
191
|
this.inputElement.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true }));
|
|
184
192
|
}
|
|
@@ -209,6 +217,8 @@ class NumberInput extends Input {
|
|
|
209
217
|
*/
|
|
210
218
|
stepBy(direction) {
|
|
211
219
|
var _a;
|
|
220
|
+
if (this.disabled || this.softDisabled || this.readonly)
|
|
221
|
+
return;
|
|
212
222
|
const inputElement = this.inputElement;
|
|
213
223
|
const previousValue = inputElement.value;
|
|
214
224
|
if (this.step === DEFAULTS.STEP_ANY) {
|
|
@@ -260,6 +270,7 @@ class NumberInput extends Input {
|
|
|
260
270
|
prefix-icon="${isIncrement ? DEFAULTS.INCREMENT_ICON : DEFAULTS.DECREMENT_ICON}"
|
|
261
271
|
aria-label="${isIncrement ? this.incrementAriaLabel : this.decrementAriaLabel}"
|
|
262
272
|
?disabled=${this.disabled || this.readonly}
|
|
273
|
+
?soft-disabled=${this.softDisabled}
|
|
263
274
|
@click=${isIncrement ? this.handleIncrement : this.handleDecrement}
|
|
264
275
|
tabindex="-1"
|
|
265
276
|
></mdc-button>
|
|
@@ -88,6 +88,8 @@ class Password extends Input {
|
|
|
88
88
|
* Toggles the visibility of the password.
|
|
89
89
|
*/
|
|
90
90
|
toggleShowPassword() {
|
|
91
|
+
if (this.disabled || this.softDisabled || this.readonly)
|
|
92
|
+
return;
|
|
91
93
|
this.showPassword = !this.showPassword;
|
|
92
94
|
}
|
|
93
95
|
/**
|
|
@@ -104,6 +106,7 @@ class Password extends Input {
|
|
|
104
106
|
class="own-focus-ring ${!showBtn ? 'hidden' : ''}"
|
|
105
107
|
variant=${BUTTON_VARIANTS.TERTIARY}
|
|
106
108
|
?disabled=${this.disabled || this.readonly || !showBtn}
|
|
109
|
+
?soft-disabled=${this.softDisabled}
|
|
107
110
|
size="${DEFAULTS.ICON_SIZE}"
|
|
108
111
|
@click=${this.toggleShowPassword}
|
|
109
112
|
aria-label=${this.showPassword ? this.hideButtonAriaLabel : this.showButtonAriaLabel}
|
|
@@ -203,6 +203,10 @@ class Radio extends KeyDownHandledMixin(KeyToActionMixin(AutoFocusOnMountMixin(F
|
|
|
203
203
|
if (this.disabled)
|
|
204
204
|
return;
|
|
205
205
|
const action = this.getActionForKeyEvent(event);
|
|
206
|
+
if (this.softDisabled && action === ACTIONS.ENTER) {
|
|
207
|
+
event.preventDefault();
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
206
210
|
if ((this.readonly || this.softDisabled) && action === ACTIONS.SPACE) {
|
|
207
211
|
event.preventDefault();
|
|
208
212
|
}
|
|
@@ -264,6 +268,9 @@ class Radio extends KeyDownHandledMixin(KeyToActionMixin(AutoFocusOnMountMixin(F
|
|
|
264
268
|
}
|
|
265
269
|
update(changedProperties) {
|
|
266
270
|
super.update(changedProperties);
|
|
271
|
+
if (changedProperties.has('disabled') || changedProperties.has('softDisabled')) {
|
|
272
|
+
this.ariaDisabled = String(this.disabled || this.softDisabled);
|
|
273
|
+
}
|
|
267
274
|
if (changedProperties.has('checked')) {
|
|
268
275
|
this.ariaChecked = this.checked.toString();
|
|
269
276
|
this.setActualFormValue();
|
|
@@ -105,6 +105,8 @@ class Searchfield extends ControlTypeMixin(KeyDownHandledMixin(Input)) {
|
|
|
105
105
|
* @internal
|
|
106
106
|
*/
|
|
107
107
|
this.handleChipKeyDown = (event) => {
|
|
108
|
+
if (this.disabled || this.softDisabled || this.readonly)
|
|
109
|
+
return;
|
|
108
110
|
const action = this.getActionForKeyEvent(event);
|
|
109
111
|
if (event.key === 'Backspace' || event.key === 'Delete') {
|
|
110
112
|
event.preventDefault();
|
|
@@ -183,6 +185,8 @@ class Searchfield extends ControlTypeMixin(KeyDownHandledMixin(Input)) {
|
|
|
183
185
|
handleKeyDown(event) {
|
|
184
186
|
var _a;
|
|
185
187
|
super.handleKeyDown(event);
|
|
188
|
+
if (this.disabled || this.softDisabled || this.readonly)
|
|
189
|
+
return;
|
|
186
190
|
const action = this.getActionForKeyEvent(event);
|
|
187
191
|
if (action === ACTIONS.ESCAPE) {
|
|
188
192
|
this.clearInputText();
|
|
@@ -303,6 +307,8 @@ class Searchfield extends ControlTypeMixin(KeyDownHandledMixin(Input)) {
|
|
|
303
307
|
* @param chip - The chip element to be removed
|
|
304
308
|
*/
|
|
305
309
|
removeChip(chip) {
|
|
310
|
+
if (this.disabled || this.softDisabled || this.readonly)
|
|
311
|
+
return;
|
|
306
312
|
this.dispatchEvent(new CustomEvent('chipRemove', { detail: { chip }, bubbles: true, composed: true }));
|
|
307
313
|
if (this.controlType !== 'controlled') {
|
|
308
314
|
chip.remove();
|
|
@@ -310,6 +316,8 @@ class Searchfield extends ControlTypeMixin(KeyDownHandledMixin(Input)) {
|
|
|
310
316
|
}
|
|
311
317
|
clearInputText() {
|
|
312
318
|
var _a;
|
|
319
|
+
if (this.disabled || this.softDisabled || this.readonly)
|
|
320
|
+
return;
|
|
313
321
|
super.clearInputText();
|
|
314
322
|
// Directly remove all chips from DOM since not all chip types support the 'removed' event
|
|
315
323
|
// In uncontrolled mode, removeChip handles DOM removal.
|
|
@@ -368,6 +376,8 @@ class Searchfield extends ControlTypeMixin(KeyDownHandledMixin(Input)) {
|
|
|
368
376
|
* @internal
|
|
369
377
|
*/
|
|
370
378
|
removeChipAtIndex(index) {
|
|
379
|
+
if (this.disabled || this.softDisabled || this.readonly)
|
|
380
|
+
return;
|
|
371
381
|
if (!this.chips || index < 0 || index >= this.chips.length)
|
|
372
382
|
return;
|
|
373
383
|
const chip = this.chips[index];
|
|
@@ -22,6 +22,8 @@ import type { SkeletonVariant } from './skeleton.types';
|
|
|
22
22
|
*
|
|
23
23
|
* @slot - Content to wrap (optional). When provided, skeleton takes dimensions of this content.
|
|
24
24
|
*
|
|
25
|
+
* @cssproperty --mdc-skeleton-animation-delay - Delay of the two-second shimmer cycle (default: 0s).
|
|
26
|
+
* Use a negative CSS time to start partway through the cycle and align instances with application-managed timing.
|
|
25
27
|
* @cssproperty --mdc-skeleton-background-color - background color of the skeleton
|
|
26
28
|
* @cssproperty --mdc-skeleton-height - height of the skeleton
|
|
27
29
|
* @cssproperty --mdc-skeleton-width - width of the skeleton
|
|
@@ -17,6 +17,8 @@ import styles from './skeleton.styles';
|
|
|
17
17
|
*
|
|
18
18
|
* @slot - Content to wrap (optional). When provided, skeleton takes dimensions of this content.
|
|
19
19
|
*
|
|
20
|
+
* @cssproperty --mdc-skeleton-animation-delay - Delay of the two-second shimmer cycle (default: 0s).
|
|
21
|
+
* Use a negative CSS time to start partway through the cycle and align instances with application-managed timing.
|
|
20
22
|
* @cssproperty --mdc-skeleton-background-color - background color of the skeleton
|
|
21
23
|
* @cssproperty --mdc-skeleton-height - height of the skeleton
|
|
22
24
|
* @cssproperty --mdc-skeleton-width - width of the skeleton
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
const styles = css `
|
|
3
3
|
:host {
|
|
4
|
+
--mdc-skeleton-animation-delay: 0s;
|
|
4
5
|
--mdc-skeleton-background-color: var(--mds-color-theme-background-skeleton-normal);
|
|
5
6
|
--mdc-skeleton-height: 100%;
|
|
6
7
|
--mdc-skeleton-width: 100%;
|
|
8
|
+
position: relative;
|
|
7
9
|
display: block;
|
|
8
10
|
overflow: hidden;
|
|
9
11
|
background-color: var(--mdc-skeleton-background-color);
|
|
@@ -11,32 +13,38 @@ const styles = css `
|
|
|
11
13
|
width: var(--mdc-skeleton-width);
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
:host([motion]) {
|
|
16
|
+
:host([motion])::before {
|
|
17
|
+
content: '';
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 0;
|
|
20
|
+
left: 0;
|
|
21
|
+
width: 200%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
pointer-events: none;
|
|
15
24
|
background-image: linear-gradient(
|
|
16
25
|
90deg,
|
|
17
26
|
var(--mds-color-theme-background-skeleton-shimmer-0) 0%,
|
|
18
27
|
var(--mds-color-theme-background-skeleton-shimmer-1) 50%,
|
|
19
28
|
var(--mds-color-theme-background-skeleton-shimmer-2) 100%
|
|
20
29
|
);
|
|
21
|
-
background-repeat: no-repeat;
|
|
22
|
-
background-size: 200% 100%;
|
|
23
30
|
animation: skeleton-shimmer 2s linear infinite;
|
|
31
|
+
animation-delay: var(--mdc-skeleton-animation-delay);
|
|
24
32
|
}
|
|
25
33
|
|
|
26
34
|
@media (prefers-reduced-motion: reduce) {
|
|
27
|
-
:host([motion]) {
|
|
35
|
+
:host([motion])::before {
|
|
28
36
|
animation: none;
|
|
29
|
-
|
|
37
|
+
transform: translateX(-25%);
|
|
30
38
|
}
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
@keyframes skeleton-shimmer {
|
|
34
42
|
0% {
|
|
35
|
-
|
|
43
|
+
transform: translateX(-100%);
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
100% {
|
|
39
|
-
|
|
47
|
+
transform: translateX(100%);
|
|
40
48
|
}
|
|
41
49
|
}
|
|
42
50
|
|
|
@@ -190,11 +190,6 @@ declare class Slider extends Slider_base {
|
|
|
190
190
|
* @param evt - The event to prevent.
|
|
191
191
|
*/
|
|
192
192
|
private handleKeyEvent;
|
|
193
|
-
/**
|
|
194
|
-
* Sets the soft-disabled state for the slider.
|
|
195
|
-
* Applies the appropriate ARIA attributes.
|
|
196
|
-
*/
|
|
197
|
-
private setSoftDisabled;
|
|
198
193
|
/**
|
|
199
194
|
* Initializes the range slider by setting default values for the start and end handles.
|
|
200
195
|
* Updates the slider's input elements to reflect the current values.
|
|
@@ -228,6 +223,7 @@ declare class Slider extends Slider_base {
|
|
|
228
223
|
* The track is filled between the two thumbs.
|
|
229
224
|
*/
|
|
230
225
|
updateTrackStyling(): void;
|
|
226
|
+
private preventSoftDisabledChange;
|
|
231
227
|
/**
|
|
232
228
|
* Handles the input event for the single value slider.
|
|
233
229
|
* @param e - The input event.
|