@digital-realty/ix-time 1.1.4 → 1.1.6

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/IxTime.d.ts CHANGED
@@ -83,5 +83,5 @@ export declare class IxTime extends LitElement {
83
83
  handleChange: (e: InputEvent) => void;
84
84
  validateDate: () => void;
85
85
  focusOut: () => void;
86
- render(): import("lit").TemplateResult<1>;
86
+ render(): import("lit-html").TemplateResult<1>;
87
87
  }
@@ -3,6 +3,21 @@ export const IxTimeStyles = css `
3
3
  :host {
4
4
  display: block;
5
5
  }
6
+ ::part(input-field) {
7
+ background: transparent;
8
+ padding: 0;
9
+ height: 26px;
10
+ }
11
+
12
+ #search-input-vaadin-time-picker-3 {
13
+ padding: 0 !important;
14
+ --_hover-highlight: transparent;
15
+ }
16
+
17
+ vaadin-time-picker::before {
18
+ display: none;
19
+ }
20
+
6
21
  ix-field {
7
22
  display: block;
8
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ix-time-styles.js","sourceRoot":"","sources":["../src/ix-time-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;CAoB9B,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const IxTimeStyles = css`\n :host {\n display: block;\n }\n ix-field {\n display: block;\n }\n .flex-fill {\n flex: 1;\n align-items: center;\n }\n input {\n border: none;\n background: transparent;\n outline: none;\n min-width: 3rem;\n }\n .time {\n position: relative;\n }\n`;\n"]}
1
+ {"version":3,"file":"ix-time-styles.js","sourceRoot":"","sources":["../src/ix-time-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmC9B,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const IxTimeStyles = css`\n :host {\n display: block;\n }\n ::part(input-field) {\n background: transparent;\n padding: 0;\n height: 26px;\n }\n\n #search-input-vaadin-time-picker-3 {\n padding: 0 !important;\n --_hover-highlight: transparent;\n }\n\n vaadin-time-picker::before {\n display: none;\n }\n\n ix-field {\n display: block;\n }\n .flex-fill {\n flex: 1;\n align-items: center;\n }\n input {\n border: none;\n background: transparent;\n outline: none;\n min-width: 3rem;\n }\n .time {\n position: relative;\n }\n`;\n"]}
@@ -1 +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";let IxTimeStyles=css`:host{display:block}ix-field{display:block}.flex-fill{flex:1;align-items:center}input{border:none;background:0 0;outline:0;min-width:3rem}.time{position:relative}`;class IxTime extends LitElement{constructor(){super(...arguments),this.label="",this.value="",this.min="",this.max="",this.internals=this.attachInternals(),this.disabled=!1,this.internalErrorText="",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=()=>{this.value&&this.timeInput.validity.valid?this.internalErrorText="":this.timeInput.validity.rangeUnderflow||this.timeInput.validity.rangeOverflow?this.internalErrorText=`The value must be between ${this.min} and ${this.max}.`:this.required&&!this.timeInput.validity.valid&&(this.internalErrorText="Time is not valid.")},this.focusOut=()=>{this.focused=!1}}static get styles(){return[IxTimeStyles]}get error(){return this.internalErrorText||this.errorText||""}get hasError(){return!!this.error}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.hasError},this.error,this.timeInput),this.internals.setFormValue(this.value)}focus(){this.timeInput.focus()}firstUpdated(){this.validateDate()}render(){var t={disabled:this.disabled,error:!this.disabled&&this.hasError};return html`<ix-field class="${classMap(t)}" ?focused="${this.focused}" ?populated="${this.value}" ?disabled="${this.disabled}" ?required="${this.required}" ?error="${this.hasError&&!this.hideError}" error-text="${this.error}" label="${this.label}" @focusin="${this.focusin}" @focusout="${this.focusOut}"><input id="time-input" @change="${this.handleChange}" .value="${this.value}" class="flex-fill" type="time" min="${this.min}" max="${this.max}"></ix-field>`}}requestUpdateOnAriaChange(IxTime),IxTime.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0},IxTime.formAssociated=!0,__decorate([property({type:String})],IxTime.prototype,"label",void 0),__decorate([property({type:String})],IxTime.prototype,"value",void 0),__decorate([property({type:String})],IxTime.prototype,"min",void 0),__decorate([property({type:String})],IxTime.prototype,"max",void 0),__decorate([query("#time-input")],IxTime.prototype,"timeInput",void 0),__decorate([property({type:Boolean,reflect:!0})],IxTime.prototype,"disabled",void 0),__decorate([state()],IxTime.prototype,"internalErrorText",void 0),__decorate([property({type:String})],IxTime.prototype,"errorText",void 0),__decorate([property({type:Boolean,reflect:!0})],IxTime.prototype,"required",void 0),__decorate([property({type:Boolean,reflect:!0})],IxTime.prototype,"hideError",void 0),__decorate([property({type:Function})],IxTime.prototype,"onChanged",void 0),__decorate([state()],IxTime.prototype,"focused",void 0),window.customElements.define("ix-time",IxTime);
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";let IxTimeStyles=css`:host{display:block}::part(input-field){background:0 0;padding:0;height:26px}#search-input-vaadin-time-picker-3{padding:0!important;--_hover-highlight:transparent}vaadin-time-picker::before{display:none}ix-field{display:block}.flex-fill{flex:1;align-items:center}input{border:none;background:0 0;outline:0;min-width:3rem}.time{position:relative}`;class IxTime extends LitElement{constructor(){super(...arguments),this.label="",this.value="",this.min="",this.max="",this.internals=this.attachInternals(),this.disabled=!1,this.internalErrorText="",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=()=>{this.value&&this.timeInput.validity.valid?this.internalErrorText="":this.timeInput.validity.rangeUnderflow||this.timeInput.validity.rangeOverflow?this.internalErrorText=`The value must be between ${this.min} and ${this.max}.`:this.required&&!this.timeInput.validity.valid&&(this.internalErrorText="Time is not valid.")},this.focusOut=()=>{this.focused=!1}}static get styles(){return[IxTimeStyles]}get error(){return this.internalErrorText||this.errorText||""}get hasError(){return!!this.error}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.hasError},this.error,this.timeInput),this.internals.setFormValue(this.value)}focus(){this.timeInput.focus()}firstUpdated(){this.validateDate()}render(){var t={disabled:this.disabled,error:!this.disabled&&this.hasError};return html`<ix-field class="${classMap(t)}" ?focused="${this.focused}" ?populated="${this.value}" ?disabled="${this.disabled}" ?required="${this.required}" ?error="${this.hasError&&!this.hideError}" error-text="${this.error}" label="${this.label}" @focusin="${this.focusin}" @focusout="${this.focusOut}"><input id="time-input" @change="${this.handleChange}" .value="${this.value}" class="flex-fill" type="time" min="${this.min}" max="${this.max}"></ix-field>`}}requestUpdateOnAriaChange(IxTime),IxTime.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0},IxTime.formAssociated=!0,__decorate([property({type:String})],IxTime.prototype,"label",void 0),__decorate([property({type:String})],IxTime.prototype,"value",void 0),__decorate([property({type:String})],IxTime.prototype,"min",void 0),__decorate([property({type:String})],IxTime.prototype,"max",void 0),__decorate([query("#time-input")],IxTime.prototype,"timeInput",void 0),__decorate([property({type:Boolean,reflect:!0})],IxTime.prototype,"disabled",void 0),__decorate([state()],IxTime.prototype,"internalErrorText",void 0),__decorate([property({type:String})],IxTime.prototype,"errorText",void 0),__decorate([property({type:Boolean,reflect:!0})],IxTime.prototype,"required",void 0),__decorate([property({type:Boolean,reflect:!0})],IxTime.prototype,"hideError",void 0),__decorate([property({type:Function})],IxTime.prototype,"onChanged",void 0),__decorate([state()],IxTime.prototype,"focused",void 0),window.customElements.define("ix-time",IxTime);
@@ -0,0 +1,11 @@
1
+ declare class DateFormatState {
2
+ constructor();
3
+ preferredDateFormat: string;
4
+ preferredTimeFormat: string;
5
+ get isHydrated(): boolean;
6
+ hydrateStore(): Promise<void>;
7
+ clearStoredDate(): Promise<void>;
8
+ getStoredData(): Promise<this | null>;
9
+ }
10
+ export declare const dateFormatState: DateFormatState;
11
+ export {};
@@ -0,0 +1,28 @@
1
+ import { makeAutoObservable } from 'mobx';
2
+ import { makePersistable, isHydrated, hydrateStore, clearPersistedStore, getPersistedStore, } from 'mobx-persist-store';
3
+ class DateFormatState {
4
+ constructor() {
5
+ this.preferredDateFormat = 'dd/MM/yyyy';
6
+ this.preferredTimeFormat = 'hh:mm';
7
+ makeAutoObservable(this);
8
+ makePersistable(this, {
9
+ name: 'date-format',
10
+ properties: ['preferredDateFormat', 'preferredTimeFormat'],
11
+ storage: window.localStorage,
12
+ });
13
+ }
14
+ get isHydrated() {
15
+ return isHydrated(this);
16
+ }
17
+ async hydrateStore() {
18
+ await hydrateStore(this);
19
+ }
20
+ async clearStoredDate() {
21
+ await clearPersistedStore(this);
22
+ }
23
+ async getStoredData() {
24
+ return getPersistedStore(this);
25
+ }
26
+ }
27
+ export const dateFormatState = new DateFormatState();
28
+ //# sourceMappingURL=date-format-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-format-state.js","sourceRoot":"","sources":["../../src/state/date-format-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,eAAe;IACnB;QASO,wBAAmB,GAAW,YAAY,CAAC;QAE3C,wBAAmB,GAAW,OAAO,CAAC;QAV3C,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACzB,eAAe,CAAC,IAAI,EAAE;YACpB,IAAI,EAAE,aAAa;YACnB,UAAU,EAAE,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;YAC1D,OAAO,EAAE,MAAM,CAAC,YAAY;SAC7B,CAAC,CAAC;IACL,CAAC;IAMD,IAAI,UAAU;QACZ,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,MAAM,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;CACF;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC","sourcesContent":["import { makeAutoObservable } from 'mobx';\nimport {\n makePersistable,\n isHydrated,\n hydrateStore,\n clearPersistedStore,\n getPersistedStore,\n} from 'mobx-persist-store';\n\nclass DateFormatState {\n constructor() {\n makeAutoObservable(this);\n makePersistable(this, {\n name: 'date-format',\n properties: ['preferredDateFormat', 'preferredTimeFormat'],\n storage: window.localStorage,\n });\n }\n\n public preferredDateFormat: string = 'dd/MM/yyyy';\n\n public preferredTimeFormat: string = 'hh:mm';\n\n get isHydrated() {\n return isHydrated(this);\n }\n\n async hydrateStore() {\n await hydrateStore(this);\n }\n\n async clearStoredDate() {\n await clearPersistedStore(this);\n }\n\n async getStoredData() {\n return getPersistedStore(this);\n }\n}\n\nexport const dateFormatState = new DateFormatState();\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent ix-time following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "Digital Realty",
6
- "version": "1.1.4",
6
+ "version": "1.1.6",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.js",
@@ -26,11 +26,15 @@
26
26
  "test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
