@progressive-development/pd-forms 0.5.7 → 0.6.0

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 (108) 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-input-area.d.ts +18 -0
  42. package/dist/pd-input-area.d.ts.map +1 -0
  43. package/dist/pd-input-area.js +74 -4
  44. package/dist/pd-input-file.d.ts +15 -0
  45. package/dist/pd-input-file.d.ts.map +1 -0
  46. package/dist/pd-input-file.js +91 -4
  47. package/dist/pd-input-time.d.ts +10 -0
  48. package/dist/pd-input-time.d.ts.map +1 -0
  49. package/dist/pd-input-time.js +68 -4
  50. package/dist/pd-input.d.ts +30 -0
  51. package/dist/pd-input.d.ts.map +1 -0
  52. package/dist/pd-input.js +99 -4
  53. package/dist/pd-radio-group.d.ts +9 -0
  54. package/dist/pd-radio-group.d.ts.map +1 -0
  55. package/dist/pd-radio-group.js +89 -4
  56. package/dist/pd-range.d.ts +16 -0
  57. package/dist/pd-range.d.ts.map +1 -0
  58. package/dist/pd-range.js +236 -4
  59. package/dist/pd-select.d.ts +14 -0
  60. package/dist/pd-select.d.ts.map +1 -0
  61. package/dist/pd-select.js +121 -4
  62. package/dist/stories/01_index.stories.d.ts +58 -0
  63. package/dist/stories/01_index.stories.d.ts.map +1 -0
  64. package/dist/stories/button.stories.d.ts +22 -0
  65. package/dist/stories/button.stories.d.ts.map +1 -0
  66. package/dist/stories/checkbox.stories.d.ts +28 -0
  67. package/dist/stories/checkbox.stories.d.ts.map +1 -0
  68. package/dist/stories/form-container.stories.d.ts +28 -0
  69. package/dist/stories/form-container.stories.d.ts.map +1 -0
  70. package/dist/stories/form-row.stories.d.ts +27 -0
  71. package/dist/stories/form-row.stories.d.ts.map +1 -0
  72. package/dist/stories/input-area.stories.d.ts +54 -0
  73. package/dist/stories/input-area.stories.d.ts.map +1 -0
  74. package/dist/stories/input-file.stories.d.ts +49 -0
  75. package/dist/stories/input-file.stories.d.ts.map +1 -0
  76. package/dist/stories/input.stories.d.ts +37 -0
  77. package/dist/stories/input.stories.d.ts.map +1 -0
  78. package/dist/stories/pd-icon-button.stories.d.ts +30 -0
  79. package/dist/stories/pd-icon-button.stories.d.ts.map +1 -0
  80. package/dist/stories/radio-group.stories.d.ts +9 -0
  81. package/dist/stories/radio-group.stories.d.ts.map +1 -0
  82. package/dist/stories/range.stories.d.ts +9 -0
  83. package/dist/stories/range.stories.d.ts.map +1 -0
  84. package/dist/stories/select.stories.d.ts +37 -0
  85. package/dist/stories/select.stories.d.ts.map +1 -0
  86. package/dist/styles/shared-input-field-styles.d.ts +9 -0
  87. package/dist/styles/shared-input-field-styles.d.ts.map +1 -0
  88. package/dist/{src → styles}/shared-input-field-styles.js +37 -25
  89. package/dist/styles/shared-input-styles.d.ts +10 -0
  90. package/dist/styles/shared-input-styles.d.ts.map +1 -0
  91. package/dist/{src → styles}/shared-input-styles.js +7 -6
  92. package/dist/types.d.ts +10 -0
  93. package/dist/types.d.ts.map +1 -0
  94. package/package.json +31 -47
  95. package/dist/src/PdBaseInputElement.js +0 -87
  96. package/dist/src/PdBaseUiInput.js +0 -231
  97. package/dist/src/PdButton.js +0 -194
  98. package/dist/src/PdCheckbox.js +0 -230
  99. package/dist/src/PdFormContainer.js +0 -167
  100. package/dist/src/PdFormRow.js +0 -92
  101. package/dist/src/PdHoverBox.js +0 -108
  102. package/dist/src/PdInput.js +0 -79
  103. package/dist/src/PdInputArea.js +0 -61
  104. package/dist/src/PdInputFile.js +0 -73
  105. package/dist/src/PdInputTime.js +0 -59
  106. package/dist/src/PdRadioGroup.js +0 -72
  107. package/dist/src/PdRange.js +0 -267
  108. package/dist/src/PdSelect.js +0 -125
