@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.
@@ -83,6 +83,7 @@ class Slider extends KeyDownHandledMixin(KeyToActionMixin(Component)) {
83
83
  this.spatialNavEditMode = false;
84
84
  this.addEventListener('keydown', this.handleKeyEvent.bind(this));
85
85
  this.addEventListener('mousedown', this.preventChange.bind(this));
86
+ this.addEventListener('pointerdown', this.preventChange.bind(this));
86
87
  }
87
88
  updated(changedProperties) {
88
89
  super.updated(changedProperties);
@@ -97,9 +98,6 @@ class Slider extends KeyDownHandledMixin(KeyToActionMixin(Component)) {
97
98
  changedProperties.has('valueEnd')) {
98
99
  this.updateTrackStyling();
99
100
  }
100
- if (changedProperties.has('softDisabled')) {
101
- this.setSoftDisabled();
102
- }
103
101
  if (changedProperties.has('range') || changedProperties.has('valueStart') || changedProperties.has('valueEnd')) {
104
102
  this.initializeRangeSlider();
105
103
  }
@@ -123,9 +121,14 @@ class Slider extends KeyDownHandledMixin(KeyToActionMixin(Component)) {
123
121
  handleKeyEvent(evt) {
124
122
  var _a;
125
123
  const action = this.getActionForKeyEvent(evt);
124
+ if (this.softDisabled) {
125
+ if (action !== ACTIONS.TAB) {
126
+ evt.preventDefault();
127
+ evt.stopPropagation();
128
+ }
129
+ return;
130
+ }
126
131
  if (this.getKeyboardNavMode() === NAV_MODES.SPATIAL) {
127
- if (this.softDisabled)
128
- return;
129
132
  const activeElement = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement;
130
133
  const isInputFocused = (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'INPUT';
131
134
  evt.preventDefault();
@@ -157,25 +160,6 @@ class Slider extends KeyDownHandledMixin(KeyToActionMixin(Component)) {
157
160
  }
158
161
  }
159
162
  }
160
- else if (this.softDisabled && action !== ACTIONS.TAB) {
161
- evt.preventDefault();
162
- evt.stopPropagation();
163
- }
164
- }
165
- /**
166
- * Sets the soft-disabled state for the slider.
167
- * Applies the appropriate ARIA attributes.
168
- */
169
- setSoftDisabled() {
170
- this.inputElements.forEach(input => {
171
- const inputElement = input;
172
- if (this.softDisabled) {
173
- inputElement.setAttribute('aria-disabled', 'true');
174
- }
175
- else {
176
- inputElement.removeAttribute('aria-disabled');
177
- }
178
- });
179
163
  }
180
164
  /**
181
165
  * Initializes the range slider by setting default values for the start and end handles.
@@ -322,11 +306,26 @@ class Slider extends KeyDownHandledMixin(KeyToActionMixin(Component)) {
322
306
  this.inputElements[0].style.background = `linear-gradient(to right, ${progressColor} ${progress}%, ${trackColor} ${progress}%)`;
323
307
  }
324
308
  }
309
+ preventSoftDisabledChange(event) {
310
+ var _a, _b, _c;
311
+ if (!this.softDisabled)
312
+ return false;
313
+ const input = event.currentTarget;
314
+ let value = (_a = this.value) !== null && _a !== void 0 ? _a : this.min;
315
+ if (this.range) {
316
+ value = input.id === 'start-slider' ? ((_b = this.valueStart) !== null && _b !== void 0 ? _b : this.min) : ((_c = this.valueEnd) !== null && _c !== void 0 ? _c : this.max);
317
+ }
318
+ input.value = String(value);
319
+ event.stopImmediatePropagation();
320
+ return true;
321
+ }
325
322
  /**
326
323
  * Handles the input event for the single value slider.
327
324
  * @param e - The input event.
328
325
  */
329
326
  onInput(e) {
327
+ if (this.preventSoftDisabledChange(e))
328
+ return;
330
329
  const input = e.target;
331
330
  this.handleInput(input);
332
331
  }
@@ -335,6 +334,8 @@ class Slider extends KeyDownHandledMixin(KeyToActionMixin(Component)) {
335
334
  * @param e - The change event.
336
335
  */
337
336
  onChange(e) {
337
+ if (this.preventSoftDisabledChange(e))
338
+ return;
338
339
  const input = e.target;
339
340
  this.value = Number(input.value);
340
341
  this.dispatchEvent(new CustomEvent('change', { detail: { value: this.value } }));
@@ -344,6 +345,8 @@ class Slider extends KeyDownHandledMixin(KeyToActionMixin(Component)) {
344
345
  * @param e - The change event.
345
346
  */
346
347
  onChangeStart(e) {
348
+ if (this.preventSoftDisabledChange(e))
349
+ return;
347
350
  const input = e.target;
348
351
  this.valueStart = Number(input.value);
349
352
  this.dispatchEvent(new CustomEvent('change', { detail: { valueStart: this.valueStart, valueEnd: this.valueEnd } }));
@@ -353,6 +356,8 @@ class Slider extends KeyDownHandledMixin(KeyToActionMixin(Component)) {
353
356
  * @param e - The change event.
354
357
  */
355
358
  onChangeEnd(e) {
359
+ if (this.preventSoftDisabledChange(e))
360
+ return;
356
361
  const input = e.target;
357
362
  this.valueEnd = Number(input.value);
358
363
  this.dispatchEvent(new CustomEvent('change', { detail: { valueEnd: this.valueEnd, valueStart: this.valueStart } }));
@@ -419,6 +424,7 @@ class Slider extends KeyDownHandledMixin(KeyToActionMixin(Component)) {
419
424
  step="${(_a = this.step) !== null && _a !== void 0 ? _a : 1}"
420
425
  .value="${String((_b = this.valueStart) !== null && _b !== void 0 ? _b : this.min)}"
421
426
  ?disabled="${this.disabled}"
427
+ aria-disabled="${this.disabled || this.softDisabled || false}"
422
428
  name="${(_c = this.nameStart) !== null && _c !== void 0 ? _c : ''}"
423
429
  aria-valuemin="${this.min}"
424
430
  aria-valuemax="${this.max}"
@@ -456,6 +462,7 @@ class Slider extends KeyDownHandledMixin(KeyToActionMixin(Component)) {
456
462
  step="${(_e = this.step) !== null && _e !== void 0 ? _e : 1}"
457
463
  .value="${String((_f = this.valueEnd) !== null && _f !== void 0 ? _f : this.max)}"
458
464
  ?disabled="${this.disabled}"
465
+ aria-disabled="${this.disabled || this.softDisabled || false}"
459
466
  name="${(_g = this.nameEnd) !== null && _g !== void 0 ? _g : ''}"
460
467
  aria-valuemin="${this.min}"
461
468
  aria-valuemax="${this.max}"
@@ -495,6 +502,7 @@ class Slider extends KeyDownHandledMixin(KeyToActionMixin(Component)) {
495
502
  step="${(_j = this.step) !== null && _j !== void 0 ? _j : 1}"
496
503
  .value="${String((_k = this.value) !== null && _k !== void 0 ? _k : this.min)}"
497
504
  ?disabled="${this.disabled}"
505
+ aria-disabled="${this.disabled || this.softDisabled || false}"
498
506
  name="${(_l = this.name) !== null && _l !== void 0 ? _l : ''}"
499
507
  aria-valuemin="${this.min}"
500
508
  aria-valuemax="${this.max}"
@@ -110,7 +110,7 @@ class Textarea extends CharacterLimitMixin(KeyDownHandledMixin(KeyToActionMixin(
110
110
  * @param event - The pointer event.
111
111
  */
112
112
  this.handlePointerDown = (event) => {
113
- if (this.readonly) {
113
+ if (this.disabled || this.softDisabled || this.readonly) {
114
114
  return;
115
115
  }
116
116
  const resizeButton = event.currentTarget;
@@ -129,6 +129,8 @@ class Textarea extends CharacterLimitMixin(KeyDownHandledMixin(KeyToActionMixin(
129
129
  * @param event - The pointer event.
130
130
  */
131
131
  this.handlePointerMove = (event) => {
132
+ if (this.disabled || this.softDisabled || this.readonly)
133
+ return;
132
134
  if (!this.textarea)
133
135
  return;
134
136
  const deltaY = event.clientY - this.resizeStartY;
@@ -241,7 +243,9 @@ class Textarea extends CharacterLimitMixin(KeyDownHandledMixin(KeyToActionMixin(
241
243
  * Sets the form value.
242
244
  * @returns void
243
245
  */
244
- updateValue() {
246
+ updateValue(event) {
247
+ if (this.preventSoftDisabledChange(event, this.value))
248
+ return;
245
249
  this.value = this.textarea.value;
246
250
  this.internals.setFormValue(this.textarea.value);
247
251
  this.announceCharacterLimitWarning();
@@ -257,7 +261,9 @@ class Textarea extends CharacterLimitMixin(KeyDownHandledMixin(KeyToActionMixin(
257
261
  * @param event - Event which contains information about the value change.
258
262
  */
259
263
  onChange(event) {
260
- this.updateValue();
264
+ if (this.preventSoftDisabledChange(event, this.value))
265
+ return;
266
+ this.updateValue(event);
261
267
  const EventConstructor = event.constructor;
262
268
  this.dispatchEvent(new EventConstructor(event.type, event));
263
269
  }
@@ -272,7 +278,7 @@ class Textarea extends CharacterLimitMixin(KeyDownHandledMixin(KeyToActionMixin(
272
278
  * @param event - The keyboard event.
273
279
  */
274
280
  handleResizeKeyDown(event) {
275
- if (this.readonly) {
281
+ if (this.disabled || this.softDisabled || this.readonly) {
276
282
  return;
277
283
  }
278
284
  const currentRows = this.rows || DEFAULTS.ROWS;
@@ -307,6 +313,7 @@ class Textarea extends CharacterLimitMixin(KeyDownHandledMixin(KeyToActionMixin(
307
313
  .value="${this.value}"
308
314
  ?disabled="${this.disabled}"
309
315
  ?readonly="${this.readonly}"
316
+ aria-disabled="${this.disabled || this.softDisabled}"
310
317
  ?required="${this.required}"
311
318
  placeholder=${ifDefined(this.placeholder)}
312
319
  rows=${ifDefined(this.rows)}
@@ -317,6 +324,7 @@ class Textarea extends CharacterLimitMixin(KeyDownHandledMixin(KeyToActionMixin(
317
324
  minlength=${ifDefined(this.minlength)}
318
325
  maxlength=${ifDefined(this.maxlength)}
319
326
  dirname=${ifDefined(this.dirname)}
327
+ @beforeinput=${this.preventSoftDisabledInput}
320
328
  @input=${this.updateValue}
321
329
  @change=${this.onChange}
322
330
  aria-describedby="${ifDefined(this.helpText ? FORMFIELD_DEFAULTS.HELPER_TEXT_ID : '')}"
@@ -337,7 +345,8 @@ class Textarea extends CharacterLimitMixin(KeyDownHandledMixin(KeyToActionMixin(
337
345
  size="24"
338
346
  prefix-icon="resize-corner-regular"
339
347
  aria-label=${(_b = this.resizeButtonAriaLabel) !== null && _b !== void 0 ? _b : ''}
340
- ?disabled="${this.disabled || this.readonly}"
348
+ ?disabled="${this.disabled || this.softDisabled || this.readonly}"
349
+ ?soft-disabled="${this.softDisabled}"
341
350
  @keydown=${this.handleResizeKeyDown}
342
351
  @pointerdown=${this.handlePointerDown}
343
352
  ></mdc-button>
@@ -191,6 +191,10 @@ class TimePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
191
191
  changedProperties.has('readonly')) {
192
192
  if (this.disabled || this.softDisabled || this.readonly) {
193
193
  this.displayPopover = false;
194
+ if (this.pendingDigitTimeout)
195
+ clearTimeout(this.pendingDigitTimeout);
196
+ this.pendingDigits = '';
197
+ this.parseValueToInternal();
194
198
  }
195
199
  }
196
200
  }
@@ -326,6 +330,8 @@ class TimePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
326
330
  * @internal
327
331
  */
328
332
  commitValue() {
333
+ if (this.disabled || this.softDisabled || this.readonly)
334
+ return;
329
335
  const newValue = this.internalToValue();
330
336
  if (newValue && newValue !== this.value) {
331
337
  this.value = newValue;
@@ -380,6 +386,8 @@ class TimePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
380
386
  */
381
387
  handleOptionClick(optionValue) {
382
388
  var _a;
389
+ if (this.disabled || this.softDisabled || this.readonly)
390
+ return;
383
391
  this.value = optionValue;
384
392
  this.parseValueToInternal();
385
393
  this.displayPopover = false;
@@ -510,6 +518,11 @@ class TimePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
510
518
  */
511
519
  handlePeriodKeydown(event) {
512
520
  var _a, _b;
521
+ if (this.disabled || this.softDisabled || this.readonly) {
522
+ if (event.key === KEYS.ARROW_UP || event.key === KEYS.ARROW_DOWN)
523
+ event.preventDefault();
524
+ return;
525
+ }
513
526
  switch (event.key) {
514
527
  case KEYS.ARROW_UP:
515
528
  case KEYS.ARROW_DOWN:
@@ -551,6 +564,11 @@ class TimePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
551
564
  */
552
565
  handleSpinbuttonKeydown(event, field) {
553
566
  var _a, _b, _c, _d, _e, _f;
567
+ if (this.disabled || this.softDisabled || this.readonly) {
568
+ if (event.key === KEYS.ARROW_UP || event.key === KEYS.ARROW_DOWN)
569
+ event.preventDefault();
570
+ return;
571
+ }
554
572
  const is12h = this.timeFormat === TIME_FORMAT.TWELVE_HOUR;
555
573
  let minVal;
556
574
  let maxVal;
@@ -795,7 +813,10 @@ class TimePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
795
813
  placeholder="${this.hoursPlaceholder}"
796
814
  ?disabled="${this.disabled}"
797
815
  ?readonly="${this.readonly}"
816
+ aria-disabled="${this.disabled || this.softDisabled}"
817
+ @beforeinput="${this.preventSoftDisabledInput}"
798
818
  tabindex="${this.disabled ? '-1' : '0'}"
819
+ @input="${(event) => this.preventSoftDisabledChange(event, this.internalHours)}"
799
820
  @keydown="${this.handleHoursKeydown}"
800
821
  @focus="${this.handleSpinbuttonFocus}"
801
822
  />
@@ -813,7 +834,10 @@ class TimePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
813
834
  placeholder="${this.minutesPlaceholder}"
814
835
  ?disabled="${this.disabled}"
815
836
  ?readonly="${this.readonly}"
837
+ aria-disabled="${this.disabled || this.softDisabled}"
838
+ @beforeinput="${this.preventSoftDisabledInput}"
816
839
  tabindex="${this.disabled ? '-1' : '0'}"
840
+ @input="${(event) => this.preventSoftDisabledChange(event, this.internalMinutes)}"
817
841
  @keydown="${this.handleMinutesKeydown}"
818
842
  @focus="${this.handleSpinbuttonFocus}"
819
843
  />
@@ -830,7 +854,10 @@ class TimePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
830
854
  placeholder="${this.periodPlaceholder}"
831
855
  ?disabled="${this.disabled}"
832
856
  ?readonly="${this.readonly}"
857
+ aria-disabled="${this.disabled || this.softDisabled}"
858
+ @beforeinput="${this.preventSoftDisabledInput}"
833
859
  tabindex="${this.disabled ? '-1' : '0'}"
860
+ @input="${(event) => this.preventSoftDisabledChange(event, this.displayPeriod || '')}"
834
861
  @keydown="${this.handlePeriodKeydown}"
835
862
  @focus="${this.handleSpinbuttonFocus}"
836
863
  />
@@ -846,6 +873,7 @@ class TimePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
846
873
  aria-expanded="${this.displayPopover ? 'true' : 'false'}"
847
874
  aria-haspopup="true"
848
875
  ?disabled="${this.disabled}"
876
+ ?soft-disabled="${this.softDisabled}"
849
877
  size="20"
850
878
  @click="${this.handleDropdownClick}"
851
879
  ></mdc-button>
@@ -158,6 +158,10 @@ class Toggle extends KeyToActionMixin(ControlTypeMixin(AutoFocusOnMountMixin(For
158
158
  handleKeyDown(event) {
159
159
  var _a;
160
160
  const action = this.getActionForKeyEvent(event);
161
+ if (this.softDisabled && action === ACTIONS.ENTER) {
162
+ event.preventDefault();
163
+ return;
164
+ }
161
165
  if ((this.readonly || this.softDisabled) && action === ACTIONS.SPACE) {
162
166
  event.preventDefault();
163
167
  }
@@ -217,6 +221,7 @@ class Toggle extends KeyToActionMixin(ControlTypeMixin(AutoFocusOnMountMixin(For
217
221
  value="${ifDefined(this.value)}"
218
222
  .checked="${this.checked}"
219
223
  aria-checked="${this.checked}"
224
+ aria-disabled="${this.disabled || this.softDisabled}"
220
225
  .disabled="${this.disabled}"
221
226
  ?readonly="${this.readonly}"
222
227
  aria-describedby="${ifDefined(this.helpText ? FORMFIELD_DEFAULTS.HELPER_TEXT_ID : '')}"
@@ -47338,6 +47338,10 @@
47338
47338
  "description": "",
47339
47339
  "name": "Skeleton",
47340
47340
  "cssProperties": [
47341
+ {
47342
+ "description": "Delay of the two-second shimmer cycle (default: 0s). Use a negative CSS time to start partway through the cycle and align instances with application-managed timing.",
47343
+ "name": "--mdc-skeleton-animation-delay"
47344
+ },
47341
47345
  {
47342
47346
  "description": "background color of the skeleton",
47343
47347
  "name": "--mdc-skeleton-background-color"
@@ -47416,7 +47420,7 @@
47416
47420
  "module": "/src/models"
47417
47421
  },
47418
47422
  "tagName": "mdc-skeleton",
47419
- "jsDoc": "/**\n * @tagname mdc-skeleton\n *\n * @slot - Content to wrap (optional). When provided, skeleton takes dimensions of this content.\n *\n * @cssproperty --mdc-skeleton-background-color - background color of the skeleton\n * @cssproperty --mdc-skeleton-height - height of the skeleton\n * @cssproperty --mdc-skeleton-width - width of the skeleton\n */",
47423
+ "jsDoc": "/**\n * @tagname mdc-skeleton\n *\n * @slot - Content to wrap (optional). When provided, skeleton takes dimensions of this content.\n *\n * @cssproperty --mdc-skeleton-animation-delay - Delay of the two-second shimmer cycle (default: 0s).\n * Use a negative CSS time to start partway through the cycle and align instances with application-managed timing.\n * @cssproperty --mdc-skeleton-background-color - background color of the skeleton\n * @cssproperty --mdc-skeleton-height - height of the skeleton\n * @cssproperty --mdc-skeleton-width - width of the skeleton\n */",
47420
47424
  "customElement": true
47421
47425
  }
47422
47426
  ],
@@ -47821,6 +47825,24 @@
47821
47825
  ],
47822
47826
  "description": "Prevents default behavior for mouse and keyboard events.\nThis prevents user interaction with the slider when it is soft-disabled."
47823
47827
  },
47828
+ {
47829
+ "kind": "method",
47830
+ "name": "preventSoftDisabledChange",
47831
+ "privacy": "private",
47832
+ "return": {
47833
+ "type": {
47834
+ "text": "boolean"
47835
+ }
47836
+ },
47837
+ "parameters": [
47838
+ {
47839
+ "name": "event",
47840
+ "type": {
47841
+ "text": "Event"
47842
+ }
47843
+ }
47844
+ ]
47845
+ },
47824
47846
  {
47825
47847
  "kind": "field",
47826
47848
  "name": "range",
@@ -47837,12 +47859,6 @@
47837
47859
  "name": "renderTicks",
47838
47860
  "privacy": "private"
47839
47861
  },
47840
- {
47841
- "kind": "method",
47842
- "name": "setSoftDisabled",
47843
- "privacy": "private",
47844
- "description": "Sets the soft-disabled state for the slider.\nApplies the appropriate ARIA attributes."
47845
- },
47846
47862
  {
47847
47863
  "kind": "field",
47848
47864
  "name": "softDisabled",
@@ -51920,6 +51936,14 @@
51920
51936
  "kind": "method",
51921
51937
  "name": "updateValue",
51922
51938
  "privacy": "private",
51939
+ "parameters": [
51940
+ {
51941
+ "name": "event",
51942
+ "type": {
51943
+ "text": "Event"
51944
+ }
51945
+ }
51946
+ ],
51923
51947
  "description": "Updates the value of the textarea field.\nSets the form value.",
51924
51948
  "return": {
51925
51949
  "type": {
@@ -19,6 +19,8 @@ import Component from '../../components/skeleton';
19
19
  *
20
20
  * @slot - Content to wrap (optional). When provided, skeleton takes dimensions of this content.
21
21
  *
22
+ * @cssproperty --mdc-skeleton-animation-delay - Delay of the two-second shimmer cycle (default: 0s).
23
+ * Use a negative CSS time to start partway through the cycle and align instances with application-managed timing.
22
24
  * @cssproperty --mdc-skeleton-background-color - background color of the skeleton
23
25
  * @cssproperty --mdc-skeleton-height - height of the skeleton
24
26
  * @cssproperty --mdc-skeleton-width - width of the skeleton
@@ -7,6 +7,8 @@ import { TAG_NAME } from '../../components/skeleton/skeleton.constants';
7
7
  *
8
8
  * @slot - Content to wrap (optional). When provided, skeleton takes dimensions of this content.
9
9
  *
10
+ * @cssproperty --mdc-skeleton-animation-delay - Delay of the two-second shimmer cycle (default: 0s).
11
+ * Use a negative CSS time to start partway through the cycle and align instances with application-managed timing.
10
12
  * @cssproperty --mdc-skeleton-background-color - background color of the skeleton
11
13
  * @cssproperty --mdc-skeleton-height - height of the skeleton
12
14
  * @cssproperty --mdc-skeleton-width - width of the skeleton
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@momentum-design/components",
3
3
  "packageManager": "yarn@3.2.4",
4
- "version": "0.141.1",
4
+ "version": "0.141.3",
5
5
  "engines": {
6
6
  "node": ">=24.0.0",
7
7
  "npm": ">=8.0.0"