27
27
  },
28
28
  "dependencies": {
29
- "@digital-realty/ix-field": "^1.1.4",
30
- "@digital-realty/theme": "^1.0.30",
29
+ "@adobe/lit-mobx": "^2.2.2",
30
+ "@digital-realty/ix-field": "^1.1.6",
31
31
  "@material/web": "1.2.0",
32
+ "@vaadin/time-picker": "^24.6.1",
32
33
  "@web/test-runner-commands": "^0.9.0",
33
- "lit": "^2.8.0 || ^3.0.0"
34
+ "date-fns": "^4.1.0",
35
+ "lit": "^3.2.1",
36
+ "mobx": "^6.13.5",
37
+ "mobx-persist-store": "^1.1.5"
34
38
  },
35
39
  "devDependencies": {
36
40
  "@custom-elements-manifest/analyzer": "^0.4.17",
@@ -39,6 +43,7 @@
39
43
  "@typescript-eslint/eslint-plugin": "^5.48.0",
40
44
  "@typescript-eslint/parser": "^5.48.0",
41
45
  "@web/dev-server": "^0.1.34",
46
+ "@web/dev-server-import-maps": "^0.2.1",
42
47
  "@web/test-runner": "^0.14.0",
43
48
  "concurrently": "^9.1.0",
44
49
  "eslint": "^8.31.0",
@@ -46,6 +51,7 @@
46
51
  "husky": "^4.3.8",
47
52
  "lint-staged": "^10.5.4",
48
53
  "prettier": "^2.4.1",
54
+ "rollup": "^4.29.1",
49
55
  "rollup-plugin-minify-html-literals": "^1.2.6",
50
56
  "rollup-plugin-summary": "^2.0.0",
51
57
  "rollup-plugin-uglify": "^6.0.4",
@@ -99,5 +105,5 @@
99
105
  "README.md",
100
106
  "LICENSE"
101
107
  ],
102
- "gitHead": "cb4798e2a22a7e6b2eed58b8fc2d9fdddc875911"
108
+ "gitHead": "a781e30ec63dcc3307d86b94e35fa93c4e61f22f"
103
109
  }