@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
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import '../../pd-checkbox.js';
|
|
3
|
-
import '../../pd-form-container.js';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'PdForms/Checkbox',
|
|
7
|
-
component: 'pd-checkbox',
|
|
8
|
-
parameters: {
|
|
9
|
-
actions: {
|
|
10
|
-
handles: ['checkbox-changed'],
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
function Template({ errorMsg }) {
|
|
16
|
-
return html`
|
|
17
|
-
<h3>Checkbox selected</h3>
|
|
18
|
-
<pd-checkbox valueName="Test1" value="true">
|
|
19
|
-
Label zur Checkbox
|
|
20
|
-
</pd-checkbox>
|
|
21
|
-
|
|
22
|
-
<h3>Checkbox unselected</h3>
|
|
23
|
-
<pd-checkbox valueName="Test2" value="false">
|
|
24
|
-
Label zur Checkbox
|
|
25
|
-
</pd-checkbox>
|
|
26
|
-
|
|
27
|
-
<h3>Checkbox readonly</h3>
|
|
28
|
-
<pd-checkbox valueName="Test3" value="false" readonly>
|
|
29
|
-
Label zur Checkbox
|
|
30
|
-
</pd-checkbox>
|
|
31
|
-
<pd-checkbox valueName="Test4" value="true" readonly>
|
|
32
|
-
Label zur Checkbox
|
|
33
|
-
</pd-checkbox>
|
|
34
|
-
|
|
35
|
-
<h3>Checkbox disabled</h3>
|
|
36
|
-
<pd-checkbox valueName="Test5" value="false" disabled>
|
|
37
|
-
Label zur Checkbox
|
|
38
|
-
</pd-checkbox>
|
|
39
|
-
<pd-checkbox valueName="Test6" value="true" disabled>
|
|
40
|
-
Label zur Checkbox
|
|
41
|
-
</pd-checkbox>
|
|
42
|
-
|
|
43
|
-
<h3>Checkbox required</h3>
|
|
44
|
-
<pd-form-container id="testCheckboxContainerId">
|
|
45
|
-
<pd-checkbox valueName="Test7" required>
|
|
46
|
-
Label zur Checkbox
|
|
47
|
-
</pd-checkbox>
|
|
48
|
-
</pd-form-container>
|
|
49
|
-
|
|
50
|
-
<h2>Test Validation</h2>
|
|
51
|
-
<button
|
|
52
|
-
@click="${() => {
|
|
53
|
-
document.getElementById('testCheckboxContainerId').dispatchEvent(
|
|
54
|
-
new CustomEvent("validate-form", {detail: {errorMap: new Map()}})
|
|
55
|
-
);
|
|
56
|
-
}}"
|
|
57
|
-
>
|
|
58
|
-
Test Validate
|
|
59
|
-
</button>
|
|
60
|
-
`;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function SwitchTemplate({ errorMsg }) {
|
|
64
|
-
return html`
|
|
65
|
-
<h3>Switch selected</h3>
|
|
66
|
-
<pd-checkbox name="Test1" isSwitch value="true"
|
|
67
|
-
>Label zur Checkbox</pd-checkbox
|
|
68
|
-
>
|
|
69
|
-
|
|
70
|
-
<h3>Switch unselected</h3>
|
|
71
|
-
<pd-checkbox name="Test2" isSwitch value="false"
|
|
72
|
-
>Label zur Checkbox</pd-checkbox
|
|
73
|
-
>
|
|
74
|
-
|
|
75
|
-
<h3>Switch disabled</h3>
|
|
76
|
-
<pd-checkbox name="Test2" isSwitch value="false" disabled
|
|
77
|
-
>Label zur Checkbox</pd-checkbox
|
|
78
|
-
>
|
|
79
|
-
<h3>Switch disabled</h3>
|
|
80
|
-
<pd-checkbox name="Test2" isSwitch value="true" disabled
|
|
81
|
-
>Label zur Checkbox</pd-checkbox
|
|
82
|
-
>
|
|
83
|
-
|
|
84
|
-
<h3>Switch readonly</h3>
|
|
85
|
-
<pd-checkbox name="Test2" isSwitch value="false" readonly
|
|
86
|
-
>Label zur Checkbox</pd-checkbox
|
|
87
|
-
>
|
|
88
|
-
<h3>Switch readonly</h3>
|
|
89
|
-
<pd-checkbox name="Test2" isSwitch value="true" readonly
|
|
90
|
-
>Label zur Checkbox</pd-checkbox
|
|
91
|
-
>
|
|
92
|
-
`;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export const Checkbox = Template.bind({});
|
|
96
|
-
Checkbox.args = {
|
|
97
|
-
errorMsg: '',
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export const Switch = SwitchTemplate.bind({});
|
|
101
|
-
Switch.args = {
|
|
102
|
-
errorMsg: '',
|
|
103
|
-
};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import '../../pd-form-container.js';
|
|
3
|
-
import '../../pd-form-row.js';
|
|
4
|
-
import '../../pd-input.js';
|
|
5
|
-
import '../../pd-input-file.js';
|
|
6
|
-
import '../../pd-range.js';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: 'PdForms/Form Container',
|
|
10
|
-
component: 'pd-form-container',
|
|
11
|
-
argTypes: {},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const OPTIONS_GENRE = {
|
|
15
|
-
0: "Keine Auswahl",
|
|
16
|
-
1: "No-Go",
|
|
17
|
-
2: "Wenig",
|
|
18
|
-
3: "Mittel",
|
|
19
|
-
4: "Viel",
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
function Template() {
|
|
23
|
-
return html`
|
|
24
|
-
<h3>Mit Forms</h3>
|
|
25
|
-
<pd-form-container id="testFormContainerId" requiredFieldInfo>
|
|
26
|
-
<pd-form-row>
|
|
27
|
-
<pd-input class="quarter2" id="test1Id" label="Label 1" required autoCompleteName="email"></pd-input>
|
|
28
|
-
<pd-input-file class="quarter2" id="test2Id" label="Label 2" required></pd-input-file>
|
|
29
|
-
</pd-form-row>
|
|
30
|
-
<pd-form-row>
|
|
31
|
-
<pd-input class="quarter4" id="test3Id" label="Label 3" required></pd-input>
|
|
32
|
-
</pd-form-row>
|
|
33
|
-
<pd-form-row>
|
|
34
|
-
<pd-input class="quarter3" id="test4Id" label="Label 4"></pd-input>
|
|
35
|
-
</pd-form-row>
|
|
36
|
-
<pd-form-row>
|
|
37
|
-
<pd-input class="quarter1" id="test5Id" label="Label 5"></pd-input>
|
|
38
|
-
<pd-input class="quarter1" id="test6Id" label="Label 6"></pd-input>
|
|
39
|
-
<pd-input class="quarter1" id="test7Id" label="Label 7"></pd-input>
|
|
40
|
-
<pd-input class="quarter1" id="test8Id" label="Label 8"></pd-input>
|
|
41
|
-
</pd-form-row>
|
|
42
|
-
<pd-form-row>
|
|
43
|
-
<pd-input class="quarter3" id="test9Id" label="Label 5"></pd-input>
|
|
44
|
-
<pd-input class="quarter1" id="test10Id" label="Label 6"></pd-input>
|
|
45
|
-
</pd-form-row>
|
|
46
|
-
<pd-form-row>
|
|
47
|
-
<pd-input-area class="quarter3-area" id="test19Id" label="Label Area" required></pd-input-area>
|
|
48
|
-
<pd-input-area class="quarter1-area" id="test20Id" label="Label Area" required
|
|
49
|
-
requiredMsg="Das ist eine richtig lange Fehlermeldung. Diese kann per Parameter für spezielle Felder wie die AGB Checkbox gesetzt werden.">
|
|
50
|
-
</pd-input-area>
|
|
51
|
-
</pd-form-row>
|
|
52
|
-
<pd-form-row>
|
|
53
|
-
<pd-input class="quarter1" id="test11Id" label="Label 5"></pd-input>
|
|
54
|
-
<pd-input class="quarter3" id="test12Id" label="Label 6"></pd-input>
|
|
55
|
-
</pd-form-row>
|
|
56
|
-
<pd-form-row>
|
|
57
|
-
<pd-input class="quarter1" id="test13Id" label="Label 5"></pd-input>
|
|
58
|
-
<pd-input class="quarter1" id="test14Id" label="Label 5"></pd-input>
|
|
59
|
-
<pd-input class="quarter2" id="test15Id" label="Label 6"></pd-input>
|
|
60
|
-
</pd-form-row>
|
|
61
|
-
<pd-form-row>
|
|
62
|
-
<pd-input-area class="quarter4-area" id="test16Id" label="Label Area" required></pd-input-area>
|
|
63
|
-
</pd-form-row>
|
|
64
|
-
<pd-form-row>
|
|
65
|
-
<pd-input-area class="quarter2-area" id="test17Id" label="Label Area" required></pd-input-area>
|
|
66
|
-
<pd-input-area class="quarter2-area" id="test18Id" label="Label Area" required
|
|
67
|
-
requiredMsg="Das ist eine richtig lange Fehlermeldung. Diese kann per Parameter für spezielle Felder wie die AGB Checkbox gesetzt werden."></pd-input-area>
|
|
68
|
-
</pd-form-row>
|
|
69
|
-
<pd-form-row>
|
|
70
|
-
<pd-range id="testRangeId"
|
|
71
|
-
label="Range Label"
|
|
72
|
-
max="12"
|
|
73
|
-
value="0" .optionValueMapper="${OPTIONS_GENRE}" required>
|
|
74
|
-
</pd-range>
|
|
75
|
-
</pd-form-row>
|
|
76
|
-
<pd-form-row>
|
|
77
|
-
<pd-range id="testRangeId"
|
|
78
|
-
label="Mit Helper"
|
|
79
|
-
max="12"
|
|
80
|
-
helperTxt="Hier kommt dann kluges hin"
|
|
81
|
-
value="0" .optionValueMapper="${OPTIONS_GENRE}" required>
|
|
82
|
-
</pd-range>
|
|
83
|
-
</pd-form-row>
|
|
84
|
-
</pd-form-container>
|
|
85
|
-
|
|
86
|
-
<h2>Test Validation</h2>
|
|
87
|
-
<button
|
|
88
|
-
@click="${() => {
|
|
89
|
-
document.getElementById('testFormContainerId').dispatchEvent(
|
|
90
|
-
new CustomEvent("validate-form", {detail: {errorMap: new Map()}})
|
|
91
|
-
);
|
|
92
|
-
}}"
|
|
93
|
-
>
|
|
94
|
-
Test Validate
|
|
95
|
-
</button>
|
|
96
|
-
`;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export const FormContainer = Template.bind({});
|
|
100
|
-
FormContainer.args = {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import '../../pd-form-row.js';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'PdForms/Form Row',
|
|
6
|
-
component: 'pd-form-row',
|
|
7
|
-
argTypes: {},
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
function Template() {
|
|
11
|
-
return html`
|
|
12
|
-
<h3>Noch im test ob Sinnvoll....</h3>
|
|
13
|
-
<div style="">
|
|
14
|
-
<pd-form-row>
|
|
15
|
-
<div style="background-color: blue;">Hier ist es blau</div>
|
|
16
|
-
<div style="background-color: red;">Hier ist es rot</div>
|
|
17
|
-
</pd-form-row>
|
|
18
|
-
</div>
|
|
19
|
-
`;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const FormRow = Template.bind({});
|
|
23
|
-
FormRow.args = {};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import '../../pd-input-area.js';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'PdForms/Input Area',
|
|
6
|
-
component: 'pd-input-area',
|
|
7
|
-
argTypes: {
|
|
8
|
-
primaryColor: { control: 'color' },
|
|
9
|
-
secondaryColor: { control: 'color' },
|
|
10
|
-
textColor: { control: 'color' },
|
|
11
|
-
highlightColor: { control: 'color' },
|
|
12
|
-
errorColor: { control: 'color' },
|
|
13
|
-
errorBackgroundColor: { control: 'color' },
|
|
14
|
-
borderRadius: { control: 'text' },
|
|
15
|
-
displayFont: { control: 'text' },
|
|
16
|
-
fontSize: { control: 'text' },
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
function Template({
|
|
21
|
-
primaryColor,
|
|
22
|
-
secondaryColor,
|
|
23
|
-
textColor,
|
|
24
|
-
highlightColor,
|
|
25
|
-
errorColor,
|
|
26
|
-
errorBackgroundColor,
|
|
27
|
-
borderRadius,
|
|
28
|
-
displayFont,
|
|
29
|
-
fontSize,
|
|
30
|
-
}) {
|
|
31
|
-
let style = '';
|
|
32
|
-
if (primaryColor) {
|
|
33
|
-
style += `--squi-primary-color:${primaryColor};`;
|
|
34
|
-
}
|
|
35
|
-
if (secondaryColor) {
|
|
36
|
-
style += `--squi-secondary-color:${secondaryColor};`;
|
|
37
|
-
}
|
|
38
|
-
if (textColor) {
|
|
39
|
-
style += `--squi-text-color:${textColor};`;
|
|
40
|
-
}
|
|
41
|
-
if (highlightColor) {
|
|
42
|
-
style += `--squi-highlight-color:${highlightColor};`;
|
|
43
|
-
}
|
|
44
|
-
if (errorColor) {
|
|
45
|
-
style += `--squi-error-color:${errorColor};`;
|
|
46
|
-
}
|
|
47
|
-
if (errorBackgroundColor) {
|
|
48
|
-
style += `--squi-error-background-color:${errorBackgroundColor};`;
|
|
49
|
-
}
|
|
50
|
-
if (borderRadius) {
|
|
51
|
-
style += `--squi-border-radius:${borderRadius};`;
|
|
52
|
-
}
|
|
53
|
-
if (displayFont) {
|
|
54
|
-
style += `--squi-display-font:${displayFont};`;
|
|
55
|
-
}
|
|
56
|
-
if (fontSize) {
|
|
57
|
-
style += `--squi-font-size:${fontSize};`;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return html`
|
|
61
|
-
<h3>Input Area default</h3>
|
|
62
|
-
<pd-input-area id="testId1" style="${style}"></pd-input-area>
|
|
63
|
-
|
|
64
|
-
<h3>Input Area default with value</h3>
|
|
65
|
-
<pd-input-area
|
|
66
|
-
id="testId2"
|
|
67
|
-
style="${style}"
|
|
68
|
-
value="Das ist mein Text-Area Input value"
|
|
69
|
-
></pd-input-area>
|
|
70
|
-
|
|
71
|
-
<h3>Input Area with value - custom size</h3>
|
|
72
|
-
<pd-input-area
|
|
73
|
-
id="testId3"
|
|
74
|
-
style="${style}"
|
|
75
|
-
value="Das ist mein Text-Area Input value. Der kann auch ein bißchen länger sein. Weitere Zeilen stehen hier...."
|
|
76
|
-
></pd-input-area>
|
|
77
|
-
|
|
78
|
-
<h3>Input Area with placeholder - custom size</h3>
|
|
79
|
-
<pd-input-area
|
|
80
|
-
id="testId4"
|
|
81
|
-
style="${style}"
|
|
82
|
-
placeHolder="Hier steht ein placeholder Text"
|
|
83
|
-
></pd-input-area>
|
|
84
|
-
|
|
85
|
-
<h3>
|
|
86
|
-
Input Area with value - custom size - label => ToDo: Derzeit ohne
|
|
87
|
-
cols/rows nur mit css props
|
|
88
|
-
</h3>
|
|
89
|
-
<pd-input-area
|
|
90
|
-
id="testId5"
|
|
91
|
-
style="${style}"
|
|
92
|
-
label="Area Label 1"
|
|
93
|
-
rows="10"
|
|
94
|
-
value="Mein Text..."
|
|
95
|
-
></pd-input-area>
|
|
96
|
-
|
|
97
|
-
<h3>Input Area with error - custom size - label</h3>
|
|
98
|
-
<pd-input-area
|
|
99
|
-
id="testId6"
|
|
100
|
-
style="${style}"
|
|
101
|
-
label="Area Label 2"
|
|
102
|
-
value="Mein Text..."
|
|
103
|
-
errorMsg="Fehler augetreten"
|
|
104
|
-
></pd-input-area>
|
|
105
|
-
|
|
106
|
-
<h3>Input Area disabled - custom size - label</h3>
|
|
107
|
-
<pd-input-area
|
|
108
|
-
id="testId7"
|
|
109
|
-
style="${style}"
|
|
110
|
-
label="Area Label 3"
|
|
111
|
-
value="Mein Text..."
|
|
112
|
-
?disabled="${true}"
|
|
113
|
-
></pd-input-area>
|
|
114
|
-
|
|
115
|
-
<h3>Input Area readonly - custom size - label</h3>
|
|
116
|
-
<pd-input-area
|
|
117
|
-
id="testId8"
|
|
118
|
-
style="${style}"
|
|
119
|
-
cols="60"
|
|
120
|
-
rows="3"
|
|
121
|
-
label="Area Label 4"
|
|
122
|
-
value="Mein Text..."
|
|
123
|
-
?readonly="${true}"
|
|
124
|
-
></pd-input-area>
|
|
125
|
-
`;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export const InputArea = Template.bind({});
|
|
129
|
-
InputArea.args = {};
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import '../../pd-input-file.js';
|
|
3
|
-
import { ICON_DATE } from '@progressive-development/pd-icon/src/PdIcon.js';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'PdForms/InputFile',
|
|
7
|
-
component: 'pd-input-file',
|
|
8
|
-
argTypes: {
|
|
9
|
-
primaryColor: { control: 'color' },
|
|
10
|
-
secondaryColor: { control: 'color' },
|
|
11
|
-
textColor: { control: 'color' },
|
|
12
|
-
highlightColor: { control: 'color' },
|
|
13
|
-
errorColor: { control: 'color' },
|
|
14
|
-
errorBackgroundColor: { control: 'color' },
|
|
15
|
-
borderRadius: { control: 'text' },
|
|
16
|
-
displayFont: { control: 'text' },
|
|
17
|
-
fontSize: { control: 'text' },
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
function Template({
|
|
22
|
-
primaryColor,
|
|
23
|
-
secondaryColor,
|
|
24
|
-
textColor,
|
|
25
|
-
highlightColor,
|
|
26
|
-
errorColor,
|
|
27
|
-
errorBackgroundColor,
|
|
28
|
-
borderRadius,
|
|
29
|
-
displayFont,
|
|
30
|
-
fontSize,
|
|
31
|
-
accept
|
|
32
|
-
}) {
|
|
33
|
-
let style = '';
|
|
34
|
-
if (primaryColor) {
|
|
35
|
-
style += `--squi-primary-color:${primaryColor};`;
|
|
36
|
-
}
|
|
37
|
-
if (secondaryColor) {
|
|
38
|
-
style += `--squi-secondary-color:${secondaryColor};`;
|
|
39
|
-
}
|
|
40
|
-
if (textColor) {
|
|
41
|
-
style += `--squi-text-color:${textColor};`;
|
|
42
|
-
}
|
|
43
|
-
if (highlightColor) {
|
|
44
|
-
style += `--squi-highlight-color:${highlightColor};`;
|
|
45
|
-
}
|
|
46
|
-
if (errorColor) {
|
|
47
|
-
style += `--squi-error-color:${errorColor};`;
|
|
48
|
-
}
|
|
49
|
-
if (errorBackgroundColor) {
|
|
50
|
-
style += `--squi-error-background-color:${errorBackgroundColor};`;
|
|
51
|
-
}
|
|
52
|
-
if (borderRadius) {
|
|
53
|
-
style += `--squi-border-radius:${borderRadius};`;
|
|
54
|
-
}
|
|
55
|
-
if (displayFont) {
|
|
56
|
-
style += `--squi-display-font:${displayFont};`;
|
|
57
|
-
}
|
|
58
|
-
if (fontSize) {
|
|
59
|
-
style += `--squi-font-size:${fontSize};`;
|
|
60
|
-
}
|
|
61
|
-
return html`
|
|
62
|
-
<h3>Default Input</h3>
|
|
63
|
-
<pd-input-file id="test1Id" style="${style}"></pd-input-file>
|
|
64
|
-
|
|
65
|
-
<h3>Input with Icon</h3>
|
|
66
|
-
<pd-input-file
|
|
67
|
-
icon-right
|
|
68
|
-
id="testIconId"
|
|
69
|
-
icon="${ICON_DATE}"
|
|
70
|
-
></pd-input-file>
|
|
71
|
-
|
|
72
|
-
<h3>Input with left Icon</h3>
|
|
73
|
-
<pd-input-file
|
|
74
|
-
icon-left
|
|
75
|
-
id="testIcon2Id"
|
|
76
|
-
icon="${ICON_DATE}"
|
|
77
|
-
></pd-input-file>
|
|
78
|
-
|
|
79
|
-
<h3>Input with max lenth</h3>
|
|
80
|
-
<pd-input-file
|
|
81
|
-
id="test5Id"
|
|
82
|
-
maxlength="4"
|
|
83
|
-
></pd-input-file>
|
|
84
|
-
|
|
85
|
-
<h3>Input with accept</h3>
|
|
86
|
-
<pd-input-file
|
|
87
|
-
id="test5Id"
|
|
88
|
-
maxlength="4"
|
|
89
|
-
accept="${accept}"
|
|
90
|
-
></pd-input-file>
|
|
91
|
-
|
|
92
|
-
<h3>Input with label</h3>
|
|
93
|
-
<pd-input-file
|
|
94
|
-
id="test6Id"
|
|
95
|
-
label="Input Label 1"
|
|
96
|
-
></pd-input-file>
|
|
97
|
-
|
|
98
|
-
<h3>Input with label - disabled</h3>
|
|
99
|
-
<pd-input-file
|
|
100
|
-
id="test7Id"
|
|
101
|
-
label="Input Label 1"
|
|
102
|
-
disabled
|
|
103
|
-
></pd-input-file>
|
|
104
|
-
|
|
105
|
-
`;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export const InputFile = Template.bind({});
|
|
109
|
-
InputFile.args = {
|
|
110
|
-
accept: "text/*"
|
|
111
|
-
};
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import '../../pd-input.js';
|
|
3
|
-
import { ICON_CAMERA, ICON_DATE } from '@progressive-development/pd-icon/src/PdIcon.js';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'PdForms/Input',
|
|
7
|
-
component: 'pd-input',
|
|
8
|
-
argTypes: {
|
|
9
|
-
primaryColor: { control: 'color' },
|
|
10
|
-
secondaryColor: { control: 'color' },
|
|
11
|
-
textColor: { control: 'color' },
|
|
12
|
-
highlightColor: { control: 'color' },
|
|
13
|
-
errorColor: { control: 'color' },
|
|
14
|
-
errorBackgroundColor: { control: 'color' },
|
|
15
|
-
borderRadius: { control: 'text' },
|
|
16
|
-
displayFont: { control: 'text' },
|
|
17
|
-
fontSize: { control: 'text' },
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
function Template({
|
|
22
|
-
primaryColor,
|
|
23
|
-
secondaryColor,
|
|
24
|
-
textColor,
|
|
25
|
-
highlightColor,
|
|
26
|
-
errorColor,
|
|
27
|
-
errorBackgroundColor,
|
|
28
|
-
borderRadius,
|
|
29
|
-
displayFont,
|
|
30
|
-
fontSize,
|
|
31
|
-
}) {
|
|
32
|
-
let style = '';
|
|
33
|
-
if (primaryColor) {
|
|
34
|
-
style += `--squi-primary-color:${primaryColor};`;
|
|
35
|
-
}
|
|
36
|
-
if (secondaryColor) {
|
|
37
|
-
style += `--squi-secondary-color:${secondaryColor};`;
|
|
38
|
-
}
|
|
39
|
-
if (textColor) {
|
|
40
|
-
style += `--squi-text-color:${textColor};`;
|
|
41
|
-
}
|
|
42
|
-
if (highlightColor) {
|
|
43
|
-
style += `--squi-highlight-color:${highlightColor};`;
|
|
44
|
-
}
|
|
45
|
-
if (errorColor) {
|
|
46
|
-
style += `--squi-error-color:${errorColor};`;
|
|
47
|
-
}
|
|
48
|
-
if (errorBackgroundColor) {
|
|
49
|
-
style += `--squi-error-background-color:${errorBackgroundColor};`;
|
|
50
|
-
}
|
|
51
|
-
if (borderRadius) {
|
|
52
|
-
style += `--squi-border-radius:${borderRadius};`;
|
|
53
|
-
}
|
|
54
|
-
if (displayFont) {
|
|
55
|
-
style += `--squi-display-font:${displayFont};`;
|
|
56
|
-
}
|
|
57
|
-
if (fontSize) {
|
|
58
|
-
style += `--squi-font-size:${fontSize};`;
|
|
59
|
-
}
|
|
60
|
-
return html`
|
|
61
|
-
<h3>Default Input</h3>
|
|
62
|
-
<pd-input id="test1Id" style="${style}"></pd-input>
|
|
63
|
-
|
|
64
|
-
<h3>Default Input with place holder</h3>
|
|
65
|
-
<pd-input
|
|
66
|
-
id="test2Id"
|
|
67
|
-
placeHolder="Placeholder Text"
|
|
68
|
-
></pd-input>
|
|
69
|
-
|
|
70
|
-
<h3>Default Input only Numbers</h3>
|
|
71
|
-
<pd-input
|
|
72
|
-
id="test2Id"
|
|
73
|
-
onlyNumbers
|
|
74
|
-
placeHolder="Placeholder Text"
|
|
75
|
-
></pd-input>
|
|
76
|
-
|
|
77
|
-
<h3>Default Input with value</h3>
|
|
78
|
-
<pd-input
|
|
79
|
-
id="test3Id"
|
|
80
|
-
value="My input value"
|
|
81
|
-
></pd-input>
|
|
82
|
-
|
|
83
|
-
<h3>Input with value - Error</h3>
|
|
84
|
-
<pd-input
|
|
85
|
-
id="test4Id"
|
|
86
|
-
value="My input value"
|
|
87
|
-
errorMsg="Fehler aufgetreten"
|
|
88
|
-
></pd-input>
|
|
89
|
-
|
|
90
|
-
<h3>Input with right assigned text</h3>
|
|
91
|
-
<pd-input
|
|
92
|
-
text-right
|
|
93
|
-
id="testRightTextId"
|
|
94
|
-
value="Right Text"
|
|
95
|
-
></pd-input>
|
|
96
|
-
|
|
97
|
-
<h3>Input with right assigned text and icon</h3>
|
|
98
|
-
<pd-input
|
|
99
|
-
id="testRightTextId"
|
|
100
|
-
text-right
|
|
101
|
-
icon-right
|
|
102
|
-
icon="${ICON_DATE}"
|
|
103
|
-
value="Right Text"
|
|
104
|
-
></pd-input>
|
|
105
|
-
|
|
106
|
-
<h3>Input with Icon</h3>
|
|
107
|
-
<pd-input
|
|
108
|
-
icon-right
|
|
109
|
-
id="testIconId"
|
|
110
|
-
value="Input value"
|
|
111
|
-
icon="${ICON_DATE}"
|
|
112
|
-
></pd-input>
|
|
113
|
-
|
|
114
|
-
<h3>Big Input with left Icon</h3>
|
|
115
|
-
<pd-input
|
|
116
|
-
style="--pd-input-field-height: 4em;"
|
|
117
|
-
icon-left
|
|
118
|
-
id="testIcon2Id"
|
|
119
|
-
value="Input value"
|
|
120
|
-
icon="${ICON_DATE}"
|
|
121
|
-
></pd-input>
|
|
122
|
-
|
|
123
|
-
<h3>Input with max lenth and size</h3>
|
|
124
|
-
<pd-input
|
|
125
|
-
id="test5Id"
|
|
126
|
-
maxlength="4"
|
|
127
|
-
style="${`--pd-input-field-width: 80px;`}"
|
|
128
|
-
></pd-input>
|
|
129
|
-
|
|
130
|
-
<h3>Input with place holder and label</h3>
|
|
131
|
-
<pd-input
|
|
132
|
-
id="test6Id"
|
|
133
|
-
label="Input Label 1"
|
|
134
|
-
placeHolder="Placeholder Text"
|
|
135
|
-
></pd-input>
|
|
136
|
-
|
|
137
|
-
<h3>Input with place holder and label - disabled</h3>
|
|
138
|
-
<pd-input
|
|
139
|
-
id="test7Id"
|
|
140
|
-
label="Input Label 1"
|
|
141
|
-
placeHolder="Placeholder Text"
|
|
142
|
-
disabled
|
|
143
|
-
></pd-input>
|
|
144
|
-
|
|
145
|
-
<h3>Input with value and label - disabled</h3>
|
|
146
|
-
<pd-input
|
|
147
|
-
id="test8Id"
|
|
148
|
-
label="Input Label 1"
|
|
149
|
-
value="My Value"
|
|
150
|
-
disabled
|
|
151
|
-
></pd-input>
|
|
152
|
-
|
|
153
|
-
<h3>Input with place holder and label - readonly</h3>
|
|
154
|
-
<pd-input
|
|
155
|
-
id="test7Id"
|
|
156
|
-
label="Input Label 1"
|
|
157
|
-
placeHolder="Placeholder Text"
|
|
158
|
-
readonly
|
|
159
|
-
></pd-input>
|
|
160
|
-
|
|
161
|
-
<h3>Input with value and label - readonly</h3>
|
|
162
|
-
<pd-input
|
|
163
|
-
id="test8Id"
|
|
164
|
-
label="Input Label 1"
|
|
165
|
-
value="My Value"
|
|
166
|
-
readonly
|
|
167
|
-
></pd-input>
|
|
168
|
-
|
|
169
|
-
<h3>Input with value and label - error</h3>
|
|
170
|
-
<pd-input
|
|
171
|
-
id="test4Id"
|
|
172
|
-
label="Test Label"
|
|
173
|
-
value="My input value"
|
|
174
|
-
></pd-input>
|
|
175
|
-
`;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export const Input = Template.bind({});
|
|
179
|
-
Input.args = {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import '../../pd-checkbox.js';
|
|
3
|
-
import '../../pd-radio-group.js';
|
|
4
|
-
import '../../pd-form-container.js';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'PdForms/Radio Group',
|
|
8
|
-
component: 'pd-radio-group',
|
|
9
|
-
argTypes: {},
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
function Template() {
|
|
13
|
-
return html`
|
|
14
|
-
<h1>Radio Group</h1>
|
|
15
|
-
<p style="color: red;">
|
|
16
|
-
Working progress, checkbox style not suitable here
|
|
17
|
-
</p>
|
|
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>
|
|
26
|
-
|
|
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>
|
|
33
|
-
|
|
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>
|
|
48
|
-
`;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export const RadioGroup = Template.bind({});
|
|
52
|
-
RadioGroup.args = {
|
|
53
|
-
|
|
54
|
-
};
|