@progressive-development/pd-forms 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/package.json +2 -2
  2. package/pd-button-goup.js +3 -0
  3. package/pd-button.js +3 -0
  4. package/pd-checkbox.js +3 -0
  5. package/pd-form-container.js +3 -0
  6. package/pd-form-row.js +3 -0
  7. package/pd-input-area.js +3 -0
  8. package/pd-input.js +3 -0
  9. package/pd-label-value.js +3 -0
  10. package/pd-radio-group.js +3 -0
  11. package/pd-select.js +3 -0
  12. package/src/{squi-base-ui.js → PdBaseUi.js} +1 -1
  13. package/src/{squi-base-ui-input.js → PdBaseUiInput.js} +2 -2
  14. package/src/{squi-button.js → PdButton.js} +10 -10
  15. package/src/{squi-button-group.js → PdButtonGroup.js} +3 -3
  16. package/src/{squi-checkbox.js → PdCheckbox.js} +22 -22
  17. package/src/{squi-form-container.js → PdFormContainer.js} +1 -1
  18. package/src/{squi-form-row.js → PdFormRow.js} +1 -1
  19. package/src/{squi-input.js → PdInput.js} +15 -15
  20. package/src/{squi-input-area.js → PdInputArea.js} +13 -13
  21. package/src/PdLabelValue.js +75 -0
  22. package/src/{squi-radio-group.js → PdRadioGroup.js} +4 -4
  23. package/src/{squi-select.js → PdSelect.js} +9 -9
  24. package/src/shared-input-styles.js +11 -11
  25. package/stories/button.stories.js +15 -0
  26. package/stories/checkbox.stories.js +50 -0
  27. package/stories/form-container.stories.js +50 -0
  28. package/stories/index.stories.js +297 -29
  29. package/stories/input-area.stories.js +129 -0
  30. package/stories/input.stories.js +130 -0
  31. package/stories/label-value.stories.js +32 -0
  32. package/stories/radio-group.stories.js +45 -0
  33. package/stories/select.stories.js +104 -0
  34. package/PdButton.js +0 -3
  35. package/PdButtonGroup.js +0 -3
  36. package/PdCheckbox.js +0 -3
  37. package/PdFormContainer.js +0 -3
  38. package/PdFormRow.js +0 -3
  39. package/PdInput.js +0 -3
  40. package/PdInputArea.js +0 -3
  41. package/PdRadioGroup.js +0 -3
  42. package/PdSelect.js +0 -3
