@digital-realty/ix-date 1.0.24 → 1.0.26
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/ix-date.min.js +1 -0
- package/package.json +10 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__decorate}from"tslib";import{css,LitElement,html}from"lit";import{property,query,state}from"lit/decorators.js";import{classMap}from"lit/directives/class-map.js";import"@digital-realty/ix-field/ix-field.js";import{requestUpdateOnAriaChange}from"@material/web/internal/aria/delegate.js";const IxDateStyles=css`:host{display:block}ix-field{display:block}.flex-fill{flex:1;align-items:center}input{height:var(--ix-line-height)}`;class IxDate extends LitElement{constructor(){super(...arguments),this.label="",this.value="",this.min="",this.max="9999-12-31",this.internals=this.attachInternals(),this.disabled=!1,this.errorText="",this.required=!1,this.hideError=!1,this.onChanged=()=>{},this.focused=!1,this.focusin=()=>{this.focused=!0},this.clear=()=>{this.value=""},this.handleChange=t=>{t=t.target.value;this.value=t,this.validateDate(),this.onChanged(t)},this.validateDate=()=>{var t;!this.value||(t=new Date(this.value))&&!Number.isNaN(t.valueOf())||(this.errorText="Invalid date format.")},this.focusOut=()=>{this.focused=!1}}static get styles(){return[IxDateStyles]}get error(){return!!this.errorText}get form(){return this.internals.form}get labels(){return this.internals.labels}get name(){var t;return null!=(t=this.getAttribute("name"))?t:""}set name(t){this.setAttribute("name",t)}get validationMessage(){return this.internals.validationMessage}get validity(){return this.internals.validity}get willValidate(){return this.internals.willValidate}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.internals.reportValidity()}formResetCallback(){this.reset()}reset(){var t;this.clear(),this.value=null!=(t=this.getAttribute("value"))?t:""}updated(){this.internals.setValidity({badInput:this.error},this.error?this.errorText:"",this.dateInput),this.internals.setFormValue(this.value)}focus(){this.dateInput.focus()}firstUpdated(){var t=new Date(this.min),e=new Date(this.max);t&&!Number.isNaN(t.valueOf())&&([t]=t.toISOString().split("T"),this.min=t),e&&!Number.isNaN(e.valueOf())&&([t]=e.toISOString().split("T"),this.max=t),this.validateDate()}render(){var t={disabled:this.disabled,error:!this.disabled&&this.error};return html`<ix-field class="${classMap(t)}" ?focused="${this.focused}" ?populated="${this.value}" ?disabled="${this.disabled}" ?required="${this.required}" ?error="${this.error&&!this.hideError}" error-text="${this.errorText}" label="${this.label}" @focusin="${this.focusin}" @focusout="${this.focusOut}"><input id="date-input" @change="${this.handleChange}" .value="${this.value}" class="flex-fill" type="date" min="${this.min}" max="${this.max}"></ix-field>`}}requestUpdateOnAriaChange(IxDate),IxDate.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0},IxDate.formAssociated=!0,__decorate([property({type:String})],IxDate.prototype,"label",void 0),__decorate([property({type:String})],IxDate.prototype,"value",void 0),__decorate([property({type:String})],IxDate.prototype,"min",void 0),__decorate([property({type:String})],IxDate.prototype,"max",void 0),__decorate([query("#date-input")],IxDate.prototype,"dateInput",void 0),__decorate([property({type:Boolean,reflect:!0})],IxDate.prototype,"disabled",void 0),__decorate([property({type:String,attribute:"error-text"})],IxDate.prototype,"errorText",void 0),__decorate([property({type:Boolean,reflect:!0})],IxDate.prototype,"required",void 0),__decorate([property({type:Boolean,reflect:!0})],IxDate.prototype,"hideError",void 0),__decorate([property({type:Function})],IxDate.prototype,"onChanged",void 0),__decorate([state()],IxDate.prototype,"focused",void 0),window.customElements.define("ix-date",IxDate);
|
package/package.json
CHANGED
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
"description": "Webcomponent ix-date following open-wc recommendations",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Digital Realty",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.26",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"module": "dist/index.js",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": "./dist/index.js",
|
|
12
|
-
"./ix-date.js": "./dist/ix-date.js"
|
|
12
|
+
"./ix-date.js": "./dist/ix-date.js",
|
|
13
|
+
"./ix-date.min.js": "./dist/ix-date.min.js"
|
|
13
14
|
},
|
|
14
15
|
"publishConfig": {
|
|
15
16
|
"access": "public"
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
"scripts": {
|
|
18
19
|
"analyze": "cem analyze --litelement",
|
|
19
20
|
"start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
|
|
20
|
-
"build": "tsc && npm run analyze -- --exclude dist",
|
|
21
|
+
"build": "tsc && npm run analyze -- --exclude dist && rollup -c",
|
|
21
22
|
"prepublish": "tsc && npm run analyze -- --exclude dist",
|
|
22
23
|
"lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
|
|
23
24
|
"format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
|
|
@@ -25,8 +26,8 @@
|
|
|
25
26
|
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@digital-realty/ix-field": "^1.0.
|
|
29
|
-
"@digital-realty/theme": "^1.0.
|
|
29
|
+
"@digital-realty/ix-field": "^1.0.5",
|
|
30
|
+
"@digital-realty/theme": "^1.0.27",
|
|
30
31
|
"@material/web": "1.2.0",
|
|
31
32
|
"@web/test-runner-commands": "^0.9.0",
|
|
32
33
|
"lit": "^2.0.2"
|
|
@@ -46,6 +47,9 @@
|
|
|
46
47
|
"husky": "^4.3.8",
|
|
47
48
|
"lint-staged": "^10.5.4",
|
|
48
49
|
"prettier": "^2.4.1",
|
|
50
|
+
"rollup-plugin-minify-html-literals": "^1.2.6",
|
|
51
|
+
"rollup-plugin-summary": "^2.0.0",
|
|
52
|
+
"rollup-plugin-uglify": "^6.0.4",
|
|
49
53
|
"tslib": "^2.3.1",
|
|
50
54
|
"typescript": "^4.5.2"
|
|
51
55
|
},
|
|
@@ -96,5 +100,5 @@
|
|
|
96
100
|
"README.md",
|
|
97
101
|
"LICENSE"
|
|
98
102
|
],
|
|
99
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "c7668fda980293ca038c0dd061ebe350fa88ee60"
|
|
100
104
|
}
|