@momentum-ui/web-components 2.12.0-dev → 2.12.1
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/chunks/md-17.js +2 -2
- package/dist/chunks/md-19.js +1 -1
- package/dist/chunks/md-27.js +1 -1
- package/dist/chunks/md-30.js +1 -1
- package/dist/chunks/md-69.js +1 -1
- package/dist/chunks/md-7.js +3 -3
- package/dist/chunks/md-82.js +2 -2
- package/dist/chunks/md-83.js +16 -15
- package/dist/types/components/button/Button.d.ts +3 -1
- package/dist/types/components/timepicker/TimePicker.d.ts +2 -2
- package/package.json +2 -2
package/dist/chunks/md-83.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[83],{124:function(t,e,i){"use strict";i.r(e),i.d(e,"timeUnits",(function(){return b})),i.d(e,"timeSpecificity",(function(){return y})),i.d(e,"TimePicker",(function(){return v}));var o=i(
|
|
2
|
-
${t===
|
|
1
|
+
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[83],{124:function(t,e,i){"use strict";i.r(e),i.d(e,"timeUnits",(function(){return b})),i.d(e,"timeSpecificity",(function(){return y})),i.d(e,"TimePicker",(function(){return v}));i(24);var o=i(1),a=i(6),r=i(8),s=i(19),n=i(5),m=i(0),l=i(3),c=i(4),h=i(2),u=i(12),d=m.css`.md-timepicker{padding-right:0;width:fit-content}.md-timepicker.twenty-four-hour-format{padding-right:0}.md-timepicker .time-input-box{display:inline-block;height:2rem;width:2.5rem}.md-timepicker .amPm-combo-box{display:inline-block;height:2rem;margin-left:.5rem;width:2.5rem;position:relative}.md-timepicker .amPm-combo-box::part(group){padding:0}.md-timepicker .amPm-combo-box::part(multiwrap-input){text-align:center;text-transform:uppercase;width:100%}.md-timepicker .amPm-combo-box::part(label){padding:0 .4375rem;width:100%}.md-timepicker .amPm-combo-box::part(combobox-option){padding-left:0;padding-right:0}.md-timepicker .amPm-combo-box::part(combobox-options){max-height:5rem;width:2.625rem;padding:0;position:absolute;overflow:visible}.md-timepicker md-input::part(input){padding:0;text-align:center}.md-timepicker md-input::part(message){display:none}.md-timepicker .colon-separator{color:var(--md-secondary-text-color,#545454);font-size:1.25rem;line-height:125%;margin:0 .25rem}`,p=function(t,e,i,o){var a,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,o);else for(var n=t.length-1;n>=0;n--)(a=t[n])&&(s=(r<3?a(s):r>3?a(e,i,s):a(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};const b=[o.c.HOUR,o.c.MINUTE,o.c.SECOND,o.c.AM_PM],y=[o.c.HOUR,o.c.MINUTE,o.c.SECOND],g={[o.c.HOUR]:"HH",[o.c.MINUTE]:"MM",[o.c.SECOND]:"SS",[o.c.AM_PM]:"AM"};var v;!function(t){let e=class extends m.LitElement{constructor(){super(...arguments),this.twoDigitAutoTab=!1,this.twentyFourHourFormat=!1,this.timeSpecificity=o.c.SECOND,this.locale="en-US",this.value="00:00:00-08:00",this.localeTwentyFourFormat=!1,this.finalTwentyFourFormat=!1,this.timeObject=Object(r.n)(),this.tabNext=!1,this.timeValue={[o.c.HOUR]:"12",[o.c.MINUTE]:"00",[o.c.SECOND]:"00",[o.c.AM_PM]:"AM"},this.timeValidity={[o.c.HOUR]:!0,[o.c.MINUTE]:!0,[o.c.SECOND]:!0,[o.c.AM_PM]:!0},this.addLeadingZeros=t=>{if(t){if(0===t.length)return"00";if(1===t.length)return"0"+t}return t},this.formatAndValidate=(t,e)=>{if(t&&(this.updateValidity(t,e),this.timeValidity[e]))return this.addLeadingZeros(t)},this.getLocaleTimeFormat=t=>{const e=t.toFormat("tt"),[i,o]=e.split(" ");return!o},this.updateTimeValues=()=>{let t;t=this.finalTwentyFourFormat?this.timeObject.toFormat("HH:mm:ss"):this.timeObject.toFormat("tt");const[e,i]=t.split(" "),a=e.split(":");y.forEach(t=>{const e=this.formatAndValidate(a.shift(),t);e&&(t===o.c.HOUR&&i&&(this.timeValue[o.c.AM_PM]=i),this.timeValue[t]=e)})},this.updateValidity=(t,e)=>{let i=!0;const a=e=>{null===t.match(e)&&(i=!1)};switch(e){case o.c.HOUR:this.finalTwentyFourFormat?a(new RegExp(s.a.twentyFourHourString)):a(new RegExp(s.a.hourString));break;case o.c.MINUTE:case o.c.SECOND:a(new RegExp(s.a.minuteSecondString));break;case o.c.AM_PM:a(new RegExp(s.a.amPmString))}this.timeValidity[e]=i},this.to12HourFormat=(t,e)=>{if(!this.finalTwentyFourFormat&&this.timeValidity[o.c.HOUR]&&this.timeValidity[o.c.AM_PM]){let i=Number(e);return"PM"===t?i=12+i%12:i%=12,i}},this.isEntireTimeValid=()=>Object.values(this.timeValidity).every(t=>t),this.updateTimeUnit=t=>{var e,i,a;this.updateValidity(this.timeValue[t],t),this.timeObject&&this.timeValidity[t]&&(t!==o.c.AM_PM?this.timeObject=null===(e=this.timeObject)||void 0===e?void 0:e.set({[t]:this.timeValue[t]}):this.timeObject=null===(i=this.timeObject)||void 0===i?void 0:i.set({hour:this.to12HourFormat(this.timeValue[o.c.AM_PM],this.timeValue[o.c.HOUR])}),this.isEntireTimeValid()&&(this.timeObject=null===(a=this.timeObject)||void 0===a?void 0:a.set({hour:this.to12HourFormat(this.timeValue[o.c.AM_PM],this.timeValue[o.c.HOUR])}),this.value=this.timeObject.toISOTime({suppressMilliseconds:!0})||this.value,this.dispatchEvent(new CustomEvent("time-selection-change",{bubbles:!0,composed:!0,detail:{time:this.value,data:this.timeObject}}))))},this.formatTimeUnit=t=>{if(1===this.timeValue[t].length)"0"!==this.timeValue[t]&&(this.timeValue[t]="0"+this.timeValue[t]);else if(this.timeValue[t].length>2&&"0"===this.timeValue[t][0]){const e=this.timeValue[t].substring(1);RegExp(s.a.noPrecedingZerosString).test(e)&&(this.timeValue[t]=e)}this.requestUpdate()},this.messageType=t=>t?"":"error",this.generateTimeBox=t=>{const e=(i=this.finalTwentyFourFormat,{[o.c.HOUR]:{type:"number",min:i?0:1,max:i?23:12},[o.c.MINUTE]:{type:"number",min:0,max:59},[o.c.SECOND]:{type:"number",min:0,max:59},[o.c.AM_PM]:{type:"text",min:void 0,max:void 0}})[t];var i;return m.html`
|
|
2
|
+
${t===o.c.MINUTE||t===o.c.SECOND?m.html`
|
|
3
3
|
<span class="colon-separator">:</span>
|
|
4
4
|
`:l.nothing}
|
|
5
5
|
<md-input
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
id="time-${b.findIndex(e=>e===t)+1}"
|
|
10
10
|
value="${this.timeValue[t]}"
|
|
11
11
|
type="${e.type}"
|
|
12
|
-
min=${Object(
|
|
13
|
-
max=${Object(
|
|
12
|
+
min=${Object(h.ifDefined)(e.min)}
|
|
13
|
+
max=${Object(h.ifDefined)(e.max)}
|
|
14
14
|
maxLength=${2}
|
|
15
15
|
placeholder="${g[t]}"
|
|
16
16
|
@input-change="${e=>this.handleTimeChange(e,t)}"
|
|
@@ -20,24 +20,25 @@
|
|
|
20
20
|
.ariaLabel="${t}-input"
|
|
21
21
|
ariaInvalid="${!this.timeValidity[t]}"
|
|
22
22
|
></md-input>
|
|
23
|
-
`},this.generateAmPmComboBox=()=>{const t=["AM","PM"];return
|
|
23
|
+
`},this.generateAmPmComboBox=()=>{const t=["AM","PM"];return m.html`
|
|
24
24
|
<md-combobox
|
|
25
25
|
compact
|
|
26
26
|
select-when-in-focus
|
|
27
27
|
class="amPm-combo-box"
|
|
28
28
|
.options=${t}
|
|
29
29
|
.value=${[t[0]]}
|
|
30
|
-
.inputValue=${this.timeValue[
|
|
31
|
-
.ariaLabel=${this.timeValue[
|
|
32
|
-
@change-selected="${t=>this.handleTimeChange(t,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
.inputValue=${this.timeValue[o.c.AM_PM]}
|
|
31
|
+
.ariaLabel=${this.timeValue[o.c.AM_PM]}
|
|
32
|
+
@change-selected="${t=>this.handleTimeChange(t,o.c.AM_PM)}"
|
|
33
|
+
>
|
|
34
|
+
</md-combobox>
|
|
35
|
+
`}}get timePickerClassMap(){return{"twenty-four-hour-format":this.finalTwentyFourFormat}}updated(t){if(super.updated(t),this.value&&(t.has("value")||t.has("locale")||t.has("twentyFourHourFormat"))){this.timeObject=u.DateTime.fromISO(this.value,{locale:this.locale});const t=this.getLocaleTimeFormat(this.timeObject);this.finalTwentyFourFormat=this.twentyFourHourFormat||t,this.value=this.timeObject.toISOTime({suppressMilliseconds:!0}),this.updateTimeValues()}}handleTimeChange(t,e){var i,a,r;this.timeValue[e]=null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.value,this.requestUpdate(),this.formatTimeUnit(e);const s=this.timeValue[e];if(this.twoDigitAutoTab&&this.tabNext&&(e!==o.c.AM_PM&&2===s.length&&"0"!==s[0]||"00"===s)){t.preventDefault();const e=null==t?void 0:t.target,i=null===(a=this.shadowRoot)||void 0===a?void 0:a.querySelectorAll("md-input, md-combobox");if(i){const t=Array.prototype.findIndex.call(i,t=>null==e?void 0:e.isEqualNode(t)),o=(t+1)%i.length;if(t<i.length-1){const t=null===(r=i[o].shadowRoot)||void 0===r?void 0:r.querySelector("input");null==t||t.focus()}}}else e===o.c.AM_PM&&this.updateTimeUnit(e);t.stopPropagation(),this.dispatchEvent(new CustomEvent(e+"-change",{bubbles:!0,composed:!0,detail:{srcEvent:t,value:""+this.timeValue[e],isValid:this.timeValidity[e]}}))}handleTimeKeyDown(t,e){var i;const{key:a}=null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.srcEvent;a===o.b.ArrowDown||a===o.b.ArrowUp?this.tabNext=!1:this.tabNext=!0,this.timeValidity[e]=!0,this.requestUpdate(),t.stopPropagation(),this.dispatchEvent(new CustomEvent(e+"-keydown",{bubbles:!0,composed:!0,detail:{srcEvent:t,value:""+this.timeValue[e]}}))}handleTimeBlur(t,e){"0"===this.timeValue[e]&&(this.timeValue[e]="00"),this.updateTimeUnit(e),this.requestUpdate(),t.stopPropagation(),this.dispatchEvent(new CustomEvent(e+"-blur",{bubbles:!0,composed:!0,detail:{srcEvent:t,time:this.value,isValid:this.timeValidity[e]}}))}static get styles(){return[n.a,d]}render(){return m.html`
|
|
36
|
+
<div class="md-timepicker ${Object(c.classMap)(this.timePickerClassMap)}">
|
|
36
37
|
<div class="time-inputs-wrapper">
|
|
37
|
-
${this.generateTimeBox(
|
|
38
|
-
${this.timeSpecificity===
|
|
39
|
-
${this.timeSpecificity===
|
|
38
|
+
${this.generateTimeBox(o.c.HOUR)}
|
|
39
|
+
${this.timeSpecificity===o.c.HOUR?l.nothing:this.generateTimeBox(o.c.MINUTE)}
|
|
40
|
+
${this.timeSpecificity===o.c.MINUTE||this.timeSpecificity===o.c.HOUR?l.nothing:this.generateTimeBox(o.c.SECOND)}
|
|
40
41
|
${this.finalTwentyFourFormat?l.nothing:this.generateAmPmComboBox()}
|
|
41
42
|
</div>
|
|
42
43
|
</div>
|
|
43
|
-
`}};p([Object(
|
|
44
|
+
`}};p([Object(m.property)({type:Boolean,attribute:"two-digit-auto-tab"})],e.prototype,"twoDigitAutoTab",void 0),p([Object(m.property)({type:Boolean,attribute:"twenty-four-hour-format",reflect:!0})],e.prototype,"twentyFourHourFormat",void 0),p([Object(m.property)({type:String})],e.prototype,"timeSpecificity",void 0),p([Object(m.property)({type:String})],e.prototype,"locale",void 0),p([Object(m.property)({type:String,reflect:!0})],e.prototype,"value",void 0),p([Object(m.internalProperty)()],e.prototype,"localeTwentyFourFormat",void 0),p([Object(m.internalProperty)()],e.prototype,"finalTwentyFourFormat",void 0),p([Object(m.internalProperty)()],e.prototype,"timeObject",void 0),p([Object(m.internalProperty)()],e.prototype,"tabNext",void 0),p([Object(m.internalProperty)()],e.prototype,"timeValue",void 0),p([Object(m.internalProperty)()],e.prototype,"timeValidity",void 0),e=p([Object(a.a)("md-timepicker")],e),t.ELEMENT=e}(v||(v={}))}}]);
|
|
@@ -11,7 +11,7 @@ export declare const buttonSize: readonly ["20", "28", "32", "36", "40", "44", "
|
|
|
11
11
|
export declare const buttonTag: readonly ["button", "input", "a"];
|
|
12
12
|
export declare const buttonType: readonly ["button", "reset", "submit"];
|
|
13
13
|
export declare const buttonRoles: readonly ["button", "checkbox", "link", "menuitem", "menuitemcheckbox", "menuitemradio", "option", "radio", "switch", "tab"];
|
|
14
|
-
export declare const buttonVariant: readonly ["primary", "secondary", "red", "green", "ghost", "white", "darkGrey", "promotional", "available", "unavailable", "engaged", "idle"];
|
|
14
|
+
export declare const buttonVariant: readonly ["primary", "secondary", "red", "green", "ghost", "white", "darkGrey", "promotional", "tab", "available", "unavailable", "engaged", "idle"];
|
|
15
15
|
export declare const buttonColor: readonly ["blue", "red", "green", "orange", "yellow", "mint", "purple", "pink", "cyan", "white", "dark-gray", "duck-egg", "violet", "color-none", ""];
|
|
16
16
|
export declare const buttonAriaLive: readonly ["", "off", "polite", "assertive"];
|
|
17
17
|
export declare namespace Button {
|
|
@@ -74,6 +74,7 @@ export declare namespace Button {
|
|
|
74
74
|
maxWidth: string;
|
|
75
75
|
activityType: string;
|
|
76
76
|
iconActive: boolean;
|
|
77
|
+
isActive: boolean;
|
|
77
78
|
clickFunction: Function | null;
|
|
78
79
|
button: HTMLButtonElement;
|
|
79
80
|
renderWidth: () => {};
|
|
@@ -89,6 +90,7 @@ export declare namespace Button {
|
|
|
89
90
|
"md-button--outline": boolean;
|
|
90
91
|
active: boolean;
|
|
91
92
|
disabled: boolean;
|
|
93
|
+
isActive: boolean;
|
|
92
94
|
"md-activity": boolean;
|
|
93
95
|
"md-button--icon": boolean;
|
|
94
96
|
"md-button--onlyicon": boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { LitElement, PropertyValues } from "lit-element";
|
|
2
1
|
import "@/components/input/Input";
|
|
3
|
-
import {
|
|
2
|
+
import { LitElement, PropertyValues } from "lit-element";
|
|
4
3
|
import { DateTime } from "luxon";
|
|
4
|
+
import { TIME_UNIT } from "../../constants";
|
|
5
5
|
export declare const timeUnits: readonly [TIME_UNIT.HOUR, TIME_UNIT.MINUTE, TIME_UNIT.SECOND, TIME_UNIT.AM_PM];
|
|
6
6
|
export declare const timeSpecificity: TIME_UNIT[];
|
|
7
7
|
export declare namespace TimePicker {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momentum-ui/web-components",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.1",
|
|
4
4
|
"author": "Yana Harris",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/momentum-design/momentum-ui.git",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"papaparse": "^5.3.0",
|
|
24
24
|
"sortablejs": "^1.13.0",
|
|
25
25
|
"lit-virtualizer": "0.4.2",
|
|
26
|
-
"@momentum-design/tokens": "0.0.
|
|
26
|
+
"@momentum-design/tokens": "0.0.59"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@momentum-ui/core": "19.16.0",
|