@progressive-development/pd-forms 0.5.7 → 0.6.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.
Files changed (109) hide show
  1. package/dist/generated/locale-codes.d.ts +14 -0
  2. package/dist/generated/locale-codes.d.ts.map +1 -0
  3. package/dist/generated/locales/be.d.ts +10 -0
  4. package/dist/generated/locales/be.d.ts.map +1 -0
  5. package/dist/generated/locales/de.d.ts +10 -0
  6. package/dist/generated/locales/de.d.ts.map +1 -0
  7. package/dist/generated/locales/en.d.ts +10 -0
  8. package/dist/generated/locales/en.d.ts.map +1 -0
  9. package/dist/index.d.ts +15 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +10 -10
  12. package/dist/locales/be.d.ts +2 -0
  13. package/dist/locales/de.d.ts +2 -0
  14. package/dist/locales/en.d.ts +2 -0
  15. package/dist/pd-base-input-element.d.ts +28 -0
  16. package/dist/pd-base-input-element.d.ts.map +1 -0
  17. package/dist/pd-base-input-element.js +82 -0
  18. package/dist/pd-base-ui-input.d.ts +54 -0
  19. package/dist/pd-base-ui-input.d.ts.map +1 -0
  20. package/dist/pd-base-ui-input.js +208 -0
  21. package/dist/pd-base-ui.d.ts +12 -0
  22. package/dist/pd-base-ui.d.ts.map +1 -0
  23. package/dist/{src/PdBaseUi.js → pd-base-ui.js} +9 -15
  24. package/dist/pd-button.d.ts +16 -0
  25. package/dist/pd-button.d.ts.map +1 -0
  26. package/dist/pd-button.js +154 -4
  27. package/dist/pd-checkbox.d.ts +14 -0
  28. package/dist/pd-checkbox.d.ts.map +1 -0
  29. package/dist/pd-checkbox.js +251 -4
  30. package/dist/pd-form-container.d.ts +25 -0
  31. package/dist/pd-form-container.d.ts.map +1 -0
  32. package/dist/pd-form-container.js +183 -4
  33. package/dist/pd-form-row.d.ts +12 -0
  34. package/dist/pd-form-row.d.ts.map +1 -0
  35. package/dist/pd-form-row.js +108 -4
  36. package/dist/pd-hover-box.d.ts +23 -0
  37. package/dist/pd-hover-box.d.ts.map +1 -0
  38. package/dist/pd-hover-box.js +122 -4
  39. package/dist/pd-icon-panel-button.d.ts +18 -0
  40. package/dist/pd-icon-panel-button.d.ts.map +1 -0
  41. package/dist/pd-icon-panel-button.js +242 -0
  42. package/dist/pd-input-area.d.ts +18 -0
  43. package/dist/pd-input-area.d.ts.map +1 -0
  44. package/dist/pd-input-area.js +74 -4
  45. package/dist/pd-input-file.d.ts +15 -0
  46. package/dist/pd-input-file.d.ts.map +1 -0
  47. package/dist/pd-input-file.js +91 -4
  48. package/dist/pd-input-time.d.ts +10 -0
  49. package/dist/pd-input-time.d.ts.map +1 -0
  50. package/dist/pd-input-time.js +68 -4
  51. package/dist/pd-input.d.ts +30 -0
  52. package/dist/pd-input.d.ts.map +1 -0
  53. package/dist/pd-input.js +99 -4
  54. package/dist/pd-radio-group.d.ts +9 -0
  55. package/dist/pd-radio-group.d.ts.map +1 -0
  56. package/dist/pd-radio-group.js +89 -4
  57. package/dist/pd-range.d.ts +16 -0
  58. package/dist/pd-range.d.ts.map +1 -0
  59. package/dist/pd-range.js +236 -4
  60. package/dist/pd-select.d.ts +14 -0
  61. package/dist/pd-select.d.ts.map +1 -0
  62. package/dist/pd-select.js +121 -4
  63. package/dist/stories/01_index.stories.d.ts +58 -0
  64. package/dist/stories/01_index.stories.d.ts.map +1 -0
  65. package/dist/stories/button.stories.d.ts +22 -0
  66. package/dist/stories/button.stories.d.ts.map +1 -0
  67. package/dist/stories/checkbox.stories.d.ts +28 -0
  68. package/dist/stories/checkbox.stories.d.ts.map +1 -0
  69. package/dist/stories/form-container.stories.d.ts +28 -0
  70. package/dist/stories/form-container.stories.d.ts.map +1 -0
  71. package/dist/stories/form-row.stories.d.ts +27 -0
  72. package/dist/stories/form-row.stories.d.ts.map +1 -0
  73. package/dist/stories/input-area.stories.d.ts +54 -0
  74. package/dist/stories/input-area.stories.d.ts.map +1 -0
  75. package/dist/stories/input-file.stories.d.ts +49 -0
  76. package/dist/stories/input-file.stories.d.ts.map +1 -0
  77. package/dist/stories/input.stories.d.ts +37 -0
  78. package/dist/stories/input.stories.d.ts.map +1 -0
  79. package/dist/stories/pd-icon-button.stories.d.ts +30 -0
  80. package/dist/stories/pd-icon-button.stories.d.ts.map +1 -0
  81. package/dist/stories/radio-group.stories.d.ts +9 -0
  82. package/dist/stories/radio-group.stories.d.ts.map +1 -0
  83. package/dist/stories/range.stories.d.ts +9 -0
  84. package/dist/stories/range.stories.d.ts.map +1 -0
  85. package/dist/stories/select.stories.d.ts +37 -0
  86. package/dist/stories/select.stories.d.ts.map +1 -0
  87. package/dist/styles/shared-input-field-styles.d.ts +9 -0
  88. package/dist/styles/shared-input-field-styles.d.ts.map +1 -0
  89. package/dist/{src → styles}/shared-input-field-styles.js +37 -25
  90. package/dist/styles/shared-input-styles.d.ts +10 -0
  91. package/dist/styles/shared-input-styles.d.ts.map +1 -0
  92. package/dist/{src → styles}/shared-input-styles.js +7 -6
  93. package/dist/types.d.ts +10 -0
  94. package/dist/types.d.ts.map +1 -0
  95. package/package.json +32 -47
  96. package/dist/src/PdBaseInputElement.js +0 -87
  97. package/dist/src/PdBaseUiInput.js +0 -231
  98. package/dist/src/PdButton.js +0 -194
  99. package/dist/src/PdCheckbox.js +0 -230
  100. package/dist/src/PdFormContainer.js +0 -167
  101. package/dist/src/PdFormRow.js +0 -92
  102. package/dist/src/PdHoverBox.js +0 -108
  103. package/dist/src/PdInput.js +0 -79
  104. package/dist/src/PdInputArea.js +0 -61
  105. package/dist/src/PdInputFile.js +0 -73
  106. package/dist/src/PdInputTime.js +0 -59
  107. package/dist/src/PdRadioGroup.js +0 -72
  108. package/dist/src/PdRange.js +0 -267
  109. package/dist/src/PdSelect.js +0 -125
