@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.
- package/dist/generated/locale-codes.d.ts +14 -0
- package/dist/generated/locale-codes.d.ts.map +1 -0
- package/dist/generated/locales/be.d.ts +10 -0
- package/dist/generated/locales/be.d.ts.map +1 -0
- package/dist/generated/locales/de.d.ts +10 -0
- package/dist/generated/locales/de.d.ts.map +1 -0
- package/dist/generated/locales/en.d.ts +10 -0
- package/dist/generated/locales/en.d.ts.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -10
- package/dist/locales/be.d.ts +2 -0
- package/dist/locales/de.d.ts +2 -0
- package/dist/locales/en.d.ts +2 -0
- package/dist/pd-base-input-element.d.ts +28 -0
- package/dist/pd-base-input-element.d.ts.map +1 -0
- package/dist/pd-base-input-element.js +82 -0
- package/dist/pd-base-ui-input.d.ts +54 -0
- package/dist/pd-base-ui-input.d.ts.map +1 -0
- package/dist/pd-base-ui-input.js +208 -0
- package/dist/pd-base-ui.d.ts +12 -0
- package/dist/pd-base-ui.d.ts.map +1 -0
- package/dist/{src/PdBaseUi.js → pd-base-ui.js} +9 -15
- package/dist/pd-button.d.ts +16 -0
- package/dist/pd-button.d.ts.map +1 -0
- package/dist/pd-button.js +154 -4
- package/dist/pd-checkbox.d.ts +14 -0
- package/dist/pd-checkbox.d.ts.map +1 -0
- package/dist/pd-checkbox.js +251 -4
- package/dist/pd-form-container.d.ts +25 -0
- package/dist/pd-form-container.d.ts.map +1 -0
- package/dist/pd-form-container.js +183 -4
- package/dist/pd-form-row.d.ts +12 -0
- package/dist/pd-form-row.d.ts.map +1 -0
- package/dist/pd-form-row.js +108 -4
- package/dist/pd-hover-box.d.ts +23 -0
- package/dist/pd-hover-box.d.ts.map +1 -0
- package/dist/pd-hover-box.js +122 -4
- package/dist/pd-icon-panel-button.d.ts +18 -0
- package/dist/pd-icon-panel-button.d.ts.map +1 -0
- package/dist/pd-icon-panel-button.js +242 -0
- package/dist/pd-input-area.d.ts +18 -0
- package/dist/pd-input-area.d.ts.map +1 -0
- package/dist/pd-input-area.js +74 -4
- package/dist/pd-input-file.d.ts +15 -0
- package/dist/pd-input-file.d.ts.map +1 -0
- package/dist/pd-input-file.js +91 -4
- package/dist/pd-input-time.d.ts +10 -0
- package/dist/pd-input-time.d.ts.map +1 -0
- package/dist/pd-input-time.js +68 -4
- package/dist/pd-input.d.ts +30 -0
- package/dist/pd-input.d.ts.map +1 -0
- package/dist/pd-input.js +99 -4
- package/dist/pd-radio-group.d.ts +9 -0
- package/dist/pd-radio-group.d.ts.map +1 -0
- package/dist/pd-radio-group.js +89 -4
- package/dist/pd-range.d.ts +16 -0
- package/dist/pd-range.d.ts.map +1 -0
- package/dist/pd-range.js +236 -4
- package/dist/pd-select.d.ts +14 -0
- package/dist/pd-select.d.ts.map +1 -0
- package/dist/pd-select.js +121 -4
- package/dist/stories/01_index.stories.d.ts +58 -0
- package/dist/stories/01_index.stories.d.ts.map +1 -0
- package/dist/stories/button.stories.d.ts +22 -0
- package/dist/stories/button.stories.d.ts.map +1 -0
- package/dist/stories/checkbox.stories.d.ts +28 -0
- package/dist/stories/checkbox.stories.d.ts.map +1 -0
- package/dist/stories/form-container.stories.d.ts +28 -0
- package/dist/stories/form-container.stories.d.ts.map +1 -0
- package/dist/stories/form-row.stories.d.ts +27 -0
- package/dist/stories/form-row.stories.d.ts.map +1 -0
- package/dist/stories/input-area.stories.d.ts +54 -0
- package/dist/stories/input-area.stories.d.ts.map +1 -0
- package/dist/stories/input-file.stories.d.ts +49 -0
- package/dist/stories/input-file.stories.d.ts.map +1 -0
- package/dist/stories/input.stories.d.ts +37 -0
- package/dist/stories/input.stories.d.ts.map +1 -0
- package/dist/stories/pd-icon-button.stories.d.ts +30 -0
- package/dist/stories/pd-icon-button.stories.d.ts.map +1 -0
- package/dist/stories/radio-group.stories.d.ts +9 -0
- package/dist/stories/radio-group.stories.d.ts.map +1 -0
- package/dist/stories/range.stories.d.ts +9 -0
- package/dist/stories/range.stories.d.ts.map +1 -0
- package/dist/stories/select.stories.d.ts +37 -0
- package/dist/stories/select.stories.d.ts.map +1 -0
- package/dist/styles/shared-input-field-styles.d.ts +9 -0
- package/dist/styles/shared-input-field-styles.d.ts.map +1 -0
- package/dist/{src → styles}/shared-input-field-styles.js +37 -25
- package/dist/styles/shared-input-styles.d.ts +10 -0
- package/dist/styles/shared-input-styles.d.ts.map +1 -0
- package/dist/{src → styles}/shared-input-styles.js +7 -6
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +32 -47
- package/dist/src/PdBaseInputElement.js +0 -87
- package/dist/src/PdBaseUiInput.js +0 -231
- package/dist/src/PdButton.js +0 -194
- package/dist/src/PdCheckbox.js +0 -230
- package/dist/src/PdFormContainer.js +0 -167
- package/dist/src/PdFormRow.js +0 -92
- package/dist/src/PdHoverBox.js +0 -108
- package/dist/src/PdInput.js +0 -79
- package/dist/src/PdInputArea.js +0 -61
- package/dist/src/PdInputFile.js +0 -73
- package/dist/src/PdInputTime.js +0 -59
- package/dist/src/PdRadioGroup.js +0 -72
- package/dist/src/PdRange.js +0 -267
- package/dist/src/PdSelect.js +0 -125
package/dist/src/PdButton.js
DELETED
|
@@ -1,194 +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
|
-
class PdButton extends PdBaseUI {
|
|
8
|
-
/**
|
|
9
|
-
* @event button-clicked
|
|
10
|
-
*/
|
|
11
|
-
static get styles() {
|
|
12
|
-
return [
|
|
13
|
-
PdBaseUI.styles,
|
|
14
|
-
css`
|
|
15
|
-
:host {
|
|
16
|
-
|
|
17
|
-
font-family: var(--pd-default-font-title-family);
|
|
18
|
-
font-size: var(--pd-button-font-size, 1em);
|
|
19
|
-
font-weight: var(--pd-button-font-weight, normal);
|
|
20
|
-
|
|
21
|
-
/*
|
|
22
|
-
height: 100%;
|
|
23
|
-
width: 100%; => Ohne diese Angabe eht die % Angaben icht
|
|
24
|
-
*/
|
|
25
|
-
margin: 0.5rem;
|
|
26
|
-
margin-left: 0; /* Um gleich zum input field zu sein */
|
|
27
|
-
|
|
28
|
-
pointer-events: none;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.button-div {
|
|
32
|
-
|
|
33
|
-
display: flex;
|
|
34
|
-
justify-content: center;
|
|
35
|
-
align-items: center;
|
|
36
|
-
width: var(--pd-button-width, 140px);
|
|
37
|
-
height: var(--pd-button-height, 2rem);
|
|
38
|
-
|
|
39
|
-
border-radius: var(--pd-border-radius, 1px);
|
|
40
|
-
|
|
41
|
-
background-color: var(--pd-button-bg-col, var(--pd-default-dark-col));
|
|
42
|
-
color: var(--pd-button-font-col, var(--pd-default-bg-col));
|
|
43
|
-
border: var(--pd-button-border, 0);
|
|
44
|
-
cursor: pointer;
|
|
45
|
-
|
|
46
|
-
box-shadow: var(--pd-button-box-shadow, none);
|
|
47
|
-
|
|
48
|
-
pointer-events: all;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
:host(:not([disabled])) .button-div:hover {
|
|
52
|
-
box-shadow: var(--pd-button-box-shadow-hover, -1px 1px 2px var(--pd-default-dark-col));
|
|
53
|
-
background-color: var(--pd-button-bg-col-hover, var(--pd-default-hover-col));
|
|
54
|
-
color: var(--pd-button-font-col-hover, var(--pd-default-dark-col));
|
|
55
|
-
transition: background-color 0.4s ease 0s;
|
|
56
|
-
--pd-button-border: var(--pd-button-border-hover);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
:host(:not([disabled])):host([primary]) .button-div:hover {
|
|
60
|
-
background-color: var(--pd-button-primary-bg-col-hover, var(--pd-default-hover-col));
|
|
61
|
-
color: var(--pd-button-primary-font-col-hover, var(--pd-default-bg-col));
|
|
62
|
-
--pd-button-border: var(--pd-button-border-hover);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
:host([primary]) .button-div {
|
|
66
|
-
background-color: var(--pd-button-primary-bg-col, var(--pd-default-col));
|
|
67
|
-
color: var(--pd-button-primary-font-col, var(--pd-default-bg-col));
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
:host([gradient]) .button-div {
|
|
71
|
-
background: linear-gradient(to right, var(--my-background-gradient-color, red) 0%, var(--my-background-color, blue) 100%);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
:host([disabled]) .button-div {
|
|
75
|
-
cursor: auto;
|
|
76
|
-
border-color: var(--pd-default-disabled-col);
|
|
77
|
-
background-color: var(--pd-button-bg-col-disabled, var(--pd-default-disabled-col));
|
|
78
|
-
color: var(--pd-button-font-col-disabled, black);
|
|
79
|
-
--pd-button-border: var(--pd-button-border-disabled);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/* Style for Button */
|
|
83
|
-
a {
|
|
84
|
-
display: inline-block;
|
|
85
|
-
text-decoration: none;
|
|
86
|
-
border: none;
|
|
87
|
-
white-space: nowrap;
|
|
88
|
-
margin: 0.5rem;
|
|
89
|
-
pointer-events: none;
|
|
90
|
-
|
|
91
|
-
/*box-shadow: -2px 2px 4px #999;/* TODO: From var */
|
|
92
|
-
/*border-bottom: 1px solid var(--my-border-color);*/
|
|
93
|
-
/*will-change: transform; Dann über Menu bei Scroll...*/
|
|
94
|
-
|
|
95
|
-
/*
|
|
96
|
-
transition-property: box-shadow, background;
|
|
97
|
-
transition: .2s ease-in;
|
|
98
|
-
box-sizing: border-box;
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
/*overflow: hidden;
|
|
102
|
-
text-overflow: ellipsis;*/
|
|
103
|
-
|
|
104
|
-
/*padding: var(--squi-input-padding, .5rem);*/
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
/* button icon not integrated at the moment */
|
|
109
|
-
.button-icon {
|
|
110
|
-
display: flex;
|
|
111
|
-
align-items: center;
|
|
112
|
-
justify-content: center;
|
|
113
|
-
white-space: nowrap;
|
|
114
|
-
--pd-icon-fill: var(--icon-fill-light);
|
|
115
|
-
--pd-icon-fill-hover: var(--icon-fill-light);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.button-icon:not([disabled]) {
|
|
119
|
-
--pd-icon-fill: var(--app-primary-color);
|
|
120
|
-
--pd-icon-fill-hover: var(--app-primary-color-dark);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.button-icon pd-icon {
|
|
124
|
-
max-width: 1.25rem;
|
|
125
|
-
height: 1.25rem;
|
|
126
|
-
width: 1.25rem;
|
|
127
|
-
margin: 0 .15rem;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.button-icon.small pd-icon {
|
|
131
|
-
max-width: 1.25rem;
|
|
132
|
-
height: 1.25rem;
|
|
133
|
-
width: 1.25rem;
|
|
134
|
-
padding-right: 0.15rem;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.button-icon svg {
|
|
138
|
-
max-width: 1rem;
|
|
139
|
-
height: 1rem;
|
|
140
|
-
width: 1rem;
|
|
141
|
-
padding-right: .5rem;
|
|
142
|
-
fill: var(--app-primary-color);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.button-icon:hover pd-icon,
|
|
146
|
-
.button-icon:hover svg {
|
|
147
|
-
fill: var(--app-primary-color);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
@media (min-width: 580px) {
|
|
151
|
-
.button-icon pd-icon {
|
|
152
|
-
margin: 0 .5rem;
|
|
153
|
-
}
|
|
154
|
-
.button-icon.small pd-icon {
|
|
155
|
-
padding-right: .5rem;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
`
|
|
160
|
-
];
|
|
161
|
-
}
|
|
162
|
-
static get properties() {
|
|
163
|
-
return {
|
|
164
|
-
primary: { type: Boolean },
|
|
165
|
-
gradient: { type: Boolean },
|
|
166
|
-
disabled: { type: Boolean },
|
|
167
|
-
text: { type: String },
|
|
168
|
-
value: { type: String }
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
constructor() {
|
|
172
|
-
super();
|
|
173
|
-
this.primary = false;
|
|
174
|
-
this.gradient = false;
|
|
175
|
-
this.disabled = false;
|
|
176
|
-
this.text = "Ok";
|
|
177
|
-
}
|
|
178
|
-
render() {
|
|
179
|
-
return html`
|
|
180
|
-
<div @click="${this._handleClick}" class="button-div">
|
|
181
|
-
<a ?disabled="${this.disabled}">${this.text}</a>
|
|
182
|
-
</div>`;
|
|
183
|
-
}
|
|
184
|
-
_handleClick() {
|
|
185
|
-
if (!this.disabled) {
|
|
186
|
-
this.dispatchEvent(new CustomEvent("button-clicked", {
|
|
187
|
-
detail: this.value
|
|
188
|
-
}));
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
export {
|
|
193
|
-
PdButton
|
|
194
|
-
};
|
package/dist/src/PdCheckbox.js
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import { css, html } from "lit";
|
|
2
|
-
import { classMap } from "lit/directives/class-map.js";
|
|
3
|
-
import "@progressive-development/pd-icon/pd-icon";
|
|
4
|
-
import { PdBaseUIInput, INPUT_TYPE_CHECK } from "./PdBaseUiInput.js";
|
|
5
|
-
/**
|
|
6
|
-
* @license
|
|
7
|
-
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
8
|
-
*/
|
|
9
|
-
class PdCheckbox extends PdBaseUIInput {
|
|
10
|
-
static get properties() {
|
|
11
|
-
return {
|
|
12
|
-
isSwitch: { type: Boolean },
|
|
13
|
-
_hasInner: { type: Boolean, state: true }
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
constructor() {
|
|
17
|
-
super();
|
|
18
|
-
this._inputType = INPUT_TYPE_CHECK;
|
|
19
|
-
}
|
|
20
|
-
static get styles() {
|
|
21
|
-
return [
|
|
22
|
-
PdBaseUIInput.styles,
|
|
23
|
-
css`
|
|
24
|
-
:host {
|
|
25
|
-
display: inline-block;
|
|
26
|
-
|
|
27
|
-
/* Style for active checkbox => use defaults from pd-icon if no custom properties set */
|
|
28
|
-
--pd-icon-col-active: var(--pd-cb-col);
|
|
29
|
-
--pd-icon-col-active-hover: var(--pd-cb-col-hover);
|
|
30
|
-
--pd-icon-bg-col-active: var(--pd-cb-bg-col);
|
|
31
|
-
--pd-icon-stroke-col-active: var(--pd-cb-stroke-col);
|
|
32
|
-
--pd-icon-stroke-col-active-hover: var(--pd-cb-stroke-col-hover);
|
|
33
|
-
|
|
34
|
-
/* Style for inactive checkbox */
|
|
35
|
-
--pd-icon-col: var(--pd-cb-unset-col);
|
|
36
|
-
--pd-icon-col-hover: var(--pd-cb-unset-col-hover);
|
|
37
|
-
--pd-icon-bg-col: var(--pd-cb-unset-bg-col);
|
|
38
|
-
--pd-icon-stroke-col: var(--pd-cb-unset-stroke-col);
|
|
39
|
-
--pd-icon-stroke-col-hover: var(--pd-cb-unset-stroke-col-hover);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/* Switch pd-icon => Prüfen, bei mir musste ich reflect setzten, wird das verwendet? */
|
|
43
|
-
:host([isSwitch]) {
|
|
44
|
-
/* derzeit keine Angaben */
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.div-container {
|
|
48
|
-
display: flex;
|
|
49
|
-
align-items: center;
|
|
50
|
-
cursor: pointer;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.div-container.disabled {
|
|
54
|
-
opacity: 0.5;
|
|
55
|
-
cursor: auto;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.div-container.readonly {
|
|
59
|
-
cursor: auto;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/*
|
|
63
|
-
* Class checkbox for icon and a element (checkbox case)
|
|
64
|
-
*/
|
|
65
|
-
.checkbox {
|
|
66
|
-
display: flex;
|
|
67
|
-
border-radius: 4px;
|
|
68
|
-
line-height: 0;
|
|
69
|
-
align-items: center;
|
|
70
|
-
justify-content: center;
|
|
71
|
-
/*
|
|
72
|
-
Wurde das hier für Border verwendet? Aktuell border in folgendem Element gesetzt
|
|
73
|
-
background-color: var(--pd-cb-border-col, var(--pd-primary-col, #067394));
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.checkbox pd-icon {
|
|
79
|
-
margin-right: .2rem;
|
|
80
|
-
margin-bottom: .2rem;
|
|
81
|
-
border: 2px solid var(--pd-cb-border-col, var(--pd-default-col));
|
|
82
|
-
border-radius: var(--pd-cb-border-radius, 3px);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.label {
|
|
86
|
-
margin-left: 0.1rem;
|
|
87
|
-
color: var(--pd-cb-font-col, var(--pd-default-font-input-col));
|
|
88
|
-
font-family: var(--pd-default-font-input-family);
|
|
89
|
-
text-align: left;
|
|
90
|
-
font-size: var(--pd-default-font-input-size);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.readonly .label {
|
|
94
|
-
color: var(--pd-cb-font-col-readonly, #4d4d4d);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.readonly .checkbox pd-icon {
|
|
98
|
-
border-color: var(--pd-cb-border-col-readonly, transparent);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/* Switch styles */
|
|
102
|
-
.switch {
|
|
103
|
-
height: var(--pd-cb-switch-height);
|
|
104
|
-
position: relative;
|
|
105
|
-
outline: 0;
|
|
106
|
-
-webkit-user-select: none;
|
|
107
|
-
-moz-user-select: none;
|
|
108
|
-
-ms-user-select: none;
|
|
109
|
-
user-select: none;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.switch .label {
|
|
113
|
-
margin-left: 0.5rem;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.switch-paddle {
|
|
117
|
-
display: inline-block;
|
|
118
|
-
vertical-align: baseline;
|
|
119
|
-
margin: 0;
|
|
120
|
-
position: relative;
|
|
121
|
-
min-width: 4rem;
|
|
122
|
-
max-width: 4rem;
|
|
123
|
-
height: 2rem;
|
|
124
|
-
border-radius: 0;
|
|
125
|
-
background: var(--pd-cb-switch-paddle-col, var(--pd-default-col));
|
|
126
|
-
font-weight: inherit;
|
|
127
|
-
color: inherit;
|
|
128
|
-
cursor: pointer;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.switch-paddle pd-icon {
|
|
132
|
-
position: absolute;
|
|
133
|
-
top: 0;
|
|
134
|
-
left: 0;
|
|
135
|
-
display: block;
|
|
136
|
-
width: 1.5rem;
|
|
137
|
-
height: 1.5rem;
|
|
138
|
-
-webkit-transform: translate3d(0, 0, 0);
|
|
139
|
-
transform: translate3d(0, 0, 0);
|
|
140
|
-
border: 2px solid var(--pd-cb-border-col, var(--pd-default-col));
|
|
141
|
-
box-shadow: rgba(0, 0, 0, 0.15) 1.95px 1.95px 2.6px;
|
|
142
|
-
border-radius: var(--pd-cb-border-radius, 4px);
|
|
143
|
-
-webkit-transition: all 0.25s ease-out;
|
|
144
|
-
transition: all 0.25s ease-out;
|
|
145
|
-
content: '';
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.disabled .switch-paddle {
|
|
149
|
-
cursor: auto;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.readonly .switch-paddle {
|
|
153
|
-
cursor: auto;
|
|
154
|
-
max-width: 2rem;
|
|
155
|
-
min-width: 2rem;
|
|
156
|
-
background: none;
|
|
157
|
-
|
|
158
|
-
/* Prüfen TODO
|
|
159
|
-
--pd-icon-bg: transparent;
|
|
160
|
-
--pd-icon-fill: var(--card-dark-red);
|
|
161
|
-
--pd-icon-fill-hover: var(--pd-icon-fill);
|
|
162
|
-
--pd-icon-fill-active: var(--card-medium-green);
|
|
163
|
-
*/
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.readonly .switch-paddle pd-icon {
|
|
167
|
-
border-color: var(--pd-cb-border-col-readonly, transparent);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.readonly .isChecked.switch-paddle pd-icon {
|
|
171
|
-
transform: translate3d(0, 0, 0);
|
|
172
|
-
left: 0rem;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.isChecked.switch-paddle pd-icon {
|
|
176
|
-
left: 2.25rem;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
@media (min-width: 580px) {
|
|
180
|
-
:host {
|
|
181
|
-
font-size: 1rem;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
`
|
|
185
|
-
];
|
|
186
|
-
}
|
|
187
|
-
render() {
|
|
188
|
-
if (!this._hasInnerSet) {
|
|
189
|
-
this._hasInnerSet = true;
|
|
190
|
-
this._hasInner = !!this.innerHTML.trim().length;
|
|
191
|
-
}
|
|
192
|
-
const checked = this.value === "true";
|
|
193
|
-
const classMapVal = { "disabled": this.disabled, "switch": this.isSwitch, "readonly": this.readonly, "div-container": true };
|
|
194
|
-
const aClassMap = { "switch-paddle": this.isSwitch, "checkbox": !this.isSwitch, "isChecked": checked, "isUnchecked": !checked };
|
|
195
|
-
const inputId = `${this.id}Check`;
|
|
196
|
-
return html`
|
|
197
|
-
${this._renderLabel(inputId)}
|
|
198
|
-
<div @click="${this.onClick}" class="${classMap(classMapVal)}">
|
|
199
|
-
<a href="#" @click="${this.linkClick}" @keypress="${this.onKeyPress}" class="${classMap(aClassMap)}">
|
|
200
|
-
<pd-icon icon="${this.isSwitch ? "checkBox" : "checkBoxOnlyCheck"}" class="small" ?activeIcon="${checked}"></pd-icon>
|
|
201
|
-
</a>
|
|
202
|
-
${this._hasInner ? html`
|
|
203
|
-
<span class="label">
|
|
204
|
-
<slot></slot>
|
|
205
|
-
</span>` : ""}
|
|
206
|
-
</div>
|
|
207
|
-
${this._renderErrorMsg()}
|
|
208
|
-
`;
|
|
209
|
-
}
|
|
210
|
-
onClick(e) {
|
|
211
|
-
if (this.disabled || this.readonly) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
const checked = this.value === "true";
|
|
215
|
-
this._handleChangedValue(checked ? "false" : "true", e);
|
|
216
|
-
}
|
|
217
|
-
onKeyPress(e) {
|
|
218
|
-
e.preventDefault();
|
|
219
|
-
if (e.keyCode === 32 || e.code === "Space") {
|
|
220
|
-
this.onClick(e);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
// eslint-disable-next-line class-methods-use-this
|
|
224
|
-
linkClick(e) {
|
|
225
|
-
e.preventDefault();
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
export {
|
|
229
|
-
PdCheckbox
|
|
230
|
-
};
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { css, html } from "lit";
|
|
2
|
-
import { msg } from "@lit/localize";
|
|
3
|
-
import { INPUT_TYPE_RANGE, INPUT_TYPE_SELECT } from "./PdBaseUiInput.js";
|
|
4
|
-
import { PdBaseUI } from "./PdBaseUi.js";
|
|
5
|
-
/**
|
|
6
|
-
* @license
|
|
7
|
-
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
8
|
-
*
|
|
9
|
-
* Lit element container for pd input elements.
|
|
10
|
-
*
|
|
11
|
-
* Used to:
|
|
12
|
-
* - Automatically validation of form content
|
|
13
|
-
* - Success/NotReady information for form-container
|
|
14
|
-
*/
|
|
15
|
-
class PdFormContainer extends PdBaseUI {
|
|
16
|
-
static get styles() {
|
|
17
|
-
return [
|
|
18
|
-
PdBaseUI.styles,
|
|
19
|
-
css`
|
|
20
|
-
:host {
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
align-items: left;
|
|
24
|
-
gap: 20px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.validation-info-container {
|
|
28
|
-
padding-top: var(--pd-form-row-padding-top, 10px);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.validation-info {
|
|
32
|
-
font-family: var(--pd-default-font-content-family);
|
|
33
|
-
font-size: var(--pd-form-info-font-size, 0.8em);
|
|
34
|
-
padding: 0.5em;
|
|
35
|
-
color:#58585a;
|
|
36
|
-
border-radius: var(--pd-border-radius, 0);
|
|
37
|
-
-moz-border-radius: var(--pd-border-radius, 0);
|
|
38
|
-
width:70%;
|
|
39
|
-
max-width:780px;
|
|
40
|
-
min-width:200px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.filled {
|
|
44
|
-
border-left: 4px solid var(--pd-default-success-col);
|
|
45
|
-
border-right: 4px solid var(--pd-default-success-col);
|
|
46
|
-
border-top: 1px solid var(--pd-default-success-col);
|
|
47
|
-
border-bottom: 1px solid var(--pd-default-success-col);
|
|
48
|
-
background-color: var(--pd-default-success-light-col);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.unfilled {
|
|
52
|
-
border-left: 4px solid var(--pd-default-error-col);
|
|
53
|
-
border-right: 4px solid var(--pd-default-error-col);
|
|
54
|
-
border-top: 1px solid var(--pd-default-error-col);
|
|
55
|
-
border-bottom: 1px solid var(--pd-default-error-col);
|
|
56
|
-
background-color: var(--pd-default-error-light-col);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
`
|
|
60
|
-
];
|
|
61
|
-
}
|
|
62
|
-
static get properties() {
|
|
63
|
-
return {
|
|
64
|
-
requiredFieldInfo: { type: Boolean },
|
|
65
|
-
commonError: { type: String },
|
|
66
|
-
_requiredFieldsValid: { type: Boolean, state: true }
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
connectedCallback() {
|
|
70
|
-
super.connectedCallback();
|
|
71
|
-
this.addEventListener("validate-form", this._validateForm);
|
|
72
|
-
}
|
|
73
|
-
disconnectedCallback() {
|
|
74
|
-
super.connectedCallback();
|
|
75
|
-
this.removeEventListener("validate-form", this._validateForm);
|
|
76
|
-
}
|
|
77
|
-
render() {
|
|
78
|
-
return html`
|
|
79
|
-
<form>
|
|
80
|
-
<slot></slot>
|
|
81
|
-
${this.requiredFieldInfo || this.commonError ? html`
|
|
82
|
-
<div class="validation-info-container">
|
|
83
|
-
<p class="validation-info ${this._requiredFieldsValid && (!this.commonError || this.commonError === "") ? "filled" : "unfilled"}">
|
|
84
|
-
${this.commonError || (this._requiredFieldsValid ? msg("* Pflichtfelder ausgefüllt", { id: "pd.form.required.valid" }) : msg("* Pflichtfeld", { id: "pd.form.required.info" }))}
|
|
85
|
-
</p>
|
|
86
|
-
</div>` : ""}
|
|
87
|
-
</form>
|
|
88
|
-
`;
|
|
89
|
-
}
|
|
90
|
-
_validateForm(e) {
|
|
91
|
-
const reqEl = this.querySelectorAll("[required]");
|
|
92
|
-
reqEl.forEach((el) => {
|
|
93
|
-
const tmpEl = el;
|
|
94
|
-
if (!el.value || el.value === "" || el.value === "false" || el._inputType === INPUT_TYPE_RANGE && el.value === "0" || el._inputType === INPUT_TYPE_SELECT && el.value === "UNDEF") {
|
|
95
|
-
const erMsg = el.requiredMsg || msg("Eingabe erforderlich", { id: "pd.form.field.required" });
|
|
96
|
-
if (!e.detail.singleElement || e.detail.singleElement === el) {
|
|
97
|
-
tmpEl.errorMsg = erMsg;
|
|
98
|
-
}
|
|
99
|
-
e.detail.errorMap.set(el.id, erMsg);
|
|
100
|
-
} else if (el.validate && typeof el.validate === "function" && el.validate(e)) {
|
|
101
|
-
const errMsg = el.validate(e);
|
|
102
|
-
if (!e.detail.singleElement || e.detail.singleElement === el) {
|
|
103
|
-
tmpEl.errorMsg = errMsg;
|
|
104
|
-
}
|
|
105
|
-
e.detail.errorMap.set(el.id, errMsg);
|
|
106
|
-
} else if (!e.detail.singleElement || e.detail.singleElement === el) {
|
|
107
|
-
tmpEl.errorMsg = "";
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
this._requiredFieldsValid = e.detail.errorMap.size === 0;
|
|
111
|
-
const validateByType = (fieldType, validFunc, invalidMsgTxt) => {
|
|
112
|
-
if (e.detail.singleElement && e.detail.singleElement.getAttribute("field-type") !== fieldType) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
const reqSpecEl = e.detail.singleElement ? [e.detail.singleElement] : this.querySelectorAll(`[field-type=${fieldType}]`);
|
|
116
|
-
reqSpecEl.forEach((el) => {
|
|
117
|
-
const tmpEl = el;
|
|
118
|
-
if (!e.detail.errorMap.has(el.id) && el.value && el.value.length > 0) {
|
|
119
|
-
if (validFunc(el.value)) {
|
|
120
|
-
tmpEl.errorMsg = "";
|
|
121
|
-
} else {
|
|
122
|
-
tmpEl.errorMsg = invalidMsgTxt || `Invalid format for ${fieldType}`;
|
|
123
|
-
e.detail.errorMap.set(el.id, tmpEl.errorMsg);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
validateByType(
|
|
129
|
-
"mail",
|
|
130
|
-
PdFormContainer._mailIsValid,
|
|
131
|
-
msg("Format mail@test.de verwenden", { id: "pd.form.field.invalid.mail" })
|
|
132
|
-
);
|
|
133
|
-
validateByType(
|
|
134
|
-
"phone",
|
|
135
|
-
PdFormContainer._phoneIsValid,
|
|
136
|
-
msg("Format +49123 123456 verwenden", { id: "pd.form.field.invalid.phone" })
|
|
137
|
-
);
|
|
138
|
-
validateByType(
|
|
139
|
-
"vat",
|
|
140
|
-
PdFormContainer._vatIsValid,
|
|
141
|
-
msg("Format DE0123456789 verwenden", { id: "pd.form.field.invalid.vat" })
|
|
142
|
-
);
|
|
143
|
-
validateByType(
|
|
144
|
-
"number",
|
|
145
|
-
(val) => !isNaN(val.replaceAll(",", ".")),
|
|
146
|
-
msg("Nur Zahlen erlaubt", { id: "pd.form.field.invalid.number" })
|
|
147
|
-
);
|
|
148
|
-
if (e.detail.singleElement) {
|
|
149
|
-
e.stopPropagation();
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
static _mailIsValid(email) {
|
|
153
|
-
const mValid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
|
154
|
-
return mValid;
|
|
155
|
-
}
|
|
156
|
-
static _vatIsValid(vat) {
|
|
157
|
-
const mValid = /^[A-Z]{2}[0-9]{8,12}$/.test(vat);
|
|
158
|
-
return mValid;
|
|
159
|
-
}
|
|
160
|
-
static _phoneIsValid(nr) {
|
|
161
|
-
const mValid = /^\+?[0-9 ]{7,15}$/.test(nr);
|
|
162
|
-
return mValid;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
export {
|
|
166
|
-
PdFormContainer
|
|
167
|
-
};
|
package/dist/src/PdFormRow.js
DELETED
|
@@ -1,92 +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
|
-
class PdFormRow extends PdBaseUI {
|
|
8
|
-
static get styles() {
|
|
9
|
-
return css`
|
|
10
|
-
:host {
|
|
11
|
-
|
|
12
|
-
/* Define size for row, depends on media queries */
|
|
13
|
-
--my-row-width: var(--pd-form-row-base-width, 800px);
|
|
14
|
-
--my-gap: var(--pd-form-row-gap, 20px);
|
|
15
|
-
display: flex;
|
|
16
|
-
flex: 1 1 100%;
|
|
17
|
-
/*margin: 0 0 .5rem 0;*/
|
|
18
|
-
box-sizing: border-box;
|
|
19
|
-
width: 100%;
|
|
20
|
-
gap: var(--my-gap);
|
|
21
|
-
align-items: var(--pd-form-row-align-item, flex-start);
|
|
22
|
-
padding-top: var(--pd-form-row-padding-top, 10px);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
::slotted(.full-size) {
|
|
26
|
-
--pd-input-field-width: 100%;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
::slotted(.quarter1) {
|
|
30
|
-
--pd-input-field-width: calc(var(--my-row-width) * 0.25 - (var(--my-gap) * 0.75));
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
::slotted(.quarter1-area) {
|
|
35
|
-
--pd-input-field-width: calc((var(--my-row-width) - 5px) * 0.25 - (var(--my-gap) * 0.75));
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
::slotted(.quarter2) {
|
|
40
|
-
--pd-input-field-width: calc((var(--my-row-width) * 0.5) - (var(--my-gap) / 2));
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
::slotted(.quarter2-area) {
|
|
45
|
-
--pd-input-field-width: calc(((var(--my-row-width) - 8px) * 0.5) - (var(--my-gap) / 2));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
::slotted(.quarter3) {
|
|
49
|
-
--pd-input-field-width: calc(var(--my-row-width) * 0.75 - (var(--my-gap) * 0.25));
|
|
50
|
-
}
|
|
51
|
-
/* Area is longer? Scrollbar? */
|
|
52
|
-
::slotted(.quarter3-area) {
|
|
53
|
-
--pd-input-field-width: calc((var(--my-row-width) - 10px) * 0.75 - (var(--my-gap) * 0.25));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
::slotted(.quarter4) {
|
|
57
|
-
--pd-input-field-width: var(--my-row-width);
|
|
58
|
-
}
|
|
59
|
-
/* Area is longer? Scrollbar? */
|
|
60
|
-
::slotted(.quarter4-area) {
|
|
61
|
-
--pd-input-field-width: calc(var(--my-row-width) - 15px);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
@media (max-width: 930px) {
|
|
65
|
-
:host {
|
|
66
|
-
--my-row-width: 600px;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
@media (max-width: 650px) {
|
|
70
|
-
:host {
|
|
71
|
-
--my-row-width: 400px;
|
|
72
|
-
--my-gap: 10px;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
@media (max-width: 450px) {
|
|
76
|
-
:host {
|
|
77
|
-
--my-row-width: 300px;
|
|
78
|
-
--my-gap: 8px;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
`;
|
|
83
|
-
}
|
|
84
|
-
render() {
|
|
85
|
-
return html`
|
|
86
|
-
<slot></slot>
|
|
87
|
-
`;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
export {
|
|
91
|
-
PdFormRow
|
|
92
|
-
};
|