@digital-realty/ix-date 1.0.31 → 1.1.2-alpha-NJEN.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/IxDate.d.ts CHANGED
@@ -1,84 +1,84 @@
1
- import { LitElement } from 'lit';
2
- import '@digital-realty/ix-field/ix-field.js';
3
- export declare class IxDate extends LitElement {
4
- static get styles(): import("lit").CSSResult[];
5
- label: string;
6
- value: string;
7
- min: string;
8
- max: string;
9
- /** @nocollapse */
10
- static shadowRootOptions: {
11
- delegatesFocus: boolean;
12
- mode: ShadowRootMode;
13
- slotAssignment?: SlotAssignmentMode | undefined;
14
- customElements?: CustomElementRegistry | undefined;
15
- registry?: CustomElementRegistry | undefined;
16
- };
17
- /** @nocollapse */
18
- static readonly formAssociated = true;
19
- private readonly internals;
20
- dateInput: HTMLInputElement;
21
- disabled: boolean;
22
- /**
23
- * Gets or sets whether or not the text field is in a visually invalid state.
24
- *
25
- * This error state overrides the error state controlled by
26
- * `reportValidity()`.
27
- */
28
- get error(): boolean;
29
- errorText: string;
30
- required: boolean;
31
- hideError: boolean;
32
- /**
33
- * The associated form element with which this element's value will submit.
34
- */
35
- get form(): HTMLFormElement | null;
36
- /**
37
- * The labels this element is associated with.
38
- */
39
- get labels(): NodeList;
40
- /**
41
- * The HTML name to use in form submission.
42
- */
43
- get name(): string;
44
- set name(name: string);
45
- /**
46
- * Returns the text field's validation error message.
47
- *
48
- * https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation
49
- */
50
- get validationMessage(): string;
51
- /**
52
- * Returns a `ValidityState` object that represents the validity states of the
53
- * text field.
54
- *
55
- * https://developer.mozilla.org/en-US/docs/Web/API/ValidityState
56
- */
57
- get validity(): ValidityState;
58
- /**
59
- * Returns whether an element will successfully validate based on forms
60
- * validation rules and constraints.
61
- *
62
- * https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/willValidate
63
- */
64
- get willValidate(): boolean;
65
- checkValidity(): boolean;
66
- reportValidity(): boolean;
67
- /** @private */
68
- formResetCallback(): void;
69
- /**
70
- * Reset the text field to its default value.
71
- */
72
- reset(): void;
73
- protected updated(): void;
74
- focus(): void;
75
- onChanged: any;
76
- private focused;
77
- firstUpdated(): void;
78
- focusin: () => void;
79
- clear: () => void;
80
- handleChange: (e: InputEvent) => void;
81
- validateDate: () => void;
82
- focusOut: () => void;
83
- render(): import("lit").TemplateResult<1>;
84
- }
1
+ import { LitElement } from 'lit';
2
+ import '@digital-realty/ix-field/ix-field.js';
3
+ export declare class IxDate extends LitElement {
4
+ static get styles(): import("lit").CSSResult[];
5
+ label: string;
6
+ value: string;
7
+ min: string;
8
+ max: string;
9
+ /** @nocollapse */
10
+ static shadowRootOptions: {
11
+ delegatesFocus: boolean;
12
+ mode: ShadowRootMode;
13
+ slotAssignment?: SlotAssignmentMode | undefined;
14
+ customElements?: CustomElementRegistry | undefined;
15
+ registry?: CustomElementRegistry | undefined;
16
+ };
17
+ /** @nocollapse */
18
+ static readonly formAssociated = true;
19
+ private readonly internals;
20
+ dateInput: HTMLInputElement;
21
+ disabled: boolean;
22
+ /**
23
+ * Gets or sets whether or not the text field is in a visually invalid state.
24
+ *
25
+ * This error state overrides the error state controlled by
26
+ * `reportValidity()`.
27
+ */
28
+ get error(): boolean;
29
+ errorText: string;
30
+ required: boolean;
31
+ hideError: boolean;
32
+ /**
33
+ * The associated form element with which this element's value will submit.
34
+ */
35
+ get form(): HTMLFormElement | null;
36
+ /**
37
+ * The labels this element is associated with.
38
+ */
39
+ get labels(): NodeList;
40
+ /**
41
+ * The HTML name to use in form submission.
42
+ */
43
+ get name(): string;
44
+ set name(name: string);
45
+ /**
46
+ * Returns the text field's validation error message.
47
+ *
48
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation
49
+ */
50
+ get validationMessage(): string;
51
+ /**
52
+ * Returns a `ValidityState` object that represents the validity states of the
53
+ * text field.
54
+ *
55
+ * https://developer.mozilla.org/en-US/docs/Web/API/ValidityState
56
+ */
57
+ get validity(): ValidityState;
58
+ /**
59
+ * Returns whether an element will successfully validate based on forms
60
+ * validation rules and constraints.
61
+ *
62
+ * https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/willValidate
63
+ */
64
+ get willValidate(): boolean;
65
+ checkValidity(): boolean;
66
+ reportValidity(): boolean;
67
+ /** @private */
68
+ formResetCallback(): void;
69
+ /**
70
+ * Reset the text field to its default value.
71
+ */
72
+ reset(): void;
73
+ protected updated(): void;
74
+ focus(): void;
75
+ onChanged: any;
76
+ private focused;
77
+ firstUpdated(): void;
78
+ focusin: () => void;
79
+ clear: () => void;
80
+ handleChange: (e: InputEvent) => void;
81
+ validateDate: () => void;
82
+ focusOut: () => void;
83
+ render(): import("lit").TemplateResult<1>;
84
+ }
package/dist/IxDate.js CHANGED
@@ -1,155 +1,155 @@
1
- import { __decorate } from "tslib";
2
- import { html, LitElement } from 'lit';
3
- import { property, query, state } from 'lit/decorators.js';
4
- import { classMap } from 'lit/directives/class-map.js';
5
- import '@digital-realty/ix-field/ix-field.js';
6
- import { requestUpdateOnAriaChange } from '@material/web/internal/aria/delegate.js';
7
- import { IxDateStyles } from './ix-date-styles.js';
8
- export class IxDate extends LitElement {
9
- constructor() {
10
- super(...arguments);
11
- this.label = '';
12
- this.value = '';
13
- this.min = '';
14
- this.max = '9999-12-31';
15
- this.internals = this /* needed for closure */
16
- .attachInternals();
17
- this.disabled = false;
18
- this.errorText = '';
19
- this.required = false;
20
- this.hideError = false;
21
- // eslint-disable-next-line class-methods-use-this
22
- this.onChanged = () => { };
23
- this.focused = false;
24
- this.focusin = () => {
25
- this.focused = true;
26
- };
27
- this.clear = () => {
28
- this.value = '';
29
- };
30
- this.handleChange = (e) => {
31
- const { value } = e.target;
32
- this.value = value;
33
- this.validateDate();
34
- this.onChanged(value);
35
- };
36
- this.validateDate = () => {
37
- if (this.value) {
38
- const date = new Date(this.value);
39
- if (!date || Number.isNaN(date.valueOf())) {
40
- this.errorText = 'Invalid date format.';
41
- }
42
- }
43
- };
44
- this.focusOut = () => {
45
- this.focused = false;
46
- };
47
- }
48
- static get styles() {
49
- return [IxDateStyles];
50
- }
51
- /**
52
- * Gets or sets whether or not the text field is in a visually invalid state.
53
- *
54
- * This error state overrides the error state controlled by
55
- * `reportValidity()`.
56
- */
57
- get error() {
58
- return !!this.errorText;
59
- }
60
- /**
61
- * The associated form element with which this element's value will submit.
62
- */
63
- get form() {
64
- return this.internals.form;
65
- }
66
- /**
67
- * The labels this element is associated with.
68
- */
69
- get labels() {
70
- return this.internals.labels;
71
- }
72
- /**
73
- * The HTML name to use in form submission.
74
- */
75
- get name() {
76
- var _a;
77
- return (_a = this.getAttribute('name')) !== null && _a !== void 0 ? _a : '';
78
- }
79
- set name(name) {
80
- this.setAttribute('name', name);
81
- }
82
- /**
83
- * Returns the text field's validation error message.
84
- *
85
- * https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation
86
- */
87
- get validationMessage() {
88
- return this.internals.validationMessage;
89
- }
90
- /**
91
- * Returns a `ValidityState` object that represents the validity states of the
92
- * text field.
93
- *
94
- * https://developer.mozilla.org/en-US/docs/Web/API/ValidityState
95
- */
96
- get validity() {
97
- return this.internals.validity;
98
- }
99
- /**
100
- * Returns whether an element will successfully validate based on forms
101
- * validation rules and constraints.
102
- *
103
- * https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/willValidate
104
- */
105
- get willValidate() {
106
- return this.internals.willValidate;
107
- }
108
- checkValidity() {
109
- return this.internals.checkValidity();
110
- }
111
- reportValidity() {
112
- return this.internals.reportValidity();
113
- }
114
- /** @private */
115
- formResetCallback() {
116
- this.reset();
117
- }
118
- /**
119
- * Reset the text field to its default value.
120
- */
121
- reset() {
122
- var _a;
123
- this.clear();
124
- this.value = (_a = this.getAttribute('value')) !== null && _a !== void 0 ? _a : '';
125
- }
126
- updated() {
127
- this.internals.setValidity({
128
- badInput: this.error,
129
- }, this.error ? this.errorText : '', this.dateInput);
130
- this.internals.setFormValue(this.value);
131
- }
132
- focus() {
133
- this.dateInput.focus();
134
- }
135
- firstUpdated() {
136
- const minDate = new Date(this.min);
137
- const maxDate = new Date(this.max);
138
- if (minDate && !Number.isNaN(minDate.valueOf())) {
139
- const [min] = minDate.toISOString().split('T');
140
- this.min = min;
141
- }
142
- if (maxDate && !Number.isNaN(maxDate.valueOf())) {
143
- const [max] = maxDate.toISOString().split('T');
144
- this.max = max;
145
- }
146
- this.validateDate();
147
- }
148
- render() {
149
- const classes = {
150
- disabled: this.disabled,
151
- error: !this.disabled && this.error,
152
- };
1
+ import { __decorate } from "tslib";
2
+ import { html, LitElement } from 'lit';
3
+ import { property, query, state } from 'lit/decorators.js';
4
+ import { classMap } from 'lit/directives/class-map.js';
5
+ import '@digital-realty/ix-field/ix-field.js';
6
+ import { requestUpdateOnAriaChange } from '@material/web/internal/aria/delegate.js';
7
+ import { IxDateStyles } from './ix-date-styles.js';
8
+ export class IxDate extends LitElement {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.label = '';
12
+ this.value = '';
13
+ this.min = '';
14
+ this.max = '9999-12-31';
15
+ this.internals = this /* needed for closure */
16
+ .attachInternals();
17
+ this.disabled = false;
18
+ this.errorText = '';
19
+ this.required = false;
20
+ this.hideError = false;
21
+ // eslint-disable-next-line class-methods-use-this
22
+ this.onChanged = () => { };
23
+ this.focused = false;
24
+ this.focusin = () => {
25
+ this.focused = true;
26
+ };
27
+ this.clear = () => {
28
+ this.value = '';
29
+ };
30
+ this.handleChange = (e) => {
31
+ const { value } = e.target;
32
+ this.value = value;
33
+ this.validateDate();
34
+ this.onChanged(value);
35
+ };
36
+ this.validateDate = () => {
37
+ if (this.value) {
38
+ const date = new Date(this.value);
39
+ if (!date || Number.isNaN(date.valueOf())) {
40
+ this.errorText = 'Invalid date format.';
41
+ }
42
+ }
43
+ };
44
+ this.focusOut = () => {
45
+ this.focused = false;
46
+ };
47
+ }
48
+ static get styles() {
49
+ return [IxDateStyles];
50
+ }
51
+ /**
52
+ * Gets or sets whether or not the text field is in a visually invalid state.
53
+ *
54
+ * This error state overrides the error state controlled by
55
+ * `reportValidity()`.
56
+ */
57
+ get error() {
58
+ return !!this.errorText;
59
+ }
60
+ /**
61
+ * The associated form element with which this element's value will submit.
62
+ */
63
+ get form() {
64
+ return this.internals.form;
65
+ }
66
+ /**
67
+ * The labels this element is associated with.
68
+ */
69
+ get labels() {
70
+ return this.internals.labels;
71
+ }
72
+ /**
73
+ * The HTML name to use in form submission.
74
+ */
75
+ get name() {
76
+ var _a;
77
+ return (_a = this.getAttribute('name')) !== null && _a !== void 0 ? _a : '';
78
+ }
79
+ set name(name) {
80
+ this.setAttribute('name', name);
81
+ }
82
+ /**
83
+ * Returns the text field's validation error message.
84
+ *
85
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation
86
+ */
87
+ get validationMessage() {
88
+ return this.internals.validationMessage;
89
+ }
90
+ /**
91
+ * Returns a `ValidityState` object that represents the validity states of the
92
+ * text field.
93
+ *
94
+ * https://developer.mozilla.org/en-US/docs/Web/API/ValidityState
95
+ */
96
+ get validity() {
97
+ return this.internals.validity;
98
+ }
99
+ /**
100
+ * Returns whether an element will successfully validate based on forms
101
+ * validation rules and constraints.
102
+ *
103
+ * https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/willValidate
104
+ */
105
+ get willValidate() {
106
+ return this.internals.willValidate;
107
+ }
108
+ checkValidity() {
109
+ return this.internals.checkValidity();
110
+ }
111
+ reportValidity() {
112
+ return this.internals.reportValidity();
113
+ }
114
+ /** @private */
115
+ formResetCallback() {
116
+ this.reset();
117
+ }
118
+ /**
119
+ * Reset the text field to its default value.
120
+ */
121
+ reset() {
122
+ var _a;
123
+ this.clear();
124
+ this.value = (_a = this.getAttribute('value')) !== null && _a !== void 0 ? _a : '';
125
+ }
126
+ updated() {
127
+ this.internals.setValidity({
128
+ badInput: this.error,
129
+ }, this.error ? this.errorText : '', this.dateInput);
130
+ this.internals.setFormValue(this.value);
131
+ }
132
+ focus() {
133
+ this.dateInput.focus();
134
+ }
135
+ firstUpdated() {
136
+ const minDate = new Date(this.min);
137
+ const maxDate = new Date(this.max);
138
+ if (minDate && !Number.isNaN(minDate.valueOf())) {
139
+ const [min] = minDate.toISOString().split('T');
140
+ this.min = min;
141
+ }
142
+ if (maxDate && !Number.isNaN(maxDate.valueOf())) {
143
+ const [max] = maxDate.toISOString().split('T');
144
+ this.max = max;
145
+ }
146
+ this.validateDate();
147
+ }
148
+ render() {
149
+ const classes = {
150
+ disabled: this.disabled,
151
+ error: !this.disabled && this.error,
152
+ };
153
153
  return html `
154
154
  <ix-field
155
155
  class="${classMap(classes)}"
@@ -173,51 +173,51 @@ export class IxDate extends LitElement {
173
173
  max=${this.max}
174
174
  />
175
175
  </ix-field>
176
- `;
177
- }
178
- }
179
- (() => {
180
- requestUpdateOnAriaChange(IxDate);
181
- })();
182
- // Form association
183
- /** @nocollapse */
184
- IxDate.shadowRootOptions = {
185
- ...LitElement.shadowRootOptions,
186
- delegatesFocus: true,
187
- };
188
- /** @nocollapse */
189
- IxDate.formAssociated = true;
190
- __decorate([
191
- property({ type: String })
192
- ], IxDate.prototype, "label", void 0);
193
- __decorate([
194
- property({ type: String })
195
- ], IxDate.prototype, "value", void 0);
196
- __decorate([
197
- property({ type: String })
198
- ], IxDate.prototype, "min", void 0);
199
- __decorate([
200
- property({ type: String })
201
- ], IxDate.prototype, "max", void 0);
202
- __decorate([
203
- query('#date-input')
204
- ], IxDate.prototype, "dateInput", void 0);
205
- __decorate([
206
- property({ type: Boolean, reflect: true })
207
- ], IxDate.prototype, "disabled", void 0);
208
- __decorate([
209
- property({ type: String, attribute: 'error-text' })
210
- ], IxDate.prototype, "errorText", void 0);
211
- __decorate([
212
- property({ type: Boolean, reflect: true })
213
- ], IxDate.prototype, "required", void 0);
214
- __decorate([
215
- property({ type: Boolean, reflect: true })
216
- ], IxDate.prototype, "hideError", void 0);
217
- __decorate([
218
- property({ type: Function })
219
- ], IxDate.prototype, "onChanged", void 0);
220
- __decorate([
221
- state()
222
- ], IxDate.prototype, "focused", void 0);
176
+ `;
177
+ }
178
+ }
179
+ (() => {
180
+ requestUpdateOnAriaChange(IxDate);
181
+ })();
182
+ // Form association
183
+ /** @nocollapse */
184
+ IxDate.shadowRootOptions = {
185
+ ...LitElement.shadowRootOptions,
186
+ delegatesFocus: true,
187
+ };
188
+ /** @nocollapse */
189
+ IxDate.formAssociated = true;
190
+ __decorate([
191
+ property({ type: String })
192
+ ], IxDate.prototype, "label", void 0);
193
+ __decorate([
194
+ property({ type: String })
195
+ ], IxDate.prototype, "value", void 0);
196
+ __decorate([
197
+ property({ type: String })
198
+ ], IxDate.prototype, "min", void 0);
199
+ __decorate([
200
+ property({ type: String })
201
+ ], IxDate.prototype, "max", void 0);
202
+ __decorate([
203
+ query('#date-input')
204
+ ], IxDate.prototype, "dateInput", void 0);
205
+ __decorate([
206
+ property({ type: Boolean, reflect: true })
207
+ ], IxDate.prototype, "disabled", void 0);
208
+ __decorate([
209
+ property({ type: String, attribute: 'error-text' })
210
+ ], IxDate.prototype, "errorText", void 0);
211
+ __decorate([
212
+ property({ type: Boolean, reflect: true })
213
+ ], IxDate.prototype, "required", void 0);
214
+ __decorate([
215
+ property({ type: Boolean, reflect: true })
216
+ ], IxDate.prototype, "hideError", void 0);
217
+ __decorate([
218
+ property({ type: Function })
219
+ ], IxDate.prototype, "onChanged", void 0);
220
+ __decorate([
221
+ state()
222
+ ], IxDate.prototype, "focused", void 0);
223
223
  //# sourceMappingURL=IxDate.js.map
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { IxDate } from './IxDate.js';
1
+ export { IxDate } from './IxDate.js';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { IxDate } from './IxDate.js';
1
+ export { IxDate } from './IxDate.js';
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- export declare const IxDateStyles: import("lit").CSSResult;
1
+ export declare const IxDateStyles: import("lit").CSSResult;
@@ -1,4 +1,4 @@
1
- import { css } from 'lit';
1
+ import { css } from 'lit';
2
2
  export const IxDateStyles = css `
3
3
  :host {
4
4
  display: block;
@@ -23,5 +23,5 @@ export const IxDateStyles = css `
23
23
  input {
24
24
  height: var(--ix-line-height);
25
25
  }
26
- `;
26
+ `;
27
27
  //# sourceMappingURL=ix-date-styles.js.map
package/dist/ix-date.d.ts CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export {};
package/dist/ix-date.js CHANGED
@@ -1,3 +1,3 @@
1
- import { IxDate } from './IxDate.js';
2
- window.customElements.define('ix-date', IxDate);
1
+ import { IxDate } from './IxDate.js';
2
+ window.customElements.define('ix-date', IxDate);
3
3
  //# sourceMappingURL=ix-date.js.map
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent ix-date following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "Digital Realty",
6
- "version": "1.0.31",
6
+ "version": "1.1.2-alpha-NJEN.1",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.js",
@@ -26,11 +26,11 @@
26
26
  "test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
27
27
  },
28
28
  "dependencies": {
29
- "@digital-realty/ix-field": "^1.0.6",
29
+ "@digital-realty/ix-field": "^1.1.2-alpha-NJEN.1",
30
30
  "@digital-realty/theme": "^1.0.30",
31
31
  "@material/web": "1.2.0",
32
32
  "@web/test-runner-commands": "^0.9.0",
33
- "lit": "^2.0.2"
33
+ "lit": "^2.8.0 || ^3.0.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@custom-elements-manifest/analyzer": "^0.4.17",
@@ -100,5 +100,5 @@
100
100
  "README.md",
101
101
  "LICENSE"
102
102
  ],
103
- "gitHead": "705b8d4a1375a3ce54b1562c65d8636b98b14466"
103
+ "gitHead": "36ec59c8921745261d39d5865fb4bd1a6b97ae46"
104
104
  }