@momentum-design/components 0.133.8 → 0.133.10

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.
@@ -272,11 +272,11 @@
272
272
  --mdc-button-text-color: var(--mds-color-theme-common-text-primary-normal);
273
273
  --mdc-button-background: var(--mds-color-theme-button-accent-normal);
274
274
  }
275
- :host([color='accent'][variant='primary']:hover) {
275
+ :host([color='accent'][variant='primary']:hover:not([disabled]):not([soft-disabled])) {
276
276
  --mdc-button-background: var(--mds-color-theme-button-accent-hover);
277
277
  }
278
- :host([color='accent'][variant='primary']:active),
279
- :host([color='accent'][variant='primary'].pressed) {
278
+ :host([color='accent'][variant='primary']:active:not([disabled]):not([soft-disabled])),
279
+ :host([color='accent'][variant='primary'].pressed:not([disabled]):not([soft-disabled])) {
280
280
  --mdc-button-background: var(--mds-color-theme-button-accent-pressed);
281
281
  }
282
282
 
@@ -284,11 +284,11 @@
284
284
  --mdc-button-text-color: var(--mds-color-theme-text-accent-normal);
285
285
  --mdc-button-border-color: var(--mds-color-theme-outline-theme-normal);
286
286
  }
287
- :host([color='accent'][variant='secondary']:hover) {
287
+ :host([color='accent'][variant='secondary']:hover:not([disabled]):not([soft-disabled])) {
288
288
  --mdc-button-background: var(--mds-color-theme-button-secondary-hover);
289
289
  }
290
- :host([color='accent'][variant='secondary']:active),
291
- :host([color='accent'][variant='secondary'].pressed) {
290
+ :host([color='accent'][variant='secondary']:active:not([disabled]):not([soft-disabled])),
291
+ :host([color='accent'][variant='secondary'].pressed:not([disabled]):not([soft-disabled])) {
292
292
  --mdc-button-background: var(--mds-color-theme-button-secondary-pressed);
293
293
  }
294
294
 
@@ -296,11 +296,11 @@
296
296
  --mdc-button-text-color: var(--mds-color-theme-common-text-primary-normal);
297
297
  --mdc-button-background: var(--mds-color-theme-button-join-normal);
298
298
  }
299
- :host([color='positive'][variant='primary']:hover) {
299
+ :host([color='positive'][variant='primary']:hover:not([disabled]):not([soft-disabled])) {
300
300
  --mdc-button-background: var(--mds-color-theme-button-join-hover);
301
301
  }
302
- :host([color='positive'][variant='primary']:active),
303
- :host([color='positive'][variant='primary'].pressed) {
302
+ :host([color='positive'][variant='primary']:active:not([disabled]):not([soft-disabled])),
303
+ :host([color='positive'][variant='primary'].pressed:not([disabled]):not([soft-disabled])) {
304
304
  --mdc-button-background: var(--mds-color-theme-button-join-pressed);
305
305
  }
306
306
 
@@ -308,11 +308,11 @@
308
308
  --mdc-button-text-color: var(--mds-color-theme-text-success-normal);
309
309
  --mdc-button-border-color: var(--mds-color-theme-outline-join-normal);
310
310
  }
311
- :host([color='positive'][variant='secondary']:hover) {
311
+ :host([color='positive'][variant='secondary']:hover:not([disabled]):not([soft-disabled])) {
312
312
  --mdc-button-background: var(--mds-color-theme-button-secondary-hover);
313
313
  }
314
- :host([color='positive'][variant='secondary']:active),
315
- :host([color='positive'][variant='secondary'].pressed) {
314
+ :host([color='positive'][variant='secondary']:active:not([disabled]):not([soft-disabled])),
315
+ :host([color='positive'][variant='secondary'].pressed:not([disabled]):not([soft-disabled])) {
316
316
  --mdc-button-background: var(--mds-color-theme-button-secondary-pressed);
317
317
  }
318
318
 
@@ -320,11 +320,11 @@
320
320
  --mdc-button-text-color: var(--mds-color-theme-common-text-primary-normal);
321
321
  --mdc-button-background: var(--mds-color-theme-button-cancel-normal);
322
322
  }
323
- :host([color='negative'][variant='primary']:hover) {
323
+ :host([color='negative'][variant='primary']:hover:not([disabled]):not([soft-disabled])) {
324
324
  --mdc-button-background: var(--mds-color-theme-button-cancel-hover);
325
325
  }
326
- :host([color='negative'][variant='primary']:active),
327
- :host([color='negative'][variant='primary'].pressed) {
326
+ :host([color='negative'][variant='primary']:active:not([disabled]):not([soft-disabled])),
327
+ :host([color='negative'][variant='primary'].pressed:not([disabled]):not([soft-disabled])) {
328
328
  --mdc-button-background: var(--mds-color-theme-button-cancel-pressed);
329
329
  }
330
330
 
@@ -332,11 +332,11 @@
332
332
  --mdc-button-text-color: var(--mds-color-theme-text-error-normal);
333
333
  --mdc-button-border-color: var(--mds-color-theme-outline-cancel-normal);
334
334
  }
335
- :host([color='negative'][variant='secondary']:hover) {
335
+ :host([color='negative'][variant='secondary']:hover:not([disabled]):not([soft-disabled])) {
336
336
  --mdc-button-background: var(--mds-color-theme-button-secondary-hover);
337
337
  }
338
- :host([color='negative'][variant='secondary']:active),
339
- :host([color='negative'][variant='secondary'].pressed) {
338
+ :host([color='negative'][variant='secondary']:active:not([disabled]):not([soft-disabled])),
339
+ :host([color='negative'][variant='secondary'].pressed:not([disabled]):not([soft-disabled])) {
340
340
  --mdc-button-background: var(--mds-color-theme-button-secondary-pressed);
341
341
  }
342
342
 
@@ -344,11 +344,11 @@
344
344
  --mdc-button-text-color: var(--mds-color-theme-common-text-primary-normal);
345
345
  --mdc-button-background: var(--mds-color-theme-common-button-promotion-normal);
346
346
  }
347
- :host([color='promotional'][variant='primary']:hover) {
347
+ :host([color='promotional'][variant='primary']:hover:not([disabled]):not([soft-disabled])) {
348
348
  --mdc-button-background: var(--mds-color-theme-common-button-promotion-hover);
349
349
  }
350
- :host([color='promotional'][variant='primary']:active),
351
- :host([color='promotional'][variant='primary'].pressed) {
350
+ :host([color='promotional'][variant='primary']:active:not([disabled]):not([soft-disabled])),
351
+ :host([color='promotional'][variant='primary'].pressed:not([disabled]):not([soft-disabled])) {
352
352
  --mdc-button-background: var(--mds-color-theme-common-button-promotion-active);
353
353
  }
354
354
 
@@ -356,11 +356,11 @@
356
356
  --mdc-button-text-color: var(--mds-color-theme-text-primary-normal);
357
357
  --mdc-button-border-color: var(--mds-color-theme-outline-promotion-normal);
358
358
  }
359
- :host([color='promotional'][variant='secondary']:hover) {
359
+ :host([color='promotional'][variant='secondary']:hover:not([disabled]):not([soft-disabled])) {
360
360
  --mdc-button-background: var(--mds-color-theme-button-secondary-hover);
361
361
  }
362
- :host([color='promotional'][variant='secondary']:active),
363
- :host([color='promotional'][variant='secondary'].pressed) {
362
+ :host([color='promotional'][variant='secondary']:active:not([disabled]):not([soft-disabled])),
363
+ :host([color='promotional'][variant='secondary'].pressed:not([disabled]):not([soft-disabled])) {
364
364
  --mdc-button-background: var(--mds-color-theme-button-secondary-pressed);
365
365
  }
366
366
 
@@ -7003,7 +7003,7 @@
7003
7003
  --mdc-timepicker-text-color: var(--mds-color-theme-text-primary-disabled);
7004
7004
  color: var(--mds-color-theme-text-primary-disabled);
7005
7005
  }
7006
- `,My=[HS,...yt(!0)];var Rt=class extends ce(re(Zt)){constructor(){super(...arguments);this.timeFormat=$e.TIME_FORMAT;this.interval=$e.INTERVAL;this.placement=Mt.BOTTOM_START;this.strategy=Et.STRATEGY;this.disableFlip=$e.DISABLE_FLIP;this.localeHoursLabel="";this.localeMinutesLabel="";this.localePeriodLabel="";this.localeHoursPlaceholder="";this.localeMinutesPlaceholder="";this.localePeriodPlaceholder="";this.localeAmLabel="";this.localePmLabel="";this.localeShowTimePickerLabel="";this.localeTimeOptionsLabel="";this.localeSpinbuttonDescription="";this.displayPopover=!1;this.internalHours="";this.internalMinutes="";this.internalPeriod="AM";this.focusedOptionIndex=-1;this.pendingDigits=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.parseValueToInternal(),this.syncFormValue()}).catch(t=>{this.onerror&&this.onerror(t)})}disconnectedCallback(){super.disconnectedCallback(),this.pendingDigitTimeout&&clearTimeout(this.pendingDigitTimeout)}willUpdate(t){super.willUpdate(t),t.has("value")&&!this.displayPopover&&(this.parseValueToInternal(),this.syncFormValue()),(t.has("disabled")||t.has("softDisabled")||t.has("readonly"))&&(this.disabled||this.softDisabled||this.readonly)&&(this.displayPopover=!1)}updated(t){super.updated(t),t.has("displayPopover")&&this.displayPopover&&this.focusMenuItemOnOpen()}focusMenuItemOnOpen(){let t=this.getTimeOptions(),e=this.internalToValue(),o=t.findIndex(l=>l.value===e);this.focusedOptionIndex=o>=0?o:0,this.updateComplete.then(()=>{this.focusCurrentMenuItem()}).catch(()=>{})}focusCurrentMenuItem(){var o;let t=(o=this.shadowRoot)==null?void 0:o.querySelector(`#${gm}`);if(!t)return;let e=t.querySelectorAll("mdc-option");e[this.focusedOptionIndex]&&e[this.focusedOptionIndex].focus()}formResetCallback(){this.value="",this.internalHours="",this.internalMinutes="",this.internalPeriod="AM",this.syncFormValue(),this.requestUpdate()}formStateRestoreCallback(t){this.value=t,this.parseValueToInternal()}parseValueToInternal(){if(!this.value){this.internalHours="",this.internalMinutes="",this.internalPeriod="AM";return}let t=this.value.match(/^(\d{1,2}):(\d{2})$/);if(!t)return;let e=parseInt(t[1],10),o=parseInt(t[2],10);e<0||e>23||o<0||o>59||(this.internalMinutes=String(o).padStart(2,"0"),this.timeFormat===_o.TWELVE_HOUR?e===0?(this.internalPeriod="AM",this.internalHours="12"):e<12?(this.internalPeriod="AM",this.internalHours=String(e).padStart(2,"0")):e===12?(this.internalPeriod="PM",this.internalHours="12"):(this.internalPeriod="PM",this.internalHours=String(e-12).padStart(2,"0")):this.internalHours=String(e).padStart(2,"0"))}internalToValue(){if(!this.internalHours||!this.internalMinutes)return"";let t=parseInt(this.internalHours,10);return this.timeFormat===_o.TWELVE_HOUR&&(this.internalPeriod==="AM"?t=t===12?0:t:t=t===12?12:t+12),`${String(t).padStart(2,"0")}:${this.internalMinutes}`}syncFormValue(){let t=this.internalToValue();this.internals.setFormValue(t||this.value)}commitValue(){let t=this.internalToValue();t&&t!==this.value&&(this.value=t,this.syncFormValue(),this.dispatchEvent(new CustomEvent("input",{detail:{value:this.value},composed:!0,bubbles:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},composed:!0,bubbles:!0})))}getTimeOptions(){let t=[],e=Math.max(1,Math.min(this.interval,60));for(let o=0;o<24*60;o+=e){let l=Math.floor(o/60),c=o%60,f=`${String(l).padStart(2,"0")}:${String(c).padStart(2,"0")}`,y;if(this.timeFormat===_o.TWELVE_HOUR){let W=l<12?this.localeAmLabel:this.localePmLabel,Q=l%12;Q===0&&(Q=12);let Z=c===0?"00":String(c);y=`${Q}:${Z} ${W}`}else y=`${l}:${String(c).padStart(2,"0")}`;let A=!this.min||f>=this.min,F=!this.max||f<=this.max;A&&F&&t.push({label:y,value:f})}return t}handleOptionClick(t){var e;this.value=t,this.parseValueToInternal(),this.displayPopover=!1,this.syncFormValue(),this.dispatchEvent(new CustomEvent("input",{detail:{value:this.value},composed:!0,bubbles:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},composed:!0,bubbles:!0})),(e=this.dropdownButton)==null||e.focus()}handleDropdownClick(t){this.disabled||this.softDisabled||this.readonly||(this.displayPopover=!this.displayPopover,t.stopPropagation())}handleSpinbuttonAreaClick(t){var o,l;this.disabled||this.softDisabled||this.readonly||t.target.getAttribute("role")==="spinbutton"||((o=this.hoursInput)==null||o.focus(),(l=this.hoursInput)==null||l.select())}handleBaseKeydown(t){var e;this.disabled||this.softDisabled||this.readonly||t.key===Ct.ESCAPE&&this.displayPopover&&(this.displayPopover=!1,(e=this.dropdownButton)==null||e.focus(),t.preventDefault(),t.stopPropagation())}handleListboxKeydown(t){var l;let e=this.getTimeOptions(),o=e.length;if(o!==0)switch(t.key){case Ct.ARROW_DOWN:{t.preventDefault(),t.stopPropagation(),this.focusedOptionIndex=(this.focusedOptionIndex+1)%o,this.focusCurrentMenuItem();break}case Ct.ARROW_UP:{t.preventDefault(),t.stopPropagation(),this.focusedOptionIndex=(this.focusedOptionIndex-1+o)%o,this.focusCurrentMenuItem();break}case Ct.ENTER:{t.preventDefault(),t.stopPropagation(),this.focusedOptionIndex>=0&&this.focusedOptionIndex<o&&this.handleOptionClick(e[this.focusedOptionIndex].value);break}case Ct.ESCAPE:{t.preventDefault(),t.stopPropagation(),this.displayPopover=!1,(l=this.dropdownButton)==null||l.focus();break}default:break}}handleHoursKeydown(t){this.handleSpinbuttonKeydown(t,"hours")}handleMinutesKeydown(t){this.handleSpinbuttonKeydown(t,"minutes")}handlePeriodKeydown(t){var e,o;switch(t.key){case Ct.ARROW_UP:case Ct.ARROW_DOWN:t.preventDefault(),this.internalPeriod=this.internalPeriod==="AM"?"PM":"AM",this.commitValue(),this.requestUpdate();break;case Ct.TAB:break;case Ct.ARROW_LEFT:t.preventDefault(),(e=this.minutesInput)==null||e.focus(),(o=this.minutesInput)==null||o.select();break;default:{t.preventDefault();let l=this.localeAmLabel.charAt(0).toLowerCase(),c=this.localePmLabel.charAt(0).toLowerCase(),f=t.key.toLowerCase();f===l?(this.internalPeriod="AM",this.commitValue(),this.requestUpdate()):f===c&&(this.internalPeriod="PM",this.commitValue(),this.requestUpdate());break}}}handleSpinbuttonKeydown(t,e){var A,F,W,Q,Z,et;let o=this.timeFormat===_o.TWELVE_HOUR,l,c;e==="hours"?(l=o?$e.MIN_HOUR_12:$e.MIN_HOUR_24,c=o?$e.MAX_HOUR_12:$e.MAX_HOUR_24):(l=$e.MIN_MINUTE,c=$e.MAX_MINUTE);let f=e==="hours"?this.internalHours:this.internalMinutes,y=f?parseInt(f,10):l;switch(t.key){case Ct.ARROW_UP:{t.preventDefault(),y=y>=c?l:y+1,this.setSpinbuttonValue(e,y),this.commitValue();break}case Ct.ARROW_DOWN:{t.preventDefault(),y=y<=l?c:y-1,this.setSpinbuttonValue(e,y),this.commitValue();break}case Ct.ARROW_RIGHT:{t.preventDefault(),e==="hours"?((A=this.minutesInput)==null||A.focus(),(F=this.minutesInput)==null||F.select()):o&&((W=this.periodInput)==null||W.focus(),(Q=this.periodInput)==null||Q.select());break}case Ct.ARROW_LEFT:{t.preventDefault(),e==="minutes"&&((Z=this.hoursInput)==null||Z.focus(),(et=this.hoursInput)==null||et.select());break}case Ct.TAB:break;default:{/^\d$/.test(t.key)?(t.preventDefault(),this.handleDigitInput(t.key,e,l,c)):t.preventDefault();break}}}handleDigitInput(t,e,o,l){if(this.pendingDigitTimeout&&clearTimeout(this.pendingDigitTimeout),this.pendingDigits+=t,this.pendingDigits.length>=2){let c=parseInt(this.pendingDigits,10);c>l&&(c=l),c<o&&(c=o),this.setSpinbuttonValue(e,c),this.pendingDigits="",this.commitValue(),this.advanceToNextField(e)}else{let c=parseInt(this.pendingDigits,10),f=Math.floor(l/10);if(c>f){let y=c;y>l&&(y=l),y<o&&(y=o),this.setSpinbuttonValue(e,y),this.pendingDigits="",this.commitValue(),this.advanceToNextField(e)}else this.setSpinbuttonValue(e,c),this.pendingDigitTimeout=setTimeout(()=>{let y=c;y<o&&(y=o),this.setSpinbuttonValue(e,y),this.pendingDigits="",this.commitValue(),this.advanceToNextField(e)},1e3)}}setSpinbuttonValue(t,e){let o=String(e).padStart(2,"0");t==="hours"?this.internalHours=o:this.internalMinutes=o,this.requestUpdate()}advanceToNextField(t){t==="hours"?this.updateComplete.then(()=>{var e,o;(e=this.minutesInput)==null||e.focus(),(o=this.minutesInput)==null||o.select()}).catch(()=>{}):this.timeFormat===_o.TWELVE_HOUR&&this.updateComplete.then(()=>{var e,o;(e=this.periodInput)==null||e.focus(),(o=this.periodInput)==null||o.select()}).catch(()=>{})}handleSpinbuttonFocus(t){t.target.select(),this.pendingDigits="",this.pendingDigitTimeout&&clearTimeout(this.pendingDigitTimeout)}get displayPeriod(){return this.internalPeriod==="AM"?this.localeAmLabel:this.localePmLabel}get hoursPlaceholder(){return this.localeHoursPlaceholder}get minutesPlaceholder(){return this.localeMinutesPlaceholder}get periodPlaceholder(){return this.localePeriodPlaceholder}renderTimeOptions(){let t=this.getTimeOptions(),e=this.internalToValue();return t.map(o=>S`
7006
+ `,My=[HS,...yt(!0)];var Rt=class extends ce(re(Zt)){constructor(){super(...arguments);this.timeFormat=$e.TIME_FORMAT;this.interval=$e.INTERVAL;this.placement=Mt.BOTTOM_START;this.strategy=Et.STRATEGY;this.disableFlip=$e.DISABLE_FLIP;this.localeHoursLabel="";this.localeMinutesLabel="";this.localePeriodLabel="";this.localeHoursPlaceholder="";this.localeMinutesPlaceholder="";this.localePeriodPlaceholder="";this.localeAmLabel="";this.localePmLabel="";this.localeShowTimePickerLabel="";this.localeTimeOptionsLabel="";this.localeSpinbuttonDescription="";this.displayPopover=!1;this.internalHours="";this.internalMinutes="";this.internalPeriod="AM";this.focusedOptionIndex=-1;this.pendingDigits=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.parseValueToInternal(),this.syncFormValue()}).catch(t=>{this.onerror&&this.onerror(t)})}disconnectedCallback(){super.disconnectedCallback(),this.pendingDigitTimeout&&clearTimeout(this.pendingDigitTimeout)}willUpdate(t){super.willUpdate(t),t.has("value")&&!this.displayPopover&&(this.parseValueToInternal(),this.syncFormValue()),(t.has("disabled")||t.has("softDisabled")||t.has("readonly"))&&(this.disabled||this.softDisabled||this.readonly)&&(this.displayPopover=!1)}updated(t){super.updated(t),t.has("displayPopover")&&this.displayPopover&&this.focusMenuItemOnOpen()}focusMenuItemOnOpen(){let t=this.getTimeOptions(),e=this.internalToValue(),o=t.findIndex(l=>l.value===e);this.focusedOptionIndex=o>=0?o:0,this.updateComplete.then(()=>{this.focusCurrentMenuItem()}).catch(()=>{})}focusCurrentMenuItem(){var o;let t=(o=this.shadowRoot)==null?void 0:o.querySelector(`#${gm}`);if(!t)return;let e=t.querySelectorAll("mdc-option");e[this.focusedOptionIndex]&&e[this.focusedOptionIndex].focus()}formResetCallback(){this.value="",this.internalHours="",this.internalMinutes="",this.internalPeriod="AM",this.syncFormValue(),this.requestUpdate()}formStateRestoreCallback(t){this.value=t,this.parseValueToInternal()}parseValueToInternal(){if(!this.value){this.internalHours="",this.internalMinutes="",this.internalPeriod="AM";return}let t=this.value.match(/^(\d{1,2}):(\d{2})$/);if(!t)return;let e=parseInt(t[1],10),o=parseInt(t[2],10);e<0||e>23||o<0||o>59||(this.internalMinutes=String(o).padStart(2,"0"),this.timeFormat===_o.TWELVE_HOUR?e===0?(this.internalPeriod="AM",this.internalHours="12"):e<12?(this.internalPeriod="AM",this.internalHours=String(e).padStart(2,"0")):e===12?(this.internalPeriod="PM",this.internalHours="12"):(this.internalPeriod="PM",this.internalHours=String(e-12).padStart(2,"0")):this.internalHours=String(e).padStart(2,"0"))}internalToValue(){if(!this.internalHours||!this.internalMinutes)return"";let t=parseInt(this.internalHours,10);return this.timeFormat===_o.TWELVE_HOUR&&(this.internalPeriod==="AM"?t=t===12?0:t:t=t===12?12:t+12),`${String(t).padStart(2,"0")}:${this.internalMinutes}`}syncFormValue(){let t=this.internalToValue();this.internals.setFormValue(t||this.value)}commitValue(){let t=this.internalToValue();t&&t!==this.value&&(this.value=t,this.syncFormValue(),this.dispatchEvent(new CustomEvent("input",{detail:{value:this.value},composed:!0,bubbles:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},composed:!0,bubbles:!0})))}getTimeOptions(){let t=[],e=Math.max(1,Math.min(this.interval,60));for(let o=0;o<24*60;o+=e){let l=Math.floor(o/60),c=o%60,f=`${String(l).padStart(2,"0")}:${String(c).padStart(2,"0")}`,y;if(this.timeFormat===_o.TWELVE_HOUR){let W=l<12?this.localeAmLabel:this.localePmLabel,Q=l%12;Q===0&&(Q=12);let Z=String(c).padStart(2,"0");y=`${Q}:${Z} ${W}`}else y=`${l}:${String(c).padStart(2,"0")}`;let A=!this.min||f>=this.min,F=!this.max||f<=this.max;A&&F&&t.push({label:y,value:f})}return t}handleOptionClick(t){var e;this.value=t,this.parseValueToInternal(),this.displayPopover=!1,this.syncFormValue(),this.dispatchEvent(new CustomEvent("input",{detail:{value:this.value},composed:!0,bubbles:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},composed:!0,bubbles:!0})),(e=this.dropdownButton)==null||e.focus()}handleDropdownClick(t){this.disabled||this.softDisabled||this.readonly||(this.displayPopover=!this.displayPopover,t.stopPropagation())}handleSpinbuttonAreaClick(t){var o,l;this.disabled||this.softDisabled||this.readonly||t.target.getAttribute("role")==="spinbutton"||((o=this.hoursInput)==null||o.focus(),(l=this.hoursInput)==null||l.select())}handleBaseKeydown(t){var e;this.disabled||this.softDisabled||this.readonly||t.key===Ct.ESCAPE&&this.displayPopover&&(this.displayPopover=!1,(e=this.dropdownButton)==null||e.focus(),t.preventDefault(),t.stopPropagation())}handleListboxKeydown(t){var l;let e=this.getTimeOptions(),o=e.length;if(o!==0)switch(t.key){case Ct.ARROW_DOWN:{t.preventDefault(),t.stopPropagation(),this.focusedOptionIndex=(this.focusedOptionIndex+1)%o,this.focusCurrentMenuItem();break}case Ct.ARROW_UP:{t.preventDefault(),t.stopPropagation(),this.focusedOptionIndex=(this.focusedOptionIndex-1+o)%o,this.focusCurrentMenuItem();break}case Ct.ENTER:{t.preventDefault(),t.stopPropagation(),this.focusedOptionIndex>=0&&this.focusedOptionIndex<o&&this.handleOptionClick(e[this.focusedOptionIndex].value);break}case Ct.ESCAPE:{t.preventDefault(),t.stopPropagation(),this.displayPopover=!1,(l=this.dropdownButton)==null||l.focus();break}default:break}}handleHoursKeydown(t){this.handleSpinbuttonKeydown(t,"hours")}handleMinutesKeydown(t){this.handleSpinbuttonKeydown(t,"minutes")}handlePeriodKeydown(t){var e,o;switch(t.key){case Ct.ARROW_UP:case Ct.ARROW_DOWN:t.preventDefault(),this.internalPeriod=this.internalPeriod==="AM"?"PM":"AM",this.commitValue(),this.requestUpdate();break;case Ct.TAB:break;case Ct.ARROW_LEFT:t.preventDefault(),(e=this.minutesInput)==null||e.focus(),(o=this.minutesInput)==null||o.select();break;default:{t.preventDefault();let l=this.localeAmLabel.charAt(0).toLowerCase(),c=this.localePmLabel.charAt(0).toLowerCase(),f=t.key.toLowerCase();f===l?(this.internalPeriod="AM",this.commitValue(),this.requestUpdate()):f===c&&(this.internalPeriod="PM",this.commitValue(),this.requestUpdate());break}}}handleSpinbuttonKeydown(t,e){var A,F,W,Q,Z,et;let o=this.timeFormat===_o.TWELVE_HOUR,l,c;e==="hours"?(l=o?$e.MIN_HOUR_12:$e.MIN_HOUR_24,c=o?$e.MAX_HOUR_12:$e.MAX_HOUR_24):(l=$e.MIN_MINUTE,c=$e.MAX_MINUTE);let f=e==="hours"?this.internalHours:this.internalMinutes,y=f?parseInt(f,10):l;switch(t.key){case Ct.ARROW_UP:{t.preventDefault(),y=y>=c?l:y+1,this.setSpinbuttonValue(e,y),this.commitValue();break}case Ct.ARROW_DOWN:{t.preventDefault(),y=y<=l?c:y-1,this.setSpinbuttonValue(e,y),this.commitValue();break}case Ct.ARROW_RIGHT:{t.preventDefault(),e==="hours"?((A=this.minutesInput)==null||A.focus(),(F=this.minutesInput)==null||F.select()):o&&((W=this.periodInput)==null||W.focus(),(Q=this.periodInput)==null||Q.select());break}case Ct.ARROW_LEFT:{t.preventDefault(),e==="minutes"&&((Z=this.hoursInput)==null||Z.focus(),(et=this.hoursInput)==null||et.select());break}case Ct.TAB:break;default:{/^\d$/.test(t.key)?(t.preventDefault(),this.handleDigitInput(t.key,e,l,c)):t.preventDefault();break}}}handleDigitInput(t,e,o,l){if(this.pendingDigitTimeout&&clearTimeout(this.pendingDigitTimeout),this.pendingDigits+=t,this.pendingDigits.length>=2){let c=parseInt(this.pendingDigits,10);c>l&&(c=l),c<o&&(c=o),this.setSpinbuttonValue(e,c),this.pendingDigits="",this.commitValue(),this.advanceToNextField(e)}else{let c=parseInt(this.pendingDigits,10),f=Math.floor(l/10);if(c>f){let y=c;y>l&&(y=l),y<o&&(y=o),this.setSpinbuttonValue(e,y),this.pendingDigits="",this.commitValue(),this.advanceToNextField(e)}else this.setSpinbuttonValue(e,c),this.pendingDigitTimeout=setTimeout(()=>{let y=c;y<o&&(y=o),this.setSpinbuttonValue(e,y),this.pendingDigits="",this.commitValue(),this.advanceToNextField(e)},1e3)}}setSpinbuttonValue(t,e){let o=String(e).padStart(2,"0");t==="hours"?this.internalHours=o:this.internalMinutes=o,this.requestUpdate()}advanceToNextField(t){t==="hours"?this.updateComplete.then(()=>{var e,o;(e=this.minutesInput)==null||e.focus(),(o=this.minutesInput)==null||o.select()}).catch(()=>{}):this.timeFormat===_o.TWELVE_HOUR&&this.updateComplete.then(()=>{var e,o;(e=this.periodInput)==null||e.focus(),(o=this.periodInput)==null||o.select()}).catch(()=>{})}handleSpinbuttonFocus(t){t.target.select(),this.pendingDigits="",this.pendingDigitTimeout&&clearTimeout(this.pendingDigitTimeout)}get displayPeriod(){return this.internalPeriod==="AM"?this.localeAmLabel:this.localePmLabel}get hoursPlaceholder(){return this.localeHoursPlaceholder}get minutesPlaceholder(){return this.localeMinutesPlaceholder}get periodPlaceholder(){return this.localePeriodPlaceholder}renderTimeOptions(){let t=this.getTimeOptions(),e=this.internalToValue();return t.map(o=>S`
7007
7007
  <mdc-option
7008
7008
  label="${o.label}"
7009
7009
  ?selected="${o.value===e}"