@@ -0,0 +1,130 @@
1
+ import { html } from 'lit';
2
+ import '../pd-input.js';
3
+
4
+ export default {
5
+ title: 'PdForms/Input',
6
+ component: 'pd-input',
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
+ return html`
60
+ <h3>Default Input</h3>
61
+ <pd-input id="test1Id" style="${style}"></pd-input>
62
+
63
+ <h3>Default Input with place holder</h3>
64
+ <pd-input
65
+ id="test2Id"
66
+ placeHolder="Placeholder Text"
67
+ style="${style}"
68
+ ></pd-input>
69
+
70
+ <h3>Default Input with value</h3>
71
+ <pd-input
72
+ id="test3Id"
73
+ value="My input value"
74
+ style="${style}"
75
+ ></pd-input>
76
+
77
+ <h3>Input with value - Error</h3>
78
+ <pd-input
79
+ id="test4Id"
80
+ value="My input value"
81
+ errorMsg="Fehler aufgetreten"
82
+ style="${style}"
83
+ ></pd-input>
84
+
85
+ <h3>Input with max lenth and size</h3>
86
+ <pd-input
87
+ id="test5Id"
88
+ maxlength="4"
89
+ style="${`${style}--squi-input-width: 80px;`}"
90
+ ></pd-input>
91
+
92
+ <h3>Input with place holder and label</h3>
93
+ <pd-input
94
+ id="test6Id"
95
+ label="Input Label 1"
96
+ placeHolder="Placeholder Text"
97
+ style="${style}"
98
+ ></pd-input>
99
+
100
+ <h3>Input with place holder and label - disabled</h3>
101
+ <pd-input
102
+ id="test7Id"
103
+ label="Input Label 1"
104
+ placeHolder="Placeholder Text"
105
+ ?disabled="${true}"
106
+ style="${style}"
107
+ ></pd-input>
108
+
109
+ <h3>Input with value and label - disabled</h3>
110
+ <pd-input
111
+ id="test8Id"
112
+ label="Input Label 1"
113
+ value="My Value"
114
+ ?disabled="${true}"
115
+ style="${style}"
116
+ ></pd-input>
117
+
118
+ <h3>Input with value and label - error</h3>
119
+ <pd-input
120
+ id="test4Id"
121
+ label="Test Label"
122
+ value="My input value"
123
+ errorMsg="Fehler aufgetreten"
124
+ style="${style}"
125
+ ></pd-input>
126
+ `;
127
+ }
128
+
129
+ export const Input = Template.bind({});
130
+ Input.args = {};
@@ -0,0 +1,32 @@
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
+
@@ -0,0 +1,45 @@
1
+ import { html } from 'lit';
2
+ import '../pd-checkbox.js';
3
+ import '../pd-radio-group.js';
4
+
5
+ export default {
6
+ title: 'PdForms/Radio Group',
7
+ component: 'pd-radio-group',
8
+ argTypes: {},
9
+ };
10
+
11
+ function Template({ errorMsg }) {
12
+ return html`
13
+ <h1>Radio Group</h1>
14
+ <p style="color: red;">
15
+ Working progress, checkbox style not suitable here
16
+ </p>
17
+
18
+ <p>Enter error message in custom properties to show error style</p>
19
+
20
+ <h3>Radio Group Horiz.</h3>
21
+ <pd-radio-group errorMsg="${errorMsg}">
22
+ <pd-checkbox name="Test1" value="true"
23
+ >Label zur Checkbox</pd-checkbox
24
+ >
25
+ <pd-checkbox name="Test2" value="false"
26
+ >Label zur Checkbox</pd-checkbox
27
+ >
28
+ </pd-radio-group>
29
+
30
+ <h3>Radio Group Vert.</h3>
31
+ <pd-radio-group style="--group-direction: column;" errorMsg="${errorMsg}">
32
+ <pd-checkbox name="Test3" value="true"
33
+ >Label zur Checkbox</pd-checkbox
34
+ >
35
+ <pd-checkbox name="Test4" value="false"
36
+ >Label zur Checkbox</pd-checkbox
37
+ >
38
+ </pd-radio-group>
39
+ `;
40
+ }
41
+
42
+ export const RadioGroup = Template.bind({});
43
+ RadioGroup.args = {
44
+ errorMsg: '',
45
+ };
@@ -0,0 +1,104 @@
1
+ import { html } from 'lit';
2
+ import '../pd-select.js';
3
+
4
+ export default {
5
+ title: 'PdForms/Select',
6
+ component: 'pd-select',
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
+ selectVals,
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
+
61
+ return html`
62
+ <h3>Select default</h3>
63
+ <pd-select
64
+ id="testId1"
65
+ .values="${selectVals}"
66
+ style="${style}"
67
+ ></pd-select>
68
+
69
+ <h3>Select with label</h3>
70
+ <pd-select
71
+ id="testId2"
72
+ .values="${selectVals}"
73
+ label="Label for Select"
74
+ style="${style}"
75
+ ></pd-select>
76
+
77
+ <h3>Select with label - disabled</h3>
78
+ <pd-select
79
+ id="testId2"
80
+ .values="${selectVals}"
81
+ label="Label for Select"
82
+ ?disabled="${true}"
83
+ style="${style}"
84
+ ></pd-select>
85
+
86
+ <h3>Select with label - error</h3>
87
+ <pd-select
88
+ id="testId2"
89
+ .values="${selectVals}"
90
+ label="Label for Select"
91
+ errorMsg="Fehler aufgetreten"
92
+ style="${style}"
93
+ ></pd-select>
94
+ `;
95
+ }
96
+
97
+ export const Select = Template.bind({});
98
+ Select.args = {
99
+ selectVals: [
100
+ { name: 'Option 1', value: 1 },
101
+ { name: 'Option 2', value: 2 },
102
+ { name: 'Option 3', value: 3 },
103
+ ],
104
+ };
package/PdButton.js DELETED
@@ -1,3 +0,0 @@
1
- import { SquiButton } from './src/squi-button.js';
2
-
3
- window.customElements.define('squi-button', SquiButton);
package/PdButtonGroup.js DELETED
@@ -1,3 +0,0 @@
1
- import { SquiButtonGroup } from './src/squi-button-group.js';
2
-
3
- customElements.define('squi-button-group', SquiButtonGroup);
package/PdCheckbox.js DELETED
@@ -1,3 +0,0 @@
1
- import { SquiCheckbox } from './src/squi-checkbox.js';
2
-
3
- window.customElements.define('squi-checkbox', SquiCheckbox);
@@ -1,3 +0,0 @@
1
- import { SquiFormContainer } from './src/squi-form-container.js';
2
-
3
- window.customElements.define('squi-form-container', SquiFormContainer);
package/PdFormRow.js DELETED
@@ -1,3 +0,0 @@
1
- import { SquiFormRow } from './src/squi-form-row.js';
2
-
3
- window.customElements.define('squi-form-row', SquiFormRow);
package/PdInput.js DELETED
@@ -1,3 +0,0 @@
1
- import { SquiInput } from './src/squi-input.js';
2
-
3
- window.customElements.define('squi-input', SquiInput);
package/PdInputArea.js DELETED
@@ -1,3 +0,0 @@
1
- import { SquiInputArea } from './src/squi-input-area.js';
2
-
3
- window.customElements.define('squi-input-area', SquiInputArea);
package/PdRadioGroup.js DELETED
@@ -1,3 +0,0 @@
1
- import { SquiRadioGroup } from './src/squi-radio-group.js';
2
-
3
- window.customElements.define('squi-radio-group', SquiRadioGroup);
package/PdSelect.js DELETED
@@ -1,3 +0,0 @@
1
- import { SquiSelect } from './src/squi-select.js';
2
-
3
- window.customElements.define('squi-select', SquiSelect);