@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
package/src/PdRadioGroup.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { html, css } from 'lit';
|
|
7
|
-
import { classMap } from 'lit/directives/class-map.js';
|
|
8
|
-
|
|
9
|
-
import { PdBaseUIInput } from './PdBaseUiInput.js';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* An example element.
|
|
13
|
-
*
|
|
14
|
-
* @slot - This element has a slot
|
|
15
|
-
* @csspart button - The button
|
|
16
|
-
*/
|
|
17
|
-
export class PdRadioGroup extends PdBaseUIInput {
|
|
18
|
-
|
|
19
|
-
static get styles() {
|
|
20
|
-
return [
|
|
21
|
-
PdBaseUIInput.styles,
|
|
22
|
-
css`
|
|
23
|
-
|
|
24
|
-
.group-style {
|
|
25
|
-
display: flex;
|
|
26
|
-
gap: var(--pd-cb-group-gap, 20px);
|
|
27
|
-
flex-direction: var(--pd-cb-group-direction, row);
|
|
28
|
-
flex-wrap: wrap;
|
|
29
|
-
padding: var(--pd-input-label-padding, 0);
|
|
30
|
-
padding-top: 5px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
::slotted(pd-checkbox) {
|
|
34
|
-
--pd-cb-border-col-readonly: var(--pd-cb-border-col, var(--pd-default-col));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
`];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
firstUpdated() {
|
|
41
|
-
|
|
42
|
-
// add event listener
|
|
43
|
-
this.addEventListener('field-change', (e) => {
|
|
44
|
-
const elCollection = this.getElementsByTagName('pd-checkbox');
|
|
45
|
-
Object.keys(elCollection).forEach(keyValue => {
|
|
46
|
-
if (elCollection[keyValue] !== e.target) {
|
|
47
|
-
elCollection[keyValue].value = "false";
|
|
48
|
-
} else {
|
|
49
|
-
this.value = elCollection[keyValue].valueName;
|
|
50
|
-
}
|
|
51
|
-
elCollection[keyValue].readonly = (elCollection[keyValue].value === 'true');
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// validate radio-group after change
|
|
55
|
-
this.dispatchEvent(
|
|
56
|
-
new CustomEvent('validate-form', {
|
|
57
|
-
detail: {
|
|
58
|
-
singleElement: this,
|
|
59
|
-
errorMap: new Map()
|
|
60
|
-
},
|
|
61
|
-
composed: true,
|
|
62
|
-
bubbles: true,
|
|
63
|
-
})
|
|
64
|
-
);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// set default
|
|
68
|
-
const elColl = this.getElementsByTagName('pd-checkbox');
|
|
69
|
-
Object.keys(elColl).forEach(keyValue => {
|
|
70
|
-
if (elColl[keyValue].value === 'true') {
|
|
71
|
-
elColl[keyValue].readonly = true;
|
|
72
|
-
// führt aktuell zu update cycle log
|
|
73
|
-
this.value = elColl[keyValue].valueName;
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
render() {
|
|
79
|
-
return html`
|
|
80
|
-
${this._renderLabel()}
|
|
81
|
-
<div class="group-style input ${classMap({'error': this.errorMsg.length > 0})}">
|
|
82
|
-
<slot></slot>
|
|
83
|
-
</div>
|
|
84
|
-
${this._renderErrorMsg()}
|
|
85
|
-
`;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
}
|
package/src/PdRange copy.js
DELETED
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { html, css } from 'lit';
|
|
7
|
-
|
|
8
|
-
import { PdBaseUIInput, INPUT_TYPE_RANGE } from './PdBaseUiInput.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export class PdRange extends PdBaseUIInput {
|
|
12
|
-
|
|
13
|
-
static get properties() {
|
|
14
|
-
return {
|
|
15
|
-
min: { type: String },
|
|
16
|
-
max: { type: String },
|
|
17
|
-
step: { type: Number},
|
|
18
|
-
showLegend: { type: Boolean }
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
constructor() {
|
|
23
|
-
super();
|
|
24
|
-
this._inputType = INPUT_TYPE_RANGE;
|
|
25
|
-
this.step = 0.1;
|
|
26
|
-
this.showLegend = false;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static get styles() {
|
|
30
|
-
return [
|
|
31
|
-
css`
|
|
32
|
-
input[type=range] {
|
|
33
|
-
-webkit-appearance: none;
|
|
34
|
-
margin: 0;
|
|
35
|
-
width: 100%;
|
|
36
|
-
background-color: var(--my-background-color);
|
|
37
|
-
padding: var(--squi-input-padding, .5rem);
|
|
38
|
-
height: var(--my-input-height);
|
|
39
|
-
box-sizing: border-box;
|
|
40
|
-
}
|
|
41
|
-
input[type=range]:focus {
|
|
42
|
-
outline: none;
|
|
43
|
-
}
|
|
44
|
-
input[type=range]::-webkit-slider-runnable-track {
|
|
45
|
-
width: 100%;
|
|
46
|
-
cursor: pointer;
|
|
47
|
-
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
|
|
48
|
-
background: linear-gradient(-90deg, rgba(var(--my-lighter-background-color), .8) 25%, rgba(var(--my-darker-background-color), 1));
|
|
49
|
-
border-radius: 3px;
|
|
50
|
-
border: 0px solid #000101;
|
|
51
|
-
}
|
|
52
|
-
input[type=range]::-webkit-slider-thumb {
|
|
53
|
-
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
|
|
54
|
-
border: 0px solid #000000;
|
|
55
|
-
height: 20px;
|
|
56
|
-
width: 39px;
|
|
57
|
-
border-radius: 3px;
|
|
58
|
-
background: var(--my-primary-color);
|
|
59
|
-
cursor: pointer;
|
|
60
|
-
-webkit-appearance: none;
|
|
61
|
-
margin-top: -3.6px;
|
|
62
|
-
}
|
|
63
|
-
input[type=range]:focus::-webkit-slider-runnable-track {
|
|
64
|
-
background: linear-gradient(-90deg, rgba(var(--my-lighter-background-color), .8) 25%, rgba(var(--my-darker-background-color), 1));
|
|
65
|
-
}
|
|
66
|
-
input[type=range]::-moz-range-track {
|
|
67
|
-
width: 100%;
|
|
68
|
-
height: 12.8px;
|
|
69
|
-
cursor: pointer;
|
|
70
|
-
animation: 0.2s;
|
|
71
|
-
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
|
|
72
|
-
background: linear-gradient(-90deg, rgba(var(--my-lighter-background-color), .8) 25%, rgba(var(--my-darker-background-color), 1));
|
|
73
|
-
border-radius: 3px;
|
|
74
|
-
border: 0px solid #000101;
|
|
75
|
-
}
|
|
76
|
-
input[type=range]::-moz-range-thumb {
|
|
77
|
-
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
|
|
78
|
-
border: 0px solid #000000;
|
|
79
|
-
height: 20px;
|
|
80
|
-
width: 39px;
|
|
81
|
-
border-radius: 3px;
|
|
82
|
-
background: var(--my-primary-color);
|
|
83
|
-
cursor: pointer;
|
|
84
|
-
}
|
|
85
|
-
input[type=range]::-ms-track {
|
|
86
|
-
width: 100%;
|
|
87
|
-
height: 12.8px;
|
|
88
|
-
cursor: pointer;
|
|
89
|
-
animation: 0.2s;
|
|
90
|
-
background: transparent;
|
|
91
|
-
border-color: transparent;
|
|
92
|
-
border-width: 39px 0;
|
|
93
|
-
color: transparent;
|
|
94
|
-
}
|
|
95
|
-
input[type=range]::-ms-fill-lower {
|
|
96
|
-
background: linear-gradient(-90deg, rgba(var(---my-lighter-background-color), .8) 25%, rgba(var(--my-darker-background-color), 1));
|
|
97
|
-
border: 0px solid #000101;
|
|
98
|
-
border-radius: 7px;
|
|
99
|
-
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
|
|
100
|
-
}
|
|
101
|
-
input[type=range]::-ms-fill-upper {
|
|
102
|
-
background: linear-gradient(-90deg, rgba(var(--my-lighter-background-color), .8) 25%, rgba(var(--my-darker-background-color), 1));
|
|
103
|
-
border: 0px solid #000101;
|
|
104
|
-
border-radius: 7px;
|
|
105
|
-
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
|
|
106
|
-
}
|
|
107
|
-
input[type=range]::-ms-thumb {
|
|
108
|
-
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
|
|
109
|
-
border: 0px solid #000000;
|
|
110
|
-
height: 20px;
|
|
111
|
-
width: 39px;
|
|
112
|
-
border-radius: 3px;
|
|
113
|
-
background: var(--my-primary-color);
|
|
114
|
-
cursor: pointer;
|
|
115
|
-
}
|
|
116
|
-
:host label.value {
|
|
117
|
-
flex: 0 1 10%;
|
|
118
|
-
}
|
|
119
|
-
input[type=range]:focus::-ms-fill-lower {
|
|
120
|
-
background: linear-gradient(-90deg, rgba(var(--my-lighter-background-color), .8) 25%, rgba(var(--my-darker-background-color), 1));
|
|
121
|
-
}
|
|
122
|
-
input[type=range]:focus::-ms-fill-upper {
|
|
123
|
-
background: linear-gradient(-90deg, rgba(var(--my-lighter-background-color), .8) 25%, rgba(var(--my-darker-background-color), 1));
|
|
124
|
-
}
|
|
125
|
-
.legend {
|
|
126
|
-
display: flex;
|
|
127
|
-
/*margin: 0 -1rem;*/
|
|
128
|
-
}
|
|
129
|
-
.legend label {
|
|
130
|
-
text-align: center;
|
|
131
|
-
position: relative;
|
|
132
|
-
}
|
|
133
|
-
.legend label::before {
|
|
134
|
-
background-color: rgb(var(--my-lighter-background-color));
|
|
135
|
-
content: "";
|
|
136
|
-
height: .5rem;
|
|
137
|
-
position: absolute;
|
|
138
|
-
left: 50%;
|
|
139
|
-
top: -.5rem;
|
|
140
|
-
width: 1px;
|
|
141
|
-
}
|
|
142
|
-
.range_legend_label--selected {
|
|
143
|
-
color: var(--my-primary-color);
|
|
144
|
-
}
|
|
145
|
-
/* TODO remove to specific */
|
|
146
|
-
.range_legend_label--selected::after{
|
|
147
|
-
content: '';
|
|
148
|
-
position: absolute;
|
|
149
|
-
left: 20%;
|
|
150
|
-
top: 100%;
|
|
151
|
-
width: 0;
|
|
152
|
-
height: 0;
|
|
153
|
-
border-left: 20px solid transparent;
|
|
154
|
-
border-right: 20px solid transparent;
|
|
155
|
-
border-bottom: 20px solid rgb(var(--my-lighter-background-color));
|
|
156
|
-
}
|
|
157
|
-
`
|
|
158
|
-
];
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
render() {
|
|
162
|
-
// TODO: step kann hier nicht übergeben werden, wird dann initial nicht immer richtig angezeigt (bei komma rundungen)???
|
|
163
|
-
return html`
|
|
164
|
-
<label for="${this.id}Input">${this.label} ${this.showLegend ? '' : html`- ${this.value}`}</label>
|
|
165
|
-
<input ?disabled=${this.disabled} type="range" name="${this.id}Name" @change="${this._onChange}"
|
|
166
|
-
.value="${this.value}" min="${this.min}" max="${this.max}"
|
|
167
|
-
step="${this.step}" id="${this.id}Input">
|
|
168
|
-
${this.showLegend ? this._addLegend() : ''}
|
|
169
|
-
`;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
firstUpdated() {
|
|
173
|
-
// Save input reference for performance
|
|
174
|
-
this._input = this.shadowRoot.querySelector('input');
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
_addLegend() {
|
|
178
|
-
const steps = this.max - this.min;
|
|
179
|
-
const labels = [];
|
|
180
|
-
for (let i = 0; i <= steps; i+=1) {
|
|
181
|
-
labels.push(html`<label class="${i + this.step === this.value * 1 ? 'range_legend_label--selected' : ''}">${i + this.step}</label>`);
|
|
182
|
-
}
|
|
183
|
-
return html`<div class="legend">${labels}</div>`
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
_onChange() {
|
|
187
|
-
this.value = this._input.value;
|
|
188
|
-
this.dispatchEvent(new CustomEvent('changed', {
|
|
189
|
-
detail: {
|
|
190
|
-
value: this._input.value
|
|
191
|
-
},
|
|
192
|
-
composed: true,
|
|
193
|
-
bubbles: true
|
|
194
|
-
}));
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// Do not modify this file by hand!
|
|
3
|
-
// Re-generate this file by running lit-localize
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/* eslint-disable no-irregular-whitespace */
|
|
9
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
10
|
-
|
|
11
|
-
export const templates = {
|
|
12
|
-
's369cb9ac30f626a2': `* Verplichte in te vullen`,
|
|
13
|
-
's441bc7f34cdb5af3': `Vul dit veld in`,
|
|
14
|
-
's570d46ddb2a278ce': `Ongeldig VAT, gebruik BE0123456789`,
|
|
15
|
-
's5b7e33463603827f': `Ongeldig telefoonnummer, gebruik +32 494 667085`,
|
|
16
|
-
's82000595de0f83d0': `Ongeldig e-mailadres, gebruik mail@test.be`,
|
|
17
|
-
's8716290d3f8456dd': `Alleen nummers toegestaan`,
|
|
18
|
-
};
|
|
19
|
-
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// Do not modify this file by hand!
|
|
3
|
-
// Re-generate this file by running lit-localize
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/* eslint-disable no-irregular-whitespace */
|
|
9
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
10
|
-
|
|
11
|
-
export const templates = {
|
|
12
|
-
's369cb9ac30f626a2': `* Pflichtfeld`,
|
|
13
|
-
's441bc7f34cdb5af3': `Eingabe erforderlich`,
|
|
14
|
-
's82000595de0f83d0': `Format mail@test.de verwenden`,
|
|
15
|
-
's5b7e33463603827f': `Format +49123 123456 verwenden`,
|
|
16
|
-
's570d46ddb2a278ce': `Format DE0123456789 verwenden`,
|
|
17
|
-
's8716290d3f8456dd': `Nur Zahlen erlaubt`,
|
|
18
|
-
};
|
|
19
|
-
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Do not modify this file by hand!
|
|
2
|
-
// Re-generate this file by running lit-localize.
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The locale code that templates in this source code are written in.
|
|
6
|
-
*/
|
|
7
|
-
export const sourceLocale = `de`;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* The other locale codes that this application is localized into. Sorted
|
|
11
|
-
* lexicographically.
|
|
12
|
-
*/
|
|
13
|
-
export const targetLocales = [
|
|
14
|
-
`be`,
|
|
15
|
-
`en`,
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* All valid project locale codes. Sorted lexicographically.
|
|
20
|
-
*/
|
|
21
|
-
export const allLocales = [
|
|
22
|
-
`be`,
|
|
23
|
-
`de`,
|
|
24
|
-
`en`,
|
|
25
|
-
];
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
|
|
3
|
-
import '../../pd-button.js';
|
|
4
|
-
import '../../pd-checkbox.js';
|
|
5
|
-
import '../../pd-input.js';
|
|
6
|
-
import '../../pd-input-area.js';
|
|
7
|
-
import '../../pd-radio-group.js';
|
|
8
|
-
import '../../pd-select.js';
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
title: 'PDForms/Form Examples',
|
|
12
|
-
component: 'pd-forms',
|
|
13
|
-
argTypes: {
|
|
14
|
-
gradient: { control: 'boolean' },
|
|
15
|
-
primaryColor: { control: 'color' },
|
|
16
|
-
secondaryColor: { control: 'color' },
|
|
17
|
-
thirdColor: { control: 'color' },
|
|
18
|
-
textColor: { control: 'color' },
|
|
19
|
-
highlightColor: { control: 'color' },
|
|
20
|
-
errorColor: { control: 'color' },
|
|
21
|
-
errorBackgroundColor: { control: 'color' },
|
|
22
|
-
borderRadius: { control: 'text' },
|
|
23
|
-
displayFont: { control: 'text' },
|
|
24
|
-
fontSize: { control: 'text' },
|
|
25
|
-
inputHeigth: { control: 'text' },
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
function Template({
|
|
30
|
-
selectVals,
|
|
31
|
-
gradient,
|
|
32
|
-
primaryColor,
|
|
33
|
-
secondaryColor,
|
|
34
|
-
thirdColor,
|
|
35
|
-
textColor,
|
|
36
|
-
highlightColor,
|
|
37
|
-
errorColor,
|
|
38
|
-
errorBackgroundColor,
|
|
39
|
-
borderRadius,
|
|
40
|
-
displayFont,
|
|
41
|
-
fontSize,
|
|
42
|
-
inputHeigth,
|
|
43
|
-
}) {
|
|
44
|
-
|
|
45
|
-
let style = '';
|
|
46
|
-
if (primaryColor) {
|
|
47
|
-
style += `--squi-primary-color:${primaryColor};`;
|
|
48
|
-
}
|
|
49
|
-
if (secondaryColor) {
|
|
50
|
-
style += `--squi-secondary-color:${secondaryColor};`;
|
|
51
|
-
}
|
|
52
|
-
if (thirdColor) {
|
|
53
|
-
style += `--squi-third-color:${thirdColor};`;
|
|
54
|
-
}
|
|
55
|
-
if (textColor) {
|
|
56
|
-
style += `--squi-text-color:${textColor};`;
|
|
57
|
-
}
|
|
58
|
-
if (highlightColor) {
|
|
59
|
-
style += `--squi-highlight-color:${highlightColor};`;
|
|
60
|
-
}
|
|
61
|
-
if (errorColor) {
|
|
62
|
-
style += `--squi-error-color:${errorColor};`;
|
|
63
|
-
}
|
|
64
|
-
if (errorBackgroundColor) {
|
|
65
|
-
style += `--squi-error-background-color:${errorBackgroundColor};`;
|
|
66
|
-
}
|
|
67
|
-
if (borderRadius) {
|
|
68
|
-
style += `--squi-border-radius:${borderRadius};`;
|
|
69
|
-
}
|
|
70
|
-
if (displayFont) {
|
|
71
|
-
style += `--squi-display-font:${displayFont};`;
|
|
72
|
-
}
|
|
73
|
-
if (fontSize) {
|
|
74
|
-
style += `--squi-font-size:${fontSize};`;
|
|
75
|
-
}
|
|
76
|
-
if (inputHeigth) {
|
|
77
|
-
style += `--pd-input-field-height:${inputHeigth};`;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return html`
|
|
81
|
-
<h3>Defaults Inputs with labels</h3>
|
|
82
|
-
<div
|
|
83
|
-
style="display: flex; justify-content: space-between; max-width: 800px"
|
|
84
|
-
>
|
|
85
|
-
<pd-select
|
|
86
|
-
id="testId1"
|
|
87
|
-
?gradient="${gradient}"
|
|
88
|
-
label="Select Label"
|
|
89
|
-
></pd-select>
|
|
90
|
-
<pd-input
|
|
91
|
-
id="testId1"
|
|
92
|
-
?gradient="${gradient}"
|
|
93
|
-
label="Input Label"
|
|
94
|
-
></pd-input>
|
|
95
|
-
<pd-input-area
|
|
96
|
-
id="testId2"
|
|
97
|
-
?gradient="${gradient}"
|
|
98
|
-
label="Input Area Label"
|
|
99
|
-
></pd-input-area>
|
|
100
|
-
</div>
|
|
101
|
-
|
|
102
|
-
<div
|
|
103
|
-
style="display: flex; justify-content: space-between; max-width: 800px"
|
|
104
|
-
>
|
|
105
|
-
<pd-select
|
|
106
|
-
id="testId1"
|
|
107
|
-
?gradient="${gradient}"
|
|
108
|
-
.values="${selectVals}"
|
|
109
|
-
label="Select Label"
|
|
110
|
-
></pd-select>
|
|
111
|
-
<pd-input
|
|
112
|
-
id="testId1"
|
|
113
|
-
?gradient="${gradient}"
|
|
114
|
-
label="Input Label"
|
|
115
|
-
value="My Value"
|
|
116
|
-
></pd-input>
|
|
117
|
-
<pd-input-area
|
|
118
|
-
id="testId2"
|
|
119
|
-
?gradient="${gradient}"
|
|
120
|
-
label="Input Area Label"
|
|
121
|
-
value="My Value Area Text and ..."
|
|
122
|
-
></pd-input-area>
|
|
123
|
-
</div>
|
|
124
|
-
|
|
125
|
-
<div
|
|
126
|
-
style="display: flex; justify-content: space-between; max-width: 800px"
|
|
127
|
-
>
|
|
128
|
-
<pd-select
|
|
129
|
-
id="testId1"
|
|
130
|
-
.values="${selectVals}"
|
|
131
|
-
?gradient="${gradient}"
|
|
132
|
-
label="Select Label"
|
|
133
|
-
></pd-select>
|
|
134
|
-
<pd-input
|
|
135
|
-
id="testId1"
|
|
136
|
-
?gradient="${gradient}"
|
|
137
|
-
label="Input Label"
|
|
138
|
-
value="My Value"
|
|
139
|
-
></pd-input>
|
|
140
|
-
<pd-input-area
|
|
141
|
-
id="testId2"
|
|
142
|
-
?gradient="${gradient}"
|
|
143
|
-
label="Input Area Label"
|
|
144
|
-
value="My Value Area Text and ..."
|
|
145
|
-
></pd-input-area>
|
|
146
|
-
</div>
|
|
147
|
-
|
|
148
|
-
<div
|
|
149
|
-
style="display: flex; justify-content: space-between; max-width: 800px"
|
|
150
|
-
>
|
|
151
|
-
<pd-select
|
|
152
|
-
id="testId1"
|
|
153
|
-
.values="${selectVals}"
|
|
154
|
-
?gradient="${gradient}"
|
|
155
|
-
?disabled="${true}"
|
|
156
|
-
label="Select Label"
|
|
157
|
-
></pd-select>
|
|
158
|
-
<pd-input
|
|
159
|
-
id="testId1"
|
|
160
|
-
?gradient="${gradient}"
|
|
161
|
-
label="Input Label"
|
|
162
|
-
?disabled="${true}"
|
|
163
|
-
value="My Value"
|
|
164
|
-
></pd-input>
|
|
165
|
-
<pd-input-area
|
|
166
|
-
id="testId2"
|
|
167
|
-
?gradient="${gradient}"
|
|
168
|
-
label="Input Area Label"
|
|
169
|
-
?disabled="${true}"
|
|
170
|
-
value="My Value Area Text and ..."
|
|
171
|
-
></pd-input-area>
|
|
172
|
-
</div>
|
|
173
|
-
|
|
174
|
-
<div
|
|
175
|
-
style="display: flex; justify-content: space-between; max-width: 800px"
|
|
176
|
-
>
|
|
177
|
-
<pd-select
|
|
178
|
-
id="testId1"
|
|
179
|
-
.values="${selectVals}"
|
|
180
|
-
?gradient="${gradient}"
|
|
181
|
-
?disabled="${true}"
|
|
182
|
-
label="Select ohne Placeholder"
|
|
183
|
-
></pd-select>
|
|
184
|
-
<pd-input
|
|
185
|
-
id="testId1"
|
|
186
|
-
?gradient="${gradient}"
|
|
187
|
-
label="Input Label"
|
|
188
|
-
placeHolder="Placeholder Text"
|
|
189
|
-
></pd-input>
|
|
190
|
-
<pd-input-area
|
|
191
|
-
id="testId2"
|
|
192
|
-
?gradient="${gradient}"
|
|
193
|
-
label="Input Area Label"
|
|
194
|
-
placeHolder="Placeholder Text"
|
|
195
|
-
></pd-input-area>
|
|
196
|
-
</div>
|
|
197
|
-
|
|
198
|
-
<h3>Radio & Switch</h3>
|
|
199
|
-
<div
|
|
200
|
-
style="display: flex; justify-content: space-between; max-width: 1000px"
|
|
201
|
-
>
|
|
202
|
-
<pd-checkbox name="Test1" value="true"
|
|
203
|
-
>Label zur Checkbox</pd-checkbox
|
|
204
|
-
>
|
|
205
|
-
<pd-checkbox name="Test2" value="false"
|
|
206
|
-
>Label zur Checkbox</pd-checkbox
|
|
207
|
-
>
|
|
208
|
-
<pd-checkbox name="Test1" isSwitch value="true"
|
|
209
|
-
>Label zur Checkbox</pd-checkbox
|
|
210
|
-
>
|
|
211
|
-
<pd-checkbox name="Test2" isSwitch value="false"
|
|
212
|
-
>Label zur Checkbox</pd-checkbox
|
|
213
|
-
>
|
|
214
|
-
</div>
|
|
215
|
-
|
|
216
|
-
<h3>Radio Group</h3>
|
|
217
|
-
<pd-radio-group>
|
|
218
|
-
<pd-checkbox name="Test1" value="true"
|
|
219
|
-
>Label zur Checkbox</pd-checkbox
|
|
220
|
-
>
|
|
221
|
-
<pd-checkbox name="Test2" value="false"
|
|
222
|
-
>Label zur Checkbox</pd-checkbox
|
|
223
|
-
>
|
|
224
|
-
</pd-radio-group>
|
|
225
|
-
<pd-radio-group style="--group-direction: column;">
|
|
226
|
-
<pd-checkbox name="Test3" value="true"
|
|
227
|
-
>Label zur Checkbox</pd-checkbox
|
|
228
|
-
>
|
|
229
|
-
<pd-checkbox name="Test4" value="false"
|
|
230
|
-
>Label zur Checkbox</pd-checkbox
|
|
231
|
-
>
|
|
232
|
-
</pd-radio-group>
|
|
233
|
-
|
|
234
|
-
<h3>Buttons</h3>
|
|
235
|
-
<pd-button
|
|
236
|
-
?gradient="${gradient}"
|
|
237
|
-
text="Primary Button"
|
|
238
|
-
?primary="${true}"
|
|
239
|
-
></pd-button>
|
|
240
|
-
<pd-button
|
|
241
|
-
?gradient="${gradient}"
|
|
242
|
-
text="Secondary Button"
|
|
243
|
-
></pd-button>
|
|
244
|
-
<pd-button
|
|
245
|
-
?gradient="${gradient}"
|
|
246
|
-
?disabled="${true}"
|
|
247
|
-
text="Disabled Button"
|
|
248
|
-
></pd-button>
|
|
249
|
-
<pd-button
|
|
250
|
-
?gradient="${gradient}"
|
|
251
|
-
text="Primary Disabled"
|
|
252
|
-
?disabled="${true}"
|
|
253
|
-
?primary="${true}"
|
|
254
|
-
></pd-button>
|
|
255
|
-
|
|
256
|
-
`;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
export const FormExamples = Template.bind({});
|
|
260
|
-
FormExamples.args = {
|
|
261
|
-
selectVals: [
|
|
262
|
-
{ name: 'Option 1', value: 1 },
|
|
263
|
-
{ name: 'Option 2', value: 2 },
|
|
264
|
-
{ name: 'Option 3', value: 3 },
|
|
265
|
-
],
|
|
266
|
-
gradient: false,
|
|
267
|
-
};
|
|
268
|
-
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import '../../pd-button.js';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'PdForms/Button',
|
|
6
|
-
component: 'pd-button',
|
|
7
|
-
argTypes: {},
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
function ButtonTemplate() {
|
|
11
|
-
return html` <pd-button text="My Button"></pd-button> `;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const Button = ButtonTemplate.bind({});
|
|
15
|
-
Button.args = {};
|