@@ -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
- };
@@ -1,267 +0,0 @@
1
- import { css, html } from "lit";
2
- import { classMap } from "lit/directives/class-map.js";
3
- import { PdBaseUIInput, INPUT_TYPE_RANGE } from "./PdBaseUiInput.js";
4
- /**
5
- * @license
6
- * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
7
- */
8
- class PdRange extends PdBaseUIInput {
9
- static get properties() {
10
- return {
11
- min: { type: String },
12
- max: { type: String },
13
- step: { type: Number },
14
- optionValueMapper: { type: Object }
15
- };
16
- }
17
- constructor() {
18
- super();
19
- this._inputType = INPUT_TYPE_RANGE;
20
- this.step = 1;
21
- this.optionValueMapper = {};
22
- }
23
- static get styles() {
24
- return [
25
- PdBaseUIInput.styles,
26
- css`
27
-
28
- /* Link:
29
- * css styling: - https://css-tricks.com/styling-cross-browser-compatible-range-inputs-css/
30
- * no-empty-default - https://stackoverflow.com/questions/40302515/is-there-a-way-to-set-default-value-of-range-input-to-be-empty
31
- * => Könnte ich vlt. mit dummy element lösen => Kein Wert => Dummy wird angezeigt => Bei Klick wird Wert gesetzt und PdRange angezeigt. Oder doch Vorschlag aus StackOverflow => -1 als default Wert => Kein gesetzer Wert
32
- * Style Ticks/Lables: - https://stackoverflow.com/questions/26612700/ticks-for-type-range-html-input
33
- */
34
-
35
- /****************************************************
36
- * Style for SLIDER *
37
- ****************************************************/
38
-
39
- :host([disabled]) {
40
- --pd-range-bg-col: grey;
41
- --pd-range-thumb-col: lightgrey;
42
- }
43
-
44
- input[type=range] {
45
- -webkit-appearance: none; /* Hides the slider so that custom slider can be made */
46
- width: var(--pd-input-field-width, 250px); /* Specific width is required for Firefox. */
47
- background: transparent; /* Otherwise white in Chrome */
48
-
49
- background-color: var(--pd-range-bg-col, var(--pd-default-col));
50
- padding: 0.5rem;
51
- height: var(--pd-input-field-range-height, 1.7rem);
52
- box-sizing: border-box;
53
-
54
- border-radius: 0.75rem;
55
- }
56
-
57
- input[type=range]:focus {
58
- /* Removes the blue border.
59
- * You should probably do some kind of focus styling for accessibility reasons though. */
60
- outline: none;
61
- }
62
-
63
- /****************************************************
64
- * Style for THUMBS specific for different browser *
65
- * Check: Possible to extract common definitions? *
66
- * => Note that while we’re repeating code here, *
67
- * that’s necessary as you can’t comma-separate *
68
- * these type of selectors. Browsers will drop *
69
- * the entire selector if it doesn’t understand *
70
- * a part of it. *
71
- ****************************************************/
72
-
73
- /**
74
- * Standard/Chrome thumb definition.
75
- */
76
- input[type=range]::-webkit-slider-thumb {
77
- /* Hide the standard thumb element */
78
- -webkit-appearance: none;
79
- /*margin-top: -14px; /* You need to specify a margin in Chrome, but in Firefox and IE it is automatic */
80
- margin-top: -6px; /* squi.cards value */
81
-
82
- /* redundant, check if it is possible to extract common definitions */
83
- cursor: pointer;
84
- height: 15px;
85
- width: 39px;
86
- background: var(--pd-range-thumb-col, var(--pd-default-hover-col));
87
- border: 1px solid var(--pd-default-dark-col);
88
- border-radius: 3px;
89
- box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
90
- }
91
-
92
- /**
93
- * Firefox thumb definition.
94
- */
95
- input[type=range]::-moz-range-thumb {
96
- /* redundant, check if it is possible to extract common definitions */
97
- cursor: pointer;
98
- height: 15px;
99
- width: 39px;
100
- background: var(--pd-range-thumb-col, var(--pd-default-hover-col));
101
- border: 1px solid var(--pd-default-dark-col);
102
- border-radius: 3px;
103
- box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
104
- }
105
-
106
- /**
107
- * IE Thum definiton.
108
- */
109
- input[type=range]::-ms-thumb {
110
- /* redundant, check if it is possible to extract common definitions */
111
- cursor: pointer;
112
- height: 15px;
113
- width: 39px;
114
- background: var(--pd-range-thumb-col, var(--pd-default-hover-col));
115
- border: 1px solid var(--pd-default-dark-col);
116
- border-radius: 3px;
117
- box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
118
- }
119
-
120
-
121
- /****************************************************
122
- * Style for TRACK specific for different browser *
123
- * (see thumbs styles) *
124
- ****************************************************/
125
-
126
- /**
127
- * Standard/Chrome track definition.
128
- */
129
- input[type=range]::-webkit-slider-runnable-track {
130
- width: 100%;
131
- height: 8.4px;
132
- cursor: pointer;
133
- box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
134
- background: var(--pd-range-track-col, var(--pd-default-light-col));
135
- border: 0.2px solid #010101;
136
-
137
- border-radius: 0.75rem;
138
- }
139
-
140
- input[type=range]:focus::-webkit-slider-runnable-track {
141
- background: var(--pd-range-track-hover-col, var(--pd-default-light-col));
142
- border: 0.2px solid var(--pd-default-hover-col);
143
- }
144
-
145
- /**
146
- * Firefox track definition.
147
- */
148
- input[type=range]::-moz-range-track {
149
- width: 100%;
150
- height: 8.4px;
151
- cursor: pointer;
152
- box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
153
- background: var(--pd-range-track-col, var(--pd-default-light-col));
154
- border-radius: 0.75rem;
155
- border: 0.2px solid #010101;
156
- }
157
-
158
- /**
159
- * IE track definition.
160
- * Check: Why are they different.
161
- */
162
- input[type=range]::-ms-track {
163
-
164
- height: 8.4px;
165
- width: 100%;
166
- cursor: pointer;
167
-
168
- /* Hides the slider so custom styles can be added */
169
- background: transparent;
170
- border-color: transparent;
171
- color: transparent;
172
-
173
- border-width: 16px 0;
174
- }
175
- input[type=range]::-ms-fill-lower {
176
- background: var(--pd-range-track-col, var(--pd-default-light-col));
177
- border: 0.2px solid #010101;
178
- border-radius: 0.75rem;
179
- box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
180
- }
181
- input[type=range]:focus::-ms-fill-lower {
182
- background: #3071a9;
183
- }
184
- input[type=range]::-ms-fill-upper {
185
- background: var(--pd-range-track-col, var(--pd-default-light-col));
186
- border: 0.2px solid #010101;
187
- border-radius: 0.75rem;
188
- box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
189
- }
190
- input[type=range]:focus::-ms-fill-upper {
191
- background: #367ebd;
192
- }
193
-
194
- /*
195
- Der Style für ticks ist noch temporär, Bereinigung unf Anpassung.
196
- TODO: Fest derzeit 5 Elemente
197
- */
198
- .ticks {
199
- display: flex;
200
- justify-content: space-between;
201
- padding: 10px 30px;
202
- }
203
-
204
- .tick {
205
- line-height: 5px;
206
- height: 5px;
207
- margin-top: -13px;
208
- font-size: 8pt;
209
- font-weight: bolder;
210
- }
211
-
212
- .ticks.disabled {
213
- color: grey;
214
- }
215
-
216
- .ticks.enabled {
217
- color: var(--pd-default-col);
218
- }
219
-
220
- @media (max-width: 650px) {
221
- label {
222
- font-size: 12px;
223
- }
224
- }
225
-
226
- `
227
- ];
228
- }
229
- render() {
230
- const inputId = `${this.id}Range`;
231
- return html`
232
- ${this._renderLabel(inputId, this.optionValueMapper[this.value] || this.value)}
233
- <div class="input-range ${classMap({ error: this.errorMsg.length > 0 })}">
234
- <input
235
- id="${inputId}"
236
- name="${this.name || this.valueName}"
237
- class="input-range-style ${this.gradient ? "gradient" : ""}"
238
- type="range"
239
- .value="${this.value}"
240
- ?readonly="${this.readonly}"
241
- ?disabled="${this.disabled}"
242
- min="${this.min}" max="${this.max}" step="1"
243
- @change="${this._onChange}"
244
- @input="${this._onChange}"
245
- >
246
- <div class="ticks ${this.disabled ? "disabled" : "enabled"}">
247
- <span class="tick">|</span>
248
- <span class="tick">|</span>
249
- <span class="tick">|</span>
250
- <span class="tick">|</span>
251
- <span class="tick">|</span>
252
- </div>
253
-
254
- </div>
255
- ${this._renderErrorMsg()}
256
- `;
257
- }
258
- firstUpdated() {
259
- this._input = this.shadowRoot.querySelector("input");
260
- }
261
- _onChange(e) {
262
- this._handleChangedValue(this._input.value, e, false);
263
- }
264
- }
265
- export {
266
- PdRange
267
- };
@@ -1,125 +0,0 @@
1
- import { css, html } from "lit";
2
- import { INPUT_TYPE_SELECT } 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 PdSelect extends PdBaseInputElement {
9
- static get styles() {
10
- return [
11
- PdBaseInputElement.styles,
12
- css`
13
- /* Select style */
14
- /* https://css-tricks.com/styling-a-select-like-its-2019/
15
- class applies to select element itself, not a wrapper element */
16
- .select-css {
17
- display: block;
18
-
19
- -moz-appearance: none;
20
- -webkit-appearance: none;
21
- appearance: none;
22
- padding: 5px;
23
-
24
- background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
25
- background-repeat: no-repeat, repeat;
26
- /* arrow icon position (1em from the right, 50% vertical) , then gradient position*/
27
- background-position: right 0.5em top 50%, 0 0;
28
- /* icon size, then gradient */
29
- background-size: 0.65em auto, 100%;
30
- max-width: 100%; /* useful when width is set to anything other than 100% */
31
- }
32
-
33
- /* Hide arrow icon in IE browsers */
34
- .select-css::-ms-expand {
35
- display: none;
36
- }
37
-
38
- /* Set options to normal weight */
39
- .select-css option {
40
- font-weight: normal;
41
- text-indent: 5px;
42
- }
43
-
44
- /* [aria-disabled='true'] */
45
-
46
- .gradient {
47
- /* Define color */
48
- background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E'),
49
- linear-gradient(
50
- to bottom,
51
- var(--my-background-gradient-color),
52
- var(--my-background-color)
53
- );
54
- background-color: var(--my-background-color);
55
- }
56
-
57
- .error .gradient {
58
- background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22graytext%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E'),
59
- linear-gradient(
60
- to bottom,
61
- var(--my-background-gradient-color) 10%,
62
- #f5979b 100%
63
- );
64
- /* repeat instructions because of setted background in shared-styles */
65
- background-repeat: no-repeat, repeat;
66
- /* arrow icon position (1em from the right, 50% vertical) , then gradient position*/
67
- background-position: right 0.5em top 50%, 0 0;
68
- /* icon size, then gradient */
69
- background-size: 0.65em auto, 100%;
70
- background-color: var(--my-error-background-color);
71
- }
72
- `
73
- ];
74
- }
75
- static get properties() {
76
- return {
77
- values: { type: Array }
78
- };
79
- }
80
- constructor() {
81
- super();
82
- this._inputType = INPUT_TYPE_SELECT;
83
- this.values = [];
84
- }
85
- render() {
86
- const selectId = `${this.id}Select`;
87
- return html`
88
- ${this._renderLabel(selectId)}
89
- <div class="input ${this.errorMsg.length > 0 ? "error" : ""}">
90
- <select
91
- id="${selectId}"
92
- class="input-style select-css ${this.gradient ? "gradient" : ""}"
93
- ?disabled="${this.disabled}"
94
- name="${this.name || this.valueName || this.autoCompleteName}"
95
- autocomplete=${this.autoCompleteName}
96
- @change="${this._onKeyUp}"
97
- @keyup="${this._onSelectKeyUp}"
98
- @blur="${this._onBlur}"
99
- >
100
- ${this.values.map(
101
- (val) => html`
102
- <option
103
- value="${val.value}"
104
- ?selected=${// eslint-disable-next-line eqeqeq
105
- this.value == val.value}
106
- >
107
- ${val.name}
108
- </option>
109
- `
110
- )}
111
- </select>
112
- </div>
113
- ${this._renderErrorMsg()}
114
- `;
115
- }
116
- /**
117
- * At the moment specific for select.
118
- */
119
- // eslint-disable-next-line class-methods-use-this
120
- _onSelectKeyUp() {
121
- }
122
- }
123
- export {
124
- PdSelect
125
- };