@progressive-development/pd-forms 0.0.59 → 0.0.61
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/package.json +2 -2
- package/src/PdBaseInputElement.js +95 -0
- package/src/PdBaseUi.js +23 -4
- package/src/PdBaseUiInput.js +137 -6
- package/src/PdButton.js +78 -75
- package/src/PdCheckbox.js +175 -212
- package/src/PdFormContainer.js +56 -30
- package/src/PdFormRow.js +19 -16
- package/src/PdInput.js +41 -137
- package/src/PdInputArea.js +37 -124
- package/src/PdRadioGroup.js +32 -54
- package/src/PdRange.js +0 -2
- package/src/PdSelect.js +36 -179
- package/src/shared-global-styles.js +38 -0
- package/src/shared-input-field-styles.js +147 -0
- package/src/shared-input-styles.js +28 -191
- package/stories/01_index.stories.js +25 -69
- package/stories/checkbox.stories.js +40 -5
- package/stories/form-container.stories.js +18 -4
- package/stories/input.stories.js +23 -15
- package/stories/radio-group.stories.js +30 -21
- package/stories/select.stories.js +34 -22
- package/pd-button-goup.js +0 -3
- package/pd-label-value.js +0 -3
- package/src/PdButtonGroup.js +0 -54
- package/src/PdLabelValue.js +0 -75
- package/stories/label-value.stories.js +0 -32
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { html } from 'lit';
|
|
2
2
|
import '../pd-checkbox.js';
|
|
3
3
|
import '../pd-radio-group.js';
|
|
4
|
+
import '../pd-form-container.js';
|
|
4
5
|
|
|
5
6
|
export default {
|
|
6
7
|
title: 'PdForms/Radio Group',
|
|
@@ -8,38 +9,46 @@ export default {
|
|
|
8
9
|
argTypes: {},
|
|
9
10
|
};
|
|
10
11
|
|
|
11
|
-
function Template(
|
|
12
|
+
function Template() {
|
|
12
13
|
return html`
|
|
13
14
|
<h1>Radio Group</h1>
|
|
14
15
|
<p style="color: red;">
|
|
15
16
|
Working progress, checkbox style not suitable here
|
|
16
17
|
</p>
|
|
17
18
|
|
|
18
|
-
<
|
|
19
|
+
<pd-form-container id="testGroupboxContainerId">
|
|
20
|
+
|
|
21
|
+
<h3>Radio Group Horiz.</h3>
|
|
22
|
+
<pd-radio-group required>
|
|
23
|
+
<pd-checkbox name="Test1" value="false" valueName="Test1">Label zur Checkbox</pd-checkbox>
|
|
24
|
+
<pd-checkbox name="Test2" value="false" valueName="Test2">Label zur Checkbox</pd-checkbox>
|
|
25
|
+
</pd-radio-group>
|
|
19
26
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
>Label zur Checkbox</pd-checkbox
|
|
27
|
-
>
|
|
28
|
-
</pd-radio-group>
|
|
27
|
+
<h3>Radio Group Vert.</h3>
|
|
28
|
+
<pd-radio-group style="--group-direction: column;" required>
|
|
29
|
+
<pd-checkbox name="Test3" value="false" valueName="Test12">Label zur Checkbox</pd-checkbox>
|
|
30
|
+
<pd-checkbox name="Test4" value="false" valueName="Test13">Label zur Checkbox</pd-checkbox>
|
|
31
|
+
</pd-radio-group>
|
|
32
|
+
</pd-form-container>
|
|
29
33
|
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
<h2>Test Validation</h2>
|
|
35
|
+
<button
|
|
36
|
+
@click="${() => {
|
|
37
|
+
document
|
|
38
|
+
.getElementById('testGroupboxContainerId')
|
|
39
|
+
.dispatchEvent(
|
|
40
|
+
new CustomEvent('validate-form', {
|
|
41
|
+
detail: { errorMap: new Map() },
|
|
42
|
+
})
|
|
43
|
+
);
|
|
44
|
+
}}"
|
|
45
|
+
>
|
|
46
|
+
Test Validate
|
|
47
|
+
</button>
|
|
39
48
|
`;
|
|
40
49
|
}
|
|
41
50
|
|
|
42
51
|
export const RadioGroup = Template.bind({});
|
|
43
52
|
RadioGroup.args = {
|
|
44
|
-
|
|
53
|
+
|
|
45
54
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { html } from 'lit';
|
|
2
2
|
import '../pd-select.js';
|
|
3
|
+
import '../pd-form-container.js';
|
|
4
|
+
import '../pd-form-row.js';
|
|
3
5
|
|
|
4
6
|
export default {
|
|
5
7
|
title: 'PdForms/Select',
|
|
@@ -19,16 +21,8 @@ export default {
|
|
|
19
21
|
|
|
20
22
|
function Template({
|
|
21
23
|
selectVals,
|
|
22
|
-
primaryColor,
|
|
23
|
-
secondaryColor,
|
|
24
|
-
textColor,
|
|
25
|
-
highlightColor,
|
|
26
|
-
errorColor,
|
|
27
|
-
errorBackgroundColor,
|
|
28
|
-
borderRadius,
|
|
29
|
-
displayFont,
|
|
30
|
-
fontSize,
|
|
31
24
|
}) {
|
|
25
|
+
/*
|
|
32
26
|
let style = '';
|
|
33
27
|
if (primaryColor) {
|
|
34
28
|
style += `--squi-primary-color:${primaryColor};`;
|
|
@@ -57,21 +51,20 @@ function Template({
|
|
|
57
51
|
if (fontSize) {
|
|
58
52
|
style += `--squi-font-size:${fontSize};`;
|
|
59
53
|
}
|
|
54
|
+
*/
|
|
60
55
|
|
|
61
56
|
return html`
|
|
62
57
|
<h3>Select default</h3>
|
|
63
58
|
<pd-select
|
|
64
59
|
id="testId1"
|
|
65
|
-
.values="${selectVals}"
|
|
66
|
-
style="${style}"
|
|
60
|
+
.values="${selectVals}"
|
|
67
61
|
></pd-select>
|
|
68
62
|
|
|
69
63
|
<h3>Select with label</h3>
|
|
70
64
|
<pd-select
|
|
71
65
|
id="testId2"
|
|
72
66
|
.values="${selectVals}"
|
|
73
|
-
label="Label for Select"
|
|
74
|
-
style="${style}"
|
|
67
|
+
label="Label for Select"
|
|
75
68
|
></pd-select>
|
|
76
69
|
|
|
77
70
|
<h3>Select with label - disabled</h3>
|
|
@@ -79,24 +72,43 @@ function Template({
|
|
|
79
72
|
id="testId2"
|
|
80
73
|
.values="${selectVals}"
|
|
81
74
|
label="Label for Select"
|
|
82
|
-
?disabled="${true}"
|
|
83
|
-
style="${style}"
|
|
75
|
+
?disabled="${true}"
|
|
84
76
|
></pd-select>
|
|
85
77
|
|
|
86
78
|
<h3>Select with label - error</h3>
|
|
87
|
-
<pd-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
79
|
+
<pd-form-container id="testSelectContainerId">
|
|
80
|
+
|
|
81
|
+
<pd-form-row>
|
|
82
|
+
<pd-select
|
|
83
|
+
id="testId2"
|
|
84
|
+
.values="${selectVals}"
|
|
85
|
+
label="Label for Select"
|
|
86
|
+
required
|
|
87
|
+
></pd-select>
|
|
88
|
+
</pd-form-row>
|
|
89
|
+
</pd-form-container>
|
|
90
|
+
|
|
91
|
+
<h2>Test Validation</h2>
|
|
92
|
+
<button
|
|
93
|
+
@click="${() => {
|
|
94
|
+
document
|
|
95
|
+
.getElementById('testSelectContainerId')
|
|
96
|
+
.dispatchEvent(
|
|
97
|
+
new CustomEvent('validate-form', {
|
|
98
|
+
detail: { errorMap: new Map() },
|
|
99
|
+
})
|
|
100
|
+
);
|
|
101
|
+
}}"
|
|
102
|
+
>
|
|
103
|
+
Test Validate
|
|
104
|
+
</button>
|
|
94
105
|
`;
|
|
95
106
|
}
|
|
96
107
|
|
|
97
108
|
export const Select = Template.bind({});
|
|
98
109
|
Select.args = {
|
|
99
110
|
selectVals: [
|
|
111
|
+
{ name: 'Auswahl treffen', value: undefined },
|
|
100
112
|
{ name: 'Option 1', value: 1 },
|
|
101
113
|
{ name: 'Option 2', value: 2 },
|
|
102
114
|
{ name: 'Option 3', value: 3 },
|
package/pd-button-goup.js
DELETED
package/pd-label-value.js
DELETED
package/src/PdButtonGroup.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { html, css , LitElement } from 'lit';
|
|
7
|
-
|
|
8
|
-
import { SharedInputStyles } from './shared-input-styles.js';
|
|
9
|
-
import '../pd-button.js';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export class PdButtonGroup extends LitElement {
|
|
13
|
-
|
|
14
|
-
static get styles() {
|
|
15
|
-
return [
|
|
16
|
-
// Import Shared Styles for defined styles vars
|
|
17
|
-
SharedInputStyles,
|
|
18
|
-
css`
|
|
19
|
-
|
|
20
|
-
:host {
|
|
21
|
-
--my-justify-prop: var(--justify-prop, space-around);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.button-group {
|
|
27
|
-
display: flex;
|
|
28
|
-
justify-content: var(--my-justify-prop);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
`];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
static get properties() {
|
|
35
|
-
return {
|
|
36
|
-
buttons: {type: Array}
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
constructor() {
|
|
41
|
-
super();
|
|
42
|
-
this.buttons = []
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
render() {
|
|
46
|
-
return html`
|
|
47
|
-
<div class="button-group">
|
|
48
|
-
${this.buttons.map(entry => html`
|
|
49
|
-
<pd-button text="${entry.text}" style="visibility: ${entry.visibility};"></pd-button>
|
|
50
|
-
`)}
|
|
51
|
-
</div>
|
|
52
|
-
`;
|
|
53
|
-
}
|
|
54
|
-
}
|
package/src/PdLabelValue.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
|
|
4
|
-
* This code may only be used under the BSD style license found at
|
|
5
|
-
* http://polymer.github.io/LICENSE.txt
|
|
6
|
-
* The complete set of authors may be found at
|
|
7
|
-
* http://polymer.github.io/AUTHORS.txt
|
|
8
|
-
* The complete set of contributors may be found at
|
|
9
|
-
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
10
|
-
* Code distributed by Google as part of the polymer project is also
|
|
11
|
-
* subject to an additional IP rights grant found at
|
|
12
|
-
* http://polymer.github.io/PATENTS.txt
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import {LitElement, html, css} from 'lit';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* An example element.
|
|
19
|
-
*
|
|
20
|
-
* @slot - This element has a slot
|
|
21
|
-
* @csspart button - The button
|
|
22
|
-
*/
|
|
23
|
-
export class PdLabelValue extends LitElement {
|
|
24
|
-
|
|
25
|
-
static get styles() {
|
|
26
|
-
return css`
|
|
27
|
-
:host {
|
|
28
|
-
|
|
29
|
-
--my-label-color: var(--squi-background-color, #24a3b9);
|
|
30
|
-
--my-label-font: var(--squi-background-color, #24a3b9);
|
|
31
|
-
|
|
32
|
-
--my-value-color: var(--squi-background-hover-color, #23636e);
|
|
33
|
-
--my-value-font: var(--squi-background-hover-color, #23636e);
|
|
34
|
-
|
|
35
|
-
display: block;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.container {
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.label {
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.value {
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
`;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
static get properties() {
|
|
54
|
-
return {
|
|
55
|
-
label: {type: String},
|
|
56
|
-
value: {type: String}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
constructor() {
|
|
61
|
-
super();
|
|
62
|
-
this.label = '';
|
|
63
|
-
this.value = '';
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
render() {
|
|
67
|
-
return html`
|
|
68
|
-
<div class="container">
|
|
69
|
-
<span class="label">${this.label}</span>
|
|
70
|
-
<span class="value">${this.value}</span>
|
|
71
|
-
</div>
|
|
72
|
-
`;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import '../pd-label-value.js';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'PdForms/Label Value',
|
|
6
|
-
component: 'pd-label-value',
|
|
7
|
-
argTypes: {
|
|
8
|
-
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
function Template() {
|
|
13
|
-
return html`
|
|
14
|
-
<h1>Label Value Story</h1>
|
|
15
|
-
<p>Component not used at the moment.</p>
|
|
16
|
-
<pd-label-value label="Test" value="Mein Wert"></pd-label-value>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<p>DL Test</p>
|
|
20
|
-
<dl>
|
|
21
|
-
<dt>Coffee</dt>
|
|
22
|
-
<dd>Black hot drink</dd>
|
|
23
|
-
<dt>Milk</dt>
|
|
24
|
-
<dd>White cold drink</dd>
|
|
25
|
-
</dl>
|
|
26
|
-
`;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const LabelValue = Template.bind({});
|
|
30
|
-
LabelValue.args = {
|
|
31
|
-
};
|
|
32
|
-
|