@@ -1,108 +0,0 @@
1
- import { css, html } from "lit";
2
- import { PdBaseUI } from "./PdBaseUi.js";
3
- /**
4
- * @license
5
- * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
6
- *
7
- * Lit element container for pd input elements.
8
- *
9
- * Used to:
10
- * - Automatically validation of form content
11
- * - Success/NotReady information for form-container
12
- */
13
- class PdHoverBox extends PdBaseUI {
14
- static get properties() {
15
- return {
16
- _visible: { type: Boolean, state: true },
17
- _toBottom: { type: Boolean }
18
- };
19
- }
20
- static get styles() {
21
- return [
22
- PdBaseUI.styles,
23
- css`
24
-
25
- :host {
26
-
27
- }
28
-
29
- .hover-box {
30
- position: relative;
31
- }
32
-
33
- .info-view {
34
- position: absolute;
35
- z-index: 100;
36
- background-color: var(--pd-hover-box-bg-col, var(--pd-default-dark-col));
37
-
38
- border: 1px solid var(--pd-hover-box-border-col, var(--pd-default-col));
39
-
40
- text-align: center;
41
- padding: 10px;
42
- width: 240px;
43
-
44
- color: var(--pd-hover-box-font-col, white);
45
- font-size: var(--pd-hover-box-font-size, 0.8em);
46
-
47
- transition: opacity 0.2s ease-in;
48
- }
49
-
50
- .visible {
51
- visibility: visible;
52
- opacity: 1;
53
- }
54
-
55
- .hidden {
56
- visibility: hidden;
57
- opacity: 0;
58
- }
59
-
60
- .to-bottom {
61
- right: -3px;
62
- top: -3px;
63
- }
64
-
65
- .to-top {
66
- right: -3px;
67
- bottom: -3px;
68
- }
69
-
70
- @media (max-width: 640px) {
71
- .info-view-visible {
72
- width: 190px;
73
- }
74
- }
75
-
76
- `
77
- ];
78
- }
79
- render() {
80
- return html`
81
- <div class="hover-box">
82
-
83
- <div @click="${this._activateInfo}">
84
- <slot name="normal-view"></slot>
85
- </div>
86
-
87
- <div id="infoViewId" @click="${this._closeInfo}" class="info-view ${this._visible ? "visible" : "hidden"} ${this._toBottom ? "to-bottom" : "to-top"}">
88
- <slot name="info-view"></slot>
89
- </div>
90
-
91
- </div>
92
- `;
93
- }
94
- // eslint-disable-next-line class-methods-use-this
95
- _activateInfo(e) {
96
- const modal = this.shadowRoot.getElementById("infoViewId");
97
- const rect = modal.getBoundingClientRect();
98
- this._toBottom = !(modal.offsetHeight + rect.top + rect.height > window.innerHeight);
99
- this._visible = true;
100
- e.stopPropagation();
101
- }
102
- _closeInfo() {
103
- this._visible = false;
104
- }
105
- }
106
- export {
107
- PdHoverBox
108
- };
@@ -1,79 +0,0 @@
1
- import { css, html } from "lit";
2
- import "@progressive-development/pd-icon/pd-icon";
3
- import { INPUT_TYPE_TEXT } 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
- const onlyContainsNumbers = (str) => /^\d+$/.test(str);
10
- class PdInput extends PdBaseInputElement {
11
- static get styles() {
12
- return [
13
- PdBaseInputElement.styles,
14
- css`
15
- * {
16
- box-sizing: border-box;
17
- }
18
- `
19
- ];
20
- }
21
- static get properties() {
22
- return {
23
- /**
24
- * Icon to be shown inside `pd-input`.
25
- */
26
- icon: { type: String },
27
- secret: { type: Boolean },
28
- // True for type password
29
- minlength: { type: String },
30
- maxlength: { type: String },
31
- // max length for field,
32
- onlyNumbers: { type: Boolean }
33
- // if only numbers allowed => Refactor => dafür war type number vorgesehen, dieses attribut wird entfernt und auf type=number umgestellt
34
- };
35
- }
36
- constructor() {
37
- super();
38
- this._inputType = INPUT_TYPE_TEXT;
39
- }
40
- render() {
41
- const inputId = `${this.id}Input`;
42
- return html`
43
- ${this._renderLabel(inputId)}
44
- <div class="input ${this.errorMsg.length > 0 ? "error" : ""}">
45
- ${this.icon ? html`<pd-icon icon="${this.icon}" activeIcon @click="${this._iconClicked}"></pd-icon>` : ""}
46
- <input
47
- id="${inputId}"
48
- name="${this.name || this.valueName || this.autoCompleteName}"
49
- autocomplete=${this.autoCompleteName}
50
- class="input-style ${this.gradient ? "gradient" : ""}"
51
- type="${this.secret ? "password" : "text"}"
52
- placeholder="${this.placeHolder}"
53
- .value="${this.value}"
54
- minlength="${this.minlength}"
55
- maxlength="${this.maxlength}"
56
- ?readonly="${this.readonly}"
57
- ?disabled="${this.disabled}"
58
- @keyup="${this._onKeyUp}"
59
- @blur="${this._onBlur}"
60
-
61
- />
62
- </div>
63
- ${this._renderErrorMsg()}
64
- `;
65
- }
66
- _onKeyUp(e) {
67
- if (this.onlyNumbers && !onlyContainsNumbers(this._input.value)) {
68
- this._input.value = this._input.value.replace(/\D/g, "");
69
- } else {
70
- super._onKeyUp(e);
71
- }
72
- }
73
- _iconClicked() {
74
- this.dispatchEvent(new CustomEvent("input-icon-click"));
75
- }
76
- }
77
- export {
78
- PdInput
79
- };
@@ -1,61 +0,0 @@
1
- import { css, html } from "lit";
2
- import { INPUT_TYPE_AREA } from "./PdBaseUiInput.js";
3
- import { PdBaseInputElement } from "./PdBaseInputElement.js";
4
- /**
5
- * @license
6
- * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
7
- */
8
- class PdInputArea extends PdBaseInputElement {
9
- static get styles() {
10
- return [
11
- PdBaseInputElement.styles,
12
- css`
13
- /* overwrite default (250px), area contains 10px scroll bar */
14
- .input-style {
15
- width: var(--pd-input-field-width, 240px);
16
- }
17
- `
18
- ];
19
- }
20
- static get properties() {
21
- return {
22
- rows: { type: Number },
23
- cols: { type: Number },
24
- minlength: { type: String },
25
- maxlength: { type: String }
26
- // max length for field
27
- };
28
- }
29
- constructor() {
30
- super();
31
- this._inputType = INPUT_TYPE_AREA;
32
- this.maxlength = 500;
33
- this.rows = 2;
34
- }
35
- render() {
36
- const inputAreaId = `${this.id}InputArea`;
37
- return html`
38
- ${this._renderLabel(inputAreaId)}
39
- <div class="input ${this.errorMsg.length > 0 ? "error" : ""}">
40
- <textarea
41
- id="${inputAreaId}"
42
- name="${this.name || this.valueName || this.autoCompleteName}"
43
- autocomplete=${this.autoCompleteName}
44
- class="input-style ${this.gradient ? "gradient" : ""}"
45
- rows="${this.rows}"
46
- cols="${this.cols}"
47
- placeholder="${this.placeHolder}"
48
- ?disabled="${this.disabled}"
49
- ?readonly="${this.readonly}"
50
- .value="${this.value || ""}"
51
- @keyup="${this._onKeyUp}"
52
- @blur="${this._onBlur}"
53
- ></textarea>
54
- </div>
55
- ${this._renderErrorMsg()}
56
- `;
57
- }
58
- }
59
- export {
60
- PdInputArea
61
- };
@@ -1,73 +0,0 @@
1
- import { css, html } from "lit";
2
- import "@progressive-development/pd-icon/pd-icon";
3
- import { INPUT_TYPE_FILE } 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 PdInputFile 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
- accept: { type: String },
27
- maxlength: { type: String }
28
- // max length for field,
29
- };
30
- }
31
- constructor() {
32
- super();
33
- this._inputType = INPUT_TYPE_FILE;
34
- }
35
- render() {
36
- const inputId = `${this.id}Input`;
37
- return html`
38
- ${this._renderLabel(inputId)}
39
- <div class="input ${this.errorMsg.length > 0 ? "error" : ""}">
40
- ${this.icon ? html`<pd-icon icon="${this.icon}" activeIcon @click="${this._iconClicked}"></pd-icon>` : ""}
41
- <input
42
- id="${inputId}"
43
- name="${this.name || this.valueName || this.autoCompleteName}"
44
- class="input-style ${this.gradient ? "gradient" : ""}"
45
- type="file"
46
- maxlength="${this.maxlength}"
47
- accept="${this.accept}"
48
- ?disabled="${this.disabled}"
49
- @keyup="${this._onKeyUp}"
50
- @blur="${this._onBlur}"
51
- @change="${this._onChange}"
52
- />
53
- </div>
54
- ${this._renderErrorMsg()}
55
- `;
56
- }
57
- _onKeyUp(e) {
58
- super._onKeyUp(e);
59
- }
60
- _iconClicked() {
61
- this.dispatchEvent(new CustomEvent("input-icon-click"));
62
- }
63
- _onChange(e) {
64
- this.dispatchEvent(new CustomEvent("file-change"));
65
- }
66
- get files() {
67
- const el = this.shadowRoot.getElementById(`${this.id}Input`);
68
- return el ? el.files : void 0;
69
- }
70
- }
71
- export {
72
- PdInputFile
73
- };
@@ -1,59 +0,0 @@
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
- };
@@ -1,72 +0,0 @@
1
- import { css, html } from "lit";
2
- import { classMap } from "lit/directives/class-map.js";
3
- import { PdBaseUIInput } from "./PdBaseUiInput.js";
4
- /**
5
- * @license
6
- * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
7
- */
8
- class PdRadioGroup extends PdBaseUIInput {
9
- static get styles() {
10
- return [
11
- PdBaseUIInput.styles,
12
- css`
13
-
14
- .group-style {
15
- display: flex;
16
- gap: var(--pd-cb-group-gap, 20px);
17
- flex-direction: var(--pd-cb-group-direction, row);
18
- flex-wrap: wrap;
19
- padding: var(--pd-input-label-padding, 0);
20
- padding-top: 5px;
21
- }
22
-
23
- ::slotted(pd-checkbox) {
24
- --pd-cb-border-col-readonly: var(--pd-cb-border-col, var(--pd-default-col));
25
- }
26
-
27
- `
28
- ];
29
- }
30
- firstUpdated() {
31
- this.addEventListener("field-change", (e) => {
32
- const elCollection = this.getElementsByTagName("pd-checkbox");
33
- Object.keys(elCollection).forEach((keyValue) => {
34
- if (elCollection[keyValue] !== e.target) {
35
- elCollection[keyValue].value = "false";
36
- } else {
37
- this.value = elCollection[keyValue].valueName;
38
- }
39
- elCollection[keyValue].readonly = elCollection[keyValue].value === "true";
40
- });
41
- this.dispatchEvent(
42
- new CustomEvent("validate-form", {
43
- detail: {
44
- singleElement: this,
45
- errorMap: /* @__PURE__ */ new Map()
46
- },
47
- composed: true,
48
- bubbles: true
49
- })
50
- );
51
- });
52
- const elColl = this.getElementsByTagName("pd-checkbox");
53
- Object.keys(elColl).forEach((keyValue) => {
54
- if (elColl[keyValue].value === "true") {
55
- elColl[keyValue].readonly = true;
56
- this.value = elColl[keyValue].valueName;
57
- }
58
- });
59
- }
60
- render() {
61
- return html`
62
- ${this._renderLabel()}
63
- <div class="group-style input ${classMap({ "error": this.errorMsg.length > 0 })}">
64
- <slot></slot>
65
- </div>
66
- ${this._renderErrorMsg()}
67
- `;
68
- }
69
- }
70
- export {
71
- PdRadioGroup
72
- };