@progressive-development/pd-forms 0.5.6 → 0.5.7

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.
@@ -0,0 +1,4 @@
1
+ import { PdInputTime } from "./src/PdInputTime.js";
2
+ if (!customElements.get("pd-input-time")) {
3
+ window.customElements.define("pd-input-time", PdInputTime);
4
+ }
@@ -1,4 +1,4 @@
1
- import { PdBaseUIInput, INPUT_TYPE_DATE, INPUT_TYPE_TEXT, INPUT_TYPE_FILE, INPUT_TYPE_SELECT, INPUT_TYPE_AREA } from "./PdBaseUiInput.js";
1
+ import { PdBaseUIInput, INPUT_TYPE_DATE, INPUT_TYPE_TIME, INPUT_TYPE_TEXT, INPUT_TYPE_FILE, INPUT_TYPE_SELECT, INPUT_TYPE_AREA } from "./PdBaseUiInput.js";
2
2
  import { SharedInputFieldStyles } from "./shared-input-field-styles.js";
3
3
  /**
4
4
  * @license
@@ -73,6 +73,7 @@ class PdBaseInputElement extends PdBaseUIInput {
73
73
  return "select";
74
74
  case INPUT_TYPE_FILE:
75
75
  case INPUT_TYPE_TEXT:
76
+ case INPUT_TYPE_TIME:
76
77
  return "input";
77
78
  case INPUT_TYPE_DATE:
78
79
  return "pd-input";
@@ -39,6 +39,7 @@ const INPUT_TYPE_RANGE = 4;
39
39
  const INPUT_TYPE_AREA = 5;
40
40
  const INPUT_TYPE_DATE = 7;
41
41
  const INPUT_TYPE_FILE = 8;
42
+ const INPUT_TYPE_TIME = 9;
42
43
  const KEY_RETURN = 13;
43
44
  let delayTimer = 0;
44
45
  const DELAY_WAIT_TIME_MS = 400;
@@ -225,5 +226,6 @@ export {
225
226
  INPUT_TYPE_RANGE,
226
227
  INPUT_TYPE_SELECT,
227
228
  INPUT_TYPE_TEXT,
229
+ INPUT_TYPE_TIME,
228
230
  PdBaseUIInput
229
231
  };
@@ -0,0 +1,59 @@
1
+ import { css, html } from "lit";
2
+ import "@progressive-development/pd-icon/pd-icon";
3
+ import { INPUT_TYPE_TIME } from "./PdBaseUiInput.js";
4
+ import { PdBaseInputElement } from "./PdBaseInputElement.js";
5
+ /**
6
+ * @license
7
+ * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
8
+ */
9
+ class PdInputTime extends PdBaseInputElement {
10
+ static get styles() {
11
+ return [
12
+ PdBaseInputElement.styles,
13
+ css`
14
+ * {
15
+ box-sizing: border-box;
16
+ }
17
+ `
18
+ ];
19
+ }
20
+ static get properties() {
21
+ return {
22
+ /**
23
+ * Icon to be shown inside `pd-input`.
24
+ */
25
+ icon: { type: String }
26
+ };
27
+ }
28
+ constructor() {
29
+ super();
30
+ this._inputType = INPUT_TYPE_TIME;
31
+ }
32
+ render() {
33
+ const inputId = `${this.id}Input`;
34
+ return html`
35
+ ${this._renderLabel(inputId)}
36
+ <div class="input ${this.errorMsg.length > 0 ? "error" : ""}">
37
+ ${this.icon ? html`<pd-icon icon="${this.icon}" activeIcon @click="${this._iconClicked}"></pd-icon>` : ""}
38
+ <input
39
+ id="${inputId}"
40
+ name="${this.name || this.valueName || this.autoCompleteName}"
41
+ class="input-style ${this.gradient ? "gradient" : ""}"
42
+ type="time"
43
+ .value="${this.value}"
44
+ ?readonly="${this.readonly}"
45
+ ?disabled="${this.disabled}"
46
+ @keyup="${this._onKeyUp}"
47
+ @blur="${this._onBlur}"
48
+ />
49
+ </div>
50
+ ${this._renderErrorMsg()}
51
+ `;
52
+ }
53
+ _iconClicked() {
54
+ this.dispatchEvent(new CustomEvent("input-icon-click"));
55
+ }
56
+ }
57
+ export {
58
+ PdInputTime
59
+ };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent pd-forms following open-wc recommendations",
4
4
  "author": "PD Progressive Development",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
- "version": "0.5.6",
6
+ "version": "0.5.7",
7
7
  "main": "./dist/index.js",
8
8
  "module": "./dist/index.js",
9
9
  "exports": {
@@ -15,6 +15,7 @@
15
15
  "./pd-hover-box": "./dist/pd-hover-box.js",
16
16
  "./pd-input-area": "./dist/pd-input-area.js",
17
17
  "./pd-input-file": "./dist/pd-input-file.js",
18
+ "./pd-input-time": "./dist/pd-input-time.js",
18
19
  "./pd-input": "./dist/pd-input.js",
19
20
  "./pd-radio-group": "./dist/pd-radio-group.js",
20
21
  "./pd-range": "./dist/pd-range.js",