@progressive-development/pd-forms 0.2.15 → 0.5.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.
- package/dist/index.js +26 -0
- package/dist/locales/be.js +12 -0
- package/dist/locales/de.js +12 -0
- package/dist/locales/en.js +12 -0
- package/dist/pd-button.js +4 -0
- package/dist/pd-checkbox.js +4 -0
- package/dist/pd-form-container.js +4 -0
- package/dist/pd-form-row.js +4 -0
- package/dist/pd-hover-box.js +4 -0
- package/dist/pd-input-area.js +4 -0
- package/dist/pd-input-file.js +4 -0
- package/dist/pd-input.js +4 -0
- package/dist/pd-radio-group.js +4 -0
- package/dist/pd-range.js +4 -0
- package/dist/pd-select.js +4 -0
- package/{src → dist/src}/PdBaseInputElement.js +23 -42
- package/{src → dist/src}/PdBaseUi.js +11 -13
- package/dist/src/PdBaseUiInput.js +229 -0
- package/{src → dist/src}/PdButton.js +42 -48
- package/{src → dist/src}/PdCheckbox.js +16 -75
- package/{src → dist/src}/PdFormContainer.js +51 -79
- package/{src → dist/src}/PdFormRow.js +8 -17
- package/{src → dist/src}/PdHoverBox.js +20 -42
- package/dist/src/PdInput.js +79 -0
- package/dist/src/PdInputArea.js +61 -0
- package/dist/src/PdInputFile.js +73 -0
- package/dist/src/PdRadioGroup.js +72 -0
- package/{src → dist/src}/PdRange.js +38 -47
- package/{src → dist/src}/PdSelect.js +16 -65
- package/{src → dist/src}/shared-input-field-styles.js +6 -8
- package/{src → dist/src}/shared-input-styles.js +5 -8
- package/package.json +46 -25
- package/.editorconfig +0 -29
- package/.storybook/main.js +0 -13
- package/.storybook/preview-head.html +0 -4
- package/.storybook/preview.js +0 -14
- package/demo/index.html +0 -29
- package/index.js +0 -0
- package/lit-localize.json +0 -18
- package/pd-button.js +0 -3
- package/pd-checkbox.js +0 -3
- package/pd-form-container.js +0 -3
- package/pd-form-row.js +0 -3
- package/pd-hover-box.js +0 -3
- package/pd-input-area.js +0 -3
- package/pd-input-file.js +0 -3
- package/pd-input.js +0 -3
- package/pd-radio-group.js +0 -3
- package/pd-range.js +0 -3
- package/pd-select.js +0 -3
- package/src/PdBaseUiInput.js +0 -248
- package/src/PdInput.js +0 -146
- package/src/PdInputArea.js +0 -104
- package/src/PdInputFile.js +0 -121
- package/src/PdRadioGroup.js +0 -88
- package/src/PdRange copy.js +0 -197
- package/src/generated/locale/be.js +0 -19
- package/src/generated/locale/en.js +0 -19
- package/src/generated/locale-codes.js +0 -25
- package/src/stories/01_index.stories.js +0 -268
- package/src/stories/button.stories.js +0 -15
- package/src/stories/checkbox.stories.js +0 -103
- package/src/stories/form-container.stories.js +0 -100
- package/src/stories/form-row.stories.js +0 -23
- package/src/stories/input-area.stories.js +0 -129
- package/src/stories/input-file.stories.js +0 -111
- package/src/stories/input.stories.js +0 -179
- package/src/stories/radio-group.stories.js +0 -54
- package/src/stories/range.stories.js +0 -105
- package/src/stories/select.stories.js +0 -116
- package/test/pd-forms.test.js +0 -32
- package/web-dev-server.config.mjs +0 -27
- package/web-test-runner.config.mjs +0 -41
- package/xliff/be.xlf +0 -37
- package/xliff/en.xlf +0 -31
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
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,35 +1,29 @@
|
|
|
1
|
+
import { css, html } from "lit";
|
|
2
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
3
|
+
import { PdBaseUIInput, INPUT_TYPE_RANGE } from "./PdBaseUiInput.js";
|
|
1
4
|
/**
|
|
2
5
|
* @license
|
|
3
6
|
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
4
7
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this._inputType = INPUT_TYPE_RANGE;
|
|
25
|
-
this.step = 1;
|
|
26
|
-
this.optionValueMapper = {};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static get styles() {
|
|
30
|
-
return [
|
|
31
|
-
PdBaseUIInput.styles,
|
|
32
|
-
css`
|
|
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`
|
|
33
27
|
|
|
34
28
|
/* Link:
|
|
35
29
|
* css styling: - https://css-tricks.com/styling-cross-browser-compatible-range-inputs-css/
|
|
@@ -230,19 +224,17 @@ export class PdRange extends PdBaseUIInput {
|
|
|
230
224
|
}
|
|
231
225
|
|
|
232
226
|
`
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
// TODO: step kann hier nicht übergeben werden, wird dann initial nicht immer richtig angezeigt (bei komma rundungen)???
|
|
239
|
-
return html`
|
|
227
|
+
];
|
|
228
|
+
}
|
|
229
|
+
render() {
|
|
230
|
+
const inputId = `${this.id}Range`;
|
|
231
|
+
return html`
|
|
240
232
|
${this._renderLabel(inputId, this.optionValueMapper[this.value] || this.value)}
|
|
241
233
|
<div class="input-range ${classMap({ error: this.errorMsg.length > 0 })}">
|
|
242
234
|
<input
|
|
243
235
|
id="${inputId}"
|
|
244
236
|
name="${this.name || this.valueName}"
|
|
245
|
-
class="input-range-style ${this.gradient ?
|
|
237
|
+
class="input-range-style ${this.gradient ? "gradient" : ""}"
|
|
246
238
|
type="range"
|
|
247
239
|
.value="${this.value}"
|
|
248
240
|
?readonly="${this.readonly}"
|
|
@@ -262,15 +254,14 @@ export class PdRange extends PdBaseUIInput {
|
|
|
262
254
|
</div>
|
|
263
255
|
${this._renderErrorMsg()}
|
|
264
256
|
`;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
_onChange(e) {
|
|
273
|
-
this._handleChangedValue(this._input.value, e, false);
|
|
274
|
-
}
|
|
275
|
-
|
|
257
|
+
}
|
|
258
|
+
firstUpdated() {
|
|
259
|
+
this._input = this.shadowRoot.querySelector("input");
|
|
260
|
+
}
|
|
261
|
+
_onChange(e) {
|
|
262
|
+
this._handleChangedValue(this._input.value, e, false);
|
|
263
|
+
}
|
|
276
264
|
}
|
|
265
|
+
export {
|
|
266
|
+
PdRange
|
|
267
|
+
};
|
|
@@ -1,55 +1,11 @@
|
|
|
1
|
+
import { css, html } from "lit";
|
|
2
|
+
import { INPUT_TYPE_SELECT } from "./PdBaseUiInput.js";
|
|
3
|
+
import { PdBaseInputElement } from "./PdBaseInputElement.js";
|
|
1
4
|
/**
|
|
2
5
|
* @license
|
|
3
6
|
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
4
7
|
*/
|
|
5
|
-
|
|
6
|
-
import { html, css } from 'lit';
|
|
7
|
-
|
|
8
|
-
import '@progressive-development/pd-icon/pd-icon.js';
|
|
9
|
-
|
|
10
|
-
import { INPUT_TYPE_SELECT } from './PdBaseUiInput.js';
|
|
11
|
-
import { PdBaseInputElement } from './PdBaseInputElement.js';
|
|
12
|
-
|
|
13
|
-
// https://github.com/Victor-Bernabe/lit-input
|
|
14
|
-
// https://levelup.gitconnected.com/build-a-material-like-input-web-component-using-litelement-20e9e0d203b6
|
|
15
|
-
/**
|
|
16
|
-
* Web component to input text implemented with LitElement.
|
|
17
|
-
*
|
|
18
|
-
* ### Styling
|
|
19
|
-
*
|
|
20
|
-
* All custom properties should start with `--squi-input`.
|
|
21
|
-
*
|
|
22
|
-
* Font and icon size will scale automatically with `squi-input`'s height.
|
|
23
|
-
*
|
|
24
|
-
* Custom property | Description | Default
|
|
25
|
-
* ----------------|-------------|--------
|
|
26
|
-
* `--pd-input-field-width` | Width | `250px`
|
|
27
|
-
* `--my-input-height` | Height | `30px`
|
|
28
|
-
* `--squi-input-border` | Border | `1px solid black`
|
|
29
|
-
* `--squi-input-border-focus` | Border when focused | `1px solid #4d90fe`
|
|
30
|
-
* `--squi-input-background-color` | Background color | `white`
|
|
31
|
-
* `--squi-input-font-size` | Font size | `calc(var(--my-input-height) / 1.8)`
|
|
32
|
-
* `--squi-input-text-color` | Text color | `inherit`
|
|
33
|
-
* `--squi-input-placeholder-color` | Placeholder text color | `#a0a0a0`
|
|
34
|
-
* `--squi-input-icon-fill-color` | Icon fill color | `currentcolor`
|
|
35
|
-
* `--squi-input-icon-stroke-color` | Icon stroke color | `none`
|
|
36
|
-
*
|
|
37
|
-
* ### Icon and text alignment
|
|
38
|
-
*
|
|
39
|
-
* The icon inside `squi-input` is hidden by default. To show it, set the attribute `icon-right` or `icon-left`.
|
|
40
|
-
*
|
|
41
|
-
* <pd-input icon-left></pd-input>
|
|
42
|
-
* <pd-input icon-right></pd-input>
|
|
43
|
-
*
|
|
44
|
-
* <pd-input icon-left .icon="${'hardware:headset'}"></pd-input>
|
|
45
|
-
*
|
|
46
|
-
* Text can be left or right aligned. Default is left alignment.
|
|
47
|
-
*
|
|
48
|
-
* <pd-input text-right></pd-input>
|
|
49
|
-
* <pd-input text-left></pd-input>
|
|
50
|
-
*/
|
|
51
|
-
export class PdSelect extends PdBaseInputElement {
|
|
52
|
-
|
|
8
|
+
class PdSelect extends PdBaseInputElement {
|
|
53
9
|
static get styles() {
|
|
54
10
|
return [
|
|
55
11
|
PdBaseInputElement.styles,
|
|
@@ -113,30 +69,27 @@ export class PdSelect extends PdBaseInputElement {
|
|
|
113
69
|
background-size: 0.65em auto, 100%;
|
|
114
70
|
background-color: var(--my-error-background-color);
|
|
115
71
|
}
|
|
116
|
-
|
|
72
|
+
`
|
|
117
73
|
];
|
|
118
74
|
}
|
|
119
|
-
|
|
120
75
|
static get properties() {
|
|
121
76
|
return {
|
|
122
|
-
values: { type: Array }
|
|
77
|
+
values: { type: Array }
|
|
123
78
|
};
|
|
124
79
|
}
|
|
125
|
-
|
|
126
80
|
constructor() {
|
|
127
81
|
super();
|
|
128
82
|
this._inputType = INPUT_TYPE_SELECT;
|
|
129
83
|
this.values = [];
|
|
130
84
|
}
|
|
131
|
-
|
|
132
85
|
render() {
|
|
133
86
|
const selectId = `${this.id}Select`;
|
|
134
87
|
return html`
|
|
135
88
|
${this._renderLabel(selectId)}
|
|
136
|
-
<div class="input ${this.errorMsg.length > 0 ?
|
|
89
|
+
<div class="input ${this.errorMsg.length > 0 ? "error" : ""}">
|
|
137
90
|
<select
|
|
138
91
|
id="${selectId}"
|
|
139
|
-
class="input-style select-css ${this.gradient ?
|
|
92
|
+
class="input-style select-css ${this.gradient ? "gradient" : ""}"
|
|
140
93
|
?disabled="${this.disabled}"
|
|
141
94
|
name="${this.name || this.valueName || this.autoCompleteName}"
|
|
142
95
|
autocomplete=${this.autoCompleteName}
|
|
@@ -145,30 +98,28 @@ export class PdSelect extends PdBaseInputElement {
|
|
|
145
98
|
@blur="${this._onBlur}"
|
|
146
99
|
>
|
|
147
100
|
${this.values.map(
|
|
148
|
-
|
|
101
|
+
(val) => html`
|
|
149
102
|
<option
|
|
150
103
|
value="${val.value}"
|
|
151
|
-
?selected=${
|
|
152
|
-
|
|
153
|
-
this.value == val.value
|
|
154
|
-
}
|
|
104
|
+
?selected=${// eslint-disable-next-line eqeqeq
|
|
105
|
+
this.value == val.value}
|
|
155
106
|
>
|
|
156
107
|
${val.name}
|
|
157
108
|
</option>
|
|
158
109
|
`
|
|
159
|
-
|
|
110
|
+
)}
|
|
160
111
|
</select>
|
|
161
112
|
</div>
|
|
162
113
|
${this._renderErrorMsg()}
|
|
163
114
|
`;
|
|
164
115
|
}
|
|
165
|
-
|
|
166
116
|
/**
|
|
167
117
|
* At the moment specific for select.
|
|
168
118
|
*/
|
|
169
119
|
// eslint-disable-next-line class-methods-use-this
|
|
170
|
-
_onSelectKeyUp() {
|
|
171
|
-
// this._handleChangedValue(this._input.value, event, true);
|
|
120
|
+
_onSelectKeyUp() {
|
|
172
121
|
}
|
|
173
|
-
|
|
174
122
|
}
|
|
123
|
+
export {
|
|
124
|
+
PdSelect
|
|
125
|
+
};
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
1
2
|
/**
|
|
2
3
|
* @license
|
|
3
4
|
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
-
import { css } from 'lit';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Shared styles for pd-input, pd-input-area and pd-select.
|
|
10
|
-
*/
|
|
11
|
-
export const SharedInputFieldStyles = css`
|
|
6
|
+
const SharedInputFieldStyles = css`
|
|
12
7
|
|
|
13
8
|
/* Describe input div (with icon) around input/select/area element */
|
|
14
9
|
.input {
|
|
@@ -151,4 +146,7 @@ export const SharedInputFieldStyles = css`
|
|
|
151
146
|
color: var(--pd-input-placeholder-color, #474747e4);
|
|
152
147
|
}
|
|
153
148
|
|
|
154
|
-
`;
|
|
149
|
+
`;
|
|
150
|
+
export {
|
|
151
|
+
SharedInputFieldStyles
|
|
152
|
+
};
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
1
2
|
/**
|
|
2
3
|
* @license
|
|
3
4
|
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
-
import { css } from 'lit';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Shared styles for all input elements:
|
|
10
|
-
* Used from pd-input, pd-select, pd-input-area, pd-range, pd-checkbox and pd-radio-group.
|
|
11
|
-
*/
|
|
12
|
-
export const SharedInputStyles = css`
|
|
6
|
+
const SharedInputStyles = css`
|
|
13
7
|
|
|
14
8
|
/**
|
|
15
9
|
* Label used for input, select, input-area, range and radio-group.
|
|
@@ -65,3 +59,6 @@ export const SharedInputStyles = css`
|
|
|
65
59
|
}
|
|
66
60
|
|
|
67
61
|
`;
|
|
62
|
+
export {
|
|
63
|
+
SharedInputStyles
|
|
64
|
+
};
|
package/package.json
CHANGED
|
@@ -1,18 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progressive-development/pd-forms",
|
|
3
|
-
"description": "Webcomponent pd-forms following open-wc recommendations",
|
|
4
|
-
"license": "SEE LICENSE IN LICENSE",
|
|
3
|
+
"description": "Webcomponent pd-forms following open-wc recommendations",
|
|
5
4
|
"author": "PD Progressive Development",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
6
|
+
"version": "0.5.0",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./dist/index.js",
|
|
11
|
+
"./pd-button": "./dist/pd-button.js",
|
|
12
|
+
"./pd-checkbox": "./dist/pd-checkbox.js",
|
|
13
|
+
"./pd-form-container": "./dist/pd-form-container.js",
|
|
14
|
+
"./pd-form-row": "./dist/pd-form-row.js",
|
|
15
|
+
"./pd-hover-box": "./dist/pd-hover-box.js",
|
|
16
|
+
"./pd-input-area": "./dist/pd-input-area.js",
|
|
17
|
+
"./pd-input-file": "./dist/pd-input-file.js",
|
|
18
|
+
"./pd-input": "./dist/pd-input.js",
|
|
19
|
+
"./pd-radio-group": "./dist/pd-radio-group.js",
|
|
20
|
+
"./pd-range": "./dist/pd-range.js",
|
|
21
|
+
"./pd-select": "./dist/pd-select.js",
|
|
22
|
+
"./locales/be": "./dist/locales/be.js",
|
|
23
|
+
"./locales/de": "./dist/locales/de.js",
|
|
24
|
+
"./locales/en": "./dist/locales/en.js"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist/",
|
|
28
|
+
"package.json",
|
|
29
|
+
"README.md",
|
|
30
|
+
"LICENSE"
|
|
31
|
+
],
|
|
9
32
|
"scripts": {
|
|
10
33
|
"analyze": "cem analyze --litelement",
|
|
11
|
-
"start": "
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
34
|
+
"start": "vite",
|
|
35
|
+
"build": "vite build",
|
|
36
|
+
"preview": "vite preview",
|
|
37
|
+
"lint": "eslint --ext .js,.html . --ignore-path .gitignore && prettier \"**/*.{js,html}\" --check --ignore-path .gitignore",
|
|
38
|
+
"format": "eslint --ext .js,.html . --fix --ignore-path .gitignore && prettier \"**/*.{js,html}\" --write --ignore-path .gitignore",
|
|
39
|
+
"test": "vitest run --coverage",
|
|
40
|
+
"test:watch": "vitest --watch",
|
|
16
41
|
"localizeExtract": "lit-localize extract",
|
|
17
42
|
"localizeBuild": "lit-localize build",
|
|
18
43
|
"storybook": "storybook dev -p 6006",
|
|
@@ -21,29 +46,28 @@
|
|
|
21
46
|
"dependencies": {
|
|
22
47
|
"@lit-labs/motion": "^1.0.6",
|
|
23
48
|
"@lit/localize": "^0.11.4",
|
|
24
|
-
"@progressive-development/pd-icon": "^0.
|
|
49
|
+
"@progressive-development/pd-icon": "^0.5.0",
|
|
25
50
|
"@progressive-development/pd-shared-styles": "0.1.1",
|
|
26
51
|
"lit": "^2.8.0"
|
|
27
52
|
},
|
|
28
53
|
"devDependencies": {
|
|
29
54
|
"@custom-elements-manifest/analyzer": "^0.4.17",
|
|
30
|
-
"@lit/localize-tools": "^0.
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@storybook/
|
|
34
|
-
"@storybook/
|
|
35
|
-
"@storybook/
|
|
36
|
-
"@storybook/web-components": "^7.5.1",
|
|
37
|
-
"@storybook/web-components-vite": "^7.6.4",
|
|
38
|
-
"@web/dev-server": "^0.1.38",
|
|
39
|
-
"@web/test-runner": "^0.13.31",
|
|
55
|
+
"@lit/localize-tools": "^0.7.2",
|
|
56
|
+
"@storybook/addon-essentials": "^7.6.20",
|
|
57
|
+
"@storybook/addon-links": "^7.6.20",
|
|
58
|
+
"@storybook/blocks": "^7.5.3",
|
|
59
|
+
"@storybook/web-components": "^7.5.3",
|
|
60
|
+
"@storybook/web-components-vite": "^7.6.20",
|
|
40
61
|
"eslint": "^7.32.0",
|
|
41
62
|
"eslint-config-prettier": "^8.10.0",
|
|
42
63
|
"eslint-plugin-storybook": "^0.6.15",
|
|
43
64
|
"husky": "^4.3.8",
|
|
44
65
|
"lint-staged": "^10.5.4",
|
|
45
66
|
"prettier": "^2.8.8",
|
|
46
|
-
"
|
|
67
|
+
"rollup-plugin-visualizer": "^5.13.1",
|
|
68
|
+
"storybook": "^7.6.20",
|
|
69
|
+
"vite": "^5.4.11",
|
|
70
|
+
"vitest": "^2.1.8"
|
|
47
71
|
},
|
|
48
72
|
"customElements": "custom-elements.json",
|
|
49
73
|
"eslintConfig": {
|
|
@@ -67,8 +91,5 @@
|
|
|
67
91
|
"eslint --fix",
|
|
68
92
|
"prettier --write"
|
|
69
93
|
]
|
|
70
|
-
},
|
|
71
|
-
"directories": {
|
|
72
|
-
"test": "test"
|
|
73
94
|
}
|
|
74
95
|
}
|
package/.editorconfig
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# EditorConfig helps developers define and maintain consistent
|
|
2
|
-
# coding styles between different editors and IDEs
|
|
3
|
-
# editorconfig.org
|
|
4
|
-
|
|
5
|
-
root = true
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
[*]
|
|
9
|
-
|
|
10
|
-
# Change these settings to your own preference
|
|
11
|
-
indent_style = space
|
|
12
|
-
indent_size = 2
|
|
13
|
-
|
|
14
|
-
# We recommend you to keep these unchanged
|
|
15
|
-
end_of_line = lf
|
|
16
|
-
charset = utf-8
|
|
17
|
-
trim_trailing_whitespace = true
|
|
18
|
-
insert_final_newline = true
|
|
19
|
-
|
|
20
|
-
[*.md]
|
|
21
|
-
trim_trailing_whitespace = false
|
|
22
|
-
|
|
23
|
-
[*.json]
|
|
24
|
-
indent_size = 2
|
|
25
|
-
|
|
26
|
-
[*.{html,js,md}]
|
|
27
|
-
block_comment_start = /**
|
|
28
|
-
block_comment = *
|
|
29
|
-
block_comment_end = */
|
package/.storybook/main.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** @type { import('@storybook/web-components-vite').StorybookConfig } */
|
|
2
|
-
const config = {
|
|
3
|
-
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
|
|
4
|
-
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
|
|
5
|
-
framework: {
|
|
6
|
-
name: '@storybook/web-components-vite',
|
|
7
|
-
options: {},
|
|
8
|
-
},
|
|
9
|
-
docs: {
|
|
10
|
-
autodocs: 'tag',
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
export default config;
|
package/.storybook/preview.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/** @type { import('@storybook/web-components').Preview } */
|
|
2
|
-
const preview = {
|
|
3
|
-
parameters: {
|
|
4
|
-
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
5
|
-
controls: {
|
|
6
|
-
matchers: {
|
|
7
|
-
color: /(background|color)$/i,
|
|
8
|
-
date: /Date$/i,
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default preview;
|
package/demo/index.html
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en-GB">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<style>
|
|
6
|
-
body {
|
|
7
|
-
background: #fafafa;
|
|
8
|
-
}
|
|
9
|
-
</style>
|
|
10
|
-
</head>
|
|
11
|
-
<body>
|
|
12
|
-
<div id="demo"></div>
|
|
13
|
-
|
|
14
|
-
<script type="module">
|
|
15
|
-
import { html, render } from 'lit';
|
|
16
|
-
import '../pd-forms.js';
|
|
17
|
-
|
|
18
|
-
const title = 'Hello owc World!';
|
|
19
|
-
render(
|
|
20
|
-
html`
|
|
21
|
-
<pd-forms .title=${title}>
|
|
22
|
-
some light-dom
|
|
23
|
-
</pd-forms>
|
|
24
|
-
`,
|
|
25
|
-
document.querySelector('#demo')
|
|
26
|
-
);
|
|
27
|
-
</script>
|
|
28
|
-
</body>
|
|
29
|
-
</html>
|
package/index.js
DELETED
|
File without changes
|
package/lit-localize.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/lit/lit/main/packages/localize-tools/config.schema.json",
|
|
3
|
-
"sourceLocale": "de",
|
|
4
|
-
"targetLocales": ["en", "be"],
|
|
5
|
-
"inputFiles": [
|
|
6
|
-
"src/**/*.js"
|
|
7
|
-
],
|
|
8
|
-
"output": {
|
|
9
|
-
"mode": "runtime",
|
|
10
|
-
"localeCodesModule": "src/generated/locale-codes.js",
|
|
11
|
-
"outputDir": "src/generated/locale"
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
"interchange": {
|
|
15
|
-
"format": "xliff",
|
|
16
|
-
"xliffDir": "./xliff/"
|
|
17
|
-
}
|
|
18
|
-
}
|
package/pd-button.js
DELETED
package/pd-checkbox.js
DELETED
package/pd-form-container.js
DELETED