@progressive-development/pd-forms 0.0.60 → 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.
@@ -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({ errorMsg }) {
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
- <p>Enter error message in custom properties to show error style</p>
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
- <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>
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
- <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>
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
- errorMsg: '',
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-select
88
- id="testId2"
89
- .values="${selectVals}"
90
- label="Label for Select"
91
- errorMsg="Fehler aufgetreten"
92
- style="${style}"
93
- ></pd-select>
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
@@ -1,3 +0,0 @@
1
- import { PdButtonGroup } from './src/PdButtonGroup.js';
2
-
3
- customElements.define('pd-button-group', PdButtonGroup);
package/pd-label-value.js DELETED
@@ -1,3 +0,0 @@
1
- import { PdLabelValue } from './src/PdLabelValue.js';
2
-
3
- window.customElements.define('pd-label-value', PdLabelValue);
@@ -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
- }
@@ -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
-