@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.
- 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 +41 -34
- package/src/PdFormRow.js +19 -16
- package/src/PdInput.js +41 -137
- package/src/PdInputArea.js +37 -134
- package/src/PdRadioGroup.js +32 -65
- package/src/PdRange.js +0 -2
- package/src/PdSelect.js +36 -190
- 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
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Webcomponent pd-forms following open-wc recommendations",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"author": "PD Progressive Development",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.61",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"module": "index.js",
|
|
9
9
|
"scripts": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@lit-labs/motion": "^1.0.2",
|
|
23
23
|
"@lit/localize": "^0.11.2",
|
|
24
|
-
"@progressive-development/pd-icon": "^0.
|
|
24
|
+
"@progressive-development/pd-icon": "^0.1.5",
|
|
25
25
|
"lit": "^2.2.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Abstract base lit class for pd-input elements.
|
|
6
|
+
*
|
|
7
|
+
* Used from:
|
|
8
|
+
* - pd-input
|
|
9
|
+
* - pd-input-area
|
|
10
|
+
* - pd-select
|
|
11
|
+
*
|
|
12
|
+
* Used to:
|
|
13
|
+
* - define element specific css
|
|
14
|
+
* - handle auto completion
|
|
15
|
+
*
|
|
16
|
+
* Events:
|
|
17
|
+
* - TODO
|
|
18
|
+
*
|
|
19
|
+
* Custom Properties (shared-input-field-styles):
|
|
20
|
+
* ... TODO
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
import {
|
|
24
|
+
PdBaseUIInput,
|
|
25
|
+
INPUT_TYPE_AREA,
|
|
26
|
+
INPUT_TYPE_SELECT,
|
|
27
|
+
INPUT_TYPE_TEXT,
|
|
28
|
+
} from './PdBaseUiInput.js';
|
|
29
|
+
|
|
30
|
+
import { SharedInputFieldStyles } from './shared-input-field-styles.js';
|
|
31
|
+
|
|
32
|
+
export class PdBaseInputElement extends PdBaseUIInput {
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Fire when the `pd-input` loses focus.
|
|
36
|
+
* @event focus-lost
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
static get styles() {
|
|
40
|
+
return [PdBaseUIInput.styles, SharedInputFieldStyles];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static get properties() {
|
|
44
|
+
return {
|
|
45
|
+
placeHolder: { type: String },
|
|
46
|
+
/* not used at the moment */
|
|
47
|
+
name: { type: String },
|
|
48
|
+
autoCompleteName: { type: String },
|
|
49
|
+
_input: { type: Object, state: true }, // reference for input html element
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
constructor() {
|
|
54
|
+
super();
|
|
55
|
+
this.placeHolder = '';
|
|
56
|
+
this.name = '';
|
|
57
|
+
this._input = {};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
firstUpdated() {
|
|
61
|
+
// Save input reference for performance (bind html element to class property)
|
|
62
|
+
this._input = this.shadowRoot.querySelector(this._getElementName());
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
_onBlur() {
|
|
66
|
+
this.dispatchEvent(
|
|
67
|
+
new CustomEvent('focus-lost', {
|
|
68
|
+
detail: {
|
|
69
|
+
value: this._input.value,
|
|
70
|
+
},
|
|
71
|
+
composed: true,
|
|
72
|
+
bubbles: true,
|
|
73
|
+
})
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
_onKeyUp(event) {
|
|
78
|
+
// set changed value and generate events (key-pressed, enter-pressed, validateForm)
|
|
79
|
+
// if neccessary
|
|
80
|
+
this._handleChangedValue(this._input.value, event, true);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
_getElementName() {
|
|
84
|
+
switch (this._inputType) {
|
|
85
|
+
case INPUT_TYPE_AREA:
|
|
86
|
+
return 'textarea';
|
|
87
|
+
case INPUT_TYPE_SELECT:
|
|
88
|
+
return 'select';
|
|
89
|
+
case INPUT_TYPE_TEXT:
|
|
90
|
+
return 'input';
|
|
91
|
+
default:
|
|
92
|
+
return '';
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
package/src/PdBaseUi.js
CHANGED
|
@@ -1,16 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Abstract base lit class for all pd-form elements.
|
|
6
|
+
* Import shared-global-style to make common custom properties available to all components.
|
|
7
|
+
*
|
|
8
|
+
* Used from:
|
|
9
|
+
* - pd-base-ui-input
|
|
10
|
+
*
|
|
11
|
+
* Used to:
|
|
12
|
+
* - define css (import shared-global-styles.js)
|
|
13
|
+
* - define common properties (detailieren, aktuell keine)
|
|
14
|
+
* - define updateWhenLocaleChanges for all pd-elements (check, aktuell nur für pd-form-container benötigt)
|
|
15
|
+
*
|
|
16
|
+
* Custom Properties (shared-global-styles):
|
|
17
|
+
* ... TODO
|
|
4
18
|
*/
|
|
5
|
-
|
|
19
|
+
|
|
6
20
|
import { LitElement } from 'lit';
|
|
7
21
|
import { updateWhenLocaleChanges } from '@lit/localize';
|
|
8
22
|
|
|
23
|
+
import { SharedGlobalStyles } from './shared-global-styles.js';
|
|
24
|
+
|
|
9
25
|
export class PdBaseUI extends LitElement {
|
|
10
26
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
updateWhenLocaleChanges(this);
|
|
27
|
+
static get styles() {
|
|
28
|
+
return [SharedGlobalStyles];
|
|
14
29
|
}
|
|
15
30
|
|
|
31
|
+
constructor() {
|
|
32
|
+
super();
|
|
33
|
+
updateWhenLocaleChanges(this);
|
|
34
|
+
}
|
|
16
35
|
}
|
package/src/PdBaseUiInput.js
CHANGED
|
@@ -1,18 +1,83 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Abstract base lit class for pd-input elements.
|
|
6
|
+
*
|
|
7
|
+
* Used from:
|
|
8
|
+
* - pd-checkbox
|
|
9
|
+
* - pd-input
|
|
10
|
+
* - pd-input-area
|
|
11
|
+
* - pd-radio-group
|
|
12
|
+
* - pd-range
|
|
13
|
+
* - pd-select
|
|
14
|
+
*
|
|
15
|
+
* Used to:
|
|
16
|
+
* - define css (import additional shared-input-styles.js)
|
|
17
|
+
* - define common properties (detailieren, aktuell zu viele bzw. nicht für alle sub-elemente gültig)
|
|
18
|
+
* - handle error msg (getter/setter)
|
|
19
|
+
* - helpers for validation event after change and render label/error elements.
|
|
20
|
+
*
|
|
21
|
+
* Events:
|
|
22
|
+
* - validate-form => fired when input element changed its value.
|
|
23
|
+
* - enter-pressed => fired when enter pressed.
|
|
24
|
+
* - field-change => fired when input element changed its value.
|
|
25
|
+
*
|
|
26
|
+
* Custom Properties (shared-input-styles):
|
|
27
|
+
* ... TODO
|
|
28
|
+
*
|
|
4
29
|
*/
|
|
5
|
-
|
|
30
|
+
import { html } from 'lit';
|
|
6
31
|
import { PdBaseUI } from './PdBaseUi.js';
|
|
7
32
|
|
|
33
|
+
import { SharedInputStyles } from './shared-input-styles.js';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Available input types.
|
|
37
|
+
* Each input elemt set it's own type during constructor call.
|
|
38
|
+
*
|
|
39
|
+
* Comment: Not really needed/used at the moment.
|
|
40
|
+
*/
|
|
8
41
|
export const INPUT_TYPE_TEXT = 1;
|
|
9
42
|
export const INPUT_TYPE_SELECT = 2;
|
|
10
43
|
export const INPUT_TYPE_CHECK = 3;
|
|
11
44
|
export const INPUT_TYPE_RANGE = 4;
|
|
12
45
|
export const INPUT_TYPE_AREA = 5;
|
|
46
|
+
export const INPUT_TYPE_CHECK_GROUP = 6;
|
|
13
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Specific key codes for input events.
|
|
50
|
+
*/
|
|
51
|
+
const KEY_RETURN = 13;
|
|
52
|
+
|
|
53
|
+
// timer is used to delay validation event on user typing
|
|
54
|
+
let delayTimer = 0;
|
|
55
|
+
const DELAY_WAIT_TIME_MS = 400;
|
|
56
|
+
|
|
14
57
|
export class PdBaseUIInput extends PdBaseUI {
|
|
15
|
-
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Fired when an input element change its values.
|
|
61
|
+
* @event validate-form
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Fired when enter was pressend during focus on input element.
|
|
66
|
+
* @event enter-pressed
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Fired when field-value changed.
|
|
71
|
+
* @event field-change
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
static get styles() {
|
|
75
|
+
return [
|
|
76
|
+
PdBaseUI.styles,
|
|
77
|
+
SharedInputStyles
|
|
78
|
+
];
|
|
79
|
+
}
|
|
80
|
+
|
|
16
81
|
static get properties() {
|
|
17
82
|
return {
|
|
18
83
|
gradient: { type: Boolean }, // true for gradient background
|
|
@@ -26,8 +91,9 @@
|
|
|
26
91
|
label: { type: String }, // label text for input
|
|
27
92
|
value: {type: String}, // current value (set from outside) TODO: Typ (Object, Number, Txt, Bool...)
|
|
28
93
|
_errorMsg: {type: String, state: true}, // errorMsg (could set fronm outside for busines validation, internal validation=> todo)
|
|
29
|
-
_inputType: {type: Number}, // number value for type (text, select, range....), set constructor of sub-class
|
|
30
|
-
|
|
94
|
+
_inputType: {type: Number, state: true}, // number value for type (text, select, range....), set constructor of sub-class
|
|
95
|
+
// TODO: Nur für input, input-area, select im moment => weiter nach unten
|
|
96
|
+
_input: { type: Object, state: true } // reference for input html element
|
|
31
97
|
};
|
|
32
98
|
}
|
|
33
99
|
|
|
@@ -41,7 +107,6 @@
|
|
|
41
107
|
this.value = '';
|
|
42
108
|
this._errorMsg = '';
|
|
43
109
|
this._inputType = -1;
|
|
44
|
-
this._input = {};
|
|
45
110
|
this.valueName = '';
|
|
46
111
|
|
|
47
112
|
this.defaultRequiredChar = '*';
|
|
@@ -79,5 +144,71 @@
|
|
|
79
144
|
console.info("Meine Werte nach Set: ", this._value, this._input.value, newValue);
|
|
80
145
|
}
|
|
81
146
|
*/
|
|
147
|
+
|
|
148
|
+
_generateValidateEvent () {
|
|
149
|
+
this.dispatchEvent(
|
|
150
|
+
new CustomEvent('validate-form', {
|
|
151
|
+
detail: {
|
|
152
|
+
singleElement: this,
|
|
153
|
+
errorMap: new Map()
|
|
154
|
+
},
|
|
155
|
+
composed: true,
|
|
156
|
+
bubbles: true,
|
|
157
|
+
})
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
_handleChangedValue(newValue, event, checkReturn) {
|
|
162
|
+
const changed = this.value !== newValue;
|
|
163
|
+
|
|
164
|
+
this.value = newValue;
|
|
165
|
+
const keyCode = event.keyCode ? Number(event.keyCode) : -1;
|
|
166
|
+
const eventDetail = {
|
|
167
|
+
value: newValue,
|
|
168
|
+
name: this.valueName,
|
|
169
|
+
keyCode, changed
|
|
170
|
+
}
|
|
171
|
+
const handleReturn = checkReturn && keyCode === KEY_RETURN;
|
|
172
|
+
if (handleReturn) {
|
|
173
|
+
this.dispatchEvent(
|
|
174
|
+
new CustomEvent('enter-pressed', {
|
|
175
|
+
detail: eventDetail,
|
|
176
|
+
composed: true,
|
|
177
|
+
bubbles: true,
|
|
178
|
+
})
|
|
179
|
+
);
|
|
180
|
+
event.preventDefault();
|
|
181
|
+
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (changed) {
|
|
185
|
+
// generate changed event
|
|
186
|
+
this.dispatchEvent(
|
|
187
|
+
new CustomEvent('field-change', {
|
|
188
|
+
detail: eventDetail,
|
|
189
|
+
composed: true,
|
|
190
|
+
bubbles: true,
|
|
191
|
+
})
|
|
192
|
+
);
|
|
193
|
+
// generate validation event after delay
|
|
194
|
+
clearTimeout(delayTimer);
|
|
195
|
+
delayTimer = setTimeout(this._generateValidateEvent.bind(this),
|
|
196
|
+
DELAY_WAIT_TIME_MS);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
_renderErrorMsg() {
|
|
201
|
+
return this.errorMsg && this.errorMsg.length > 0 ? html`
|
|
202
|
+
<div class="error-box error">
|
|
203
|
+
<p class="error-msg">${this.errorMsg}</p>
|
|
204
|
+
</div>
|
|
205
|
+
` : '';
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
_renderLabel(forParam) {
|
|
209
|
+
return html`
|
|
210
|
+
<label for="${forParam}">${this.label}${this.required && this.label ? this.defaultRequiredChar : ''}</label>
|
|
211
|
+
`;
|
|
212
|
+
}
|
|
213
|
+
|
|
82
214
|
}
|
|
83
|
-
|
package/src/PdButton.js
CHANGED
|
@@ -1,115 +1,113 @@
|
|
|
1
|
+
/* eslint-disable lit-a11y/anchor-is-valid */
|
|
1
2
|
/**
|
|
2
3
|
* @license
|
|
3
4
|
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
|
-
import { html, css
|
|
7
|
+
import { html, css } from 'lit';
|
|
8
|
+
import { PdBaseUI } from './PdBaseUi.js';
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
export class PdButton extends PdBaseUI {
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
/**
|
|
13
|
+
* @event button-clicked
|
|
14
|
+
*/
|
|
11
15
|
|
|
12
16
|
static get styles() {
|
|
13
|
-
return [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
css`
|
|
17
|
-
|
|
17
|
+
return [
|
|
18
|
+
PdBaseUI.styles,
|
|
19
|
+
css`
|
|
18
20
|
:host {
|
|
21
|
+
/*
|
|
19
22
|
--my-primary-color: var(--squi-primary-color, #177E89);
|
|
20
23
|
--my-button-background-color: var(--squi-button-background-color, #ffc857);
|
|
21
24
|
--my-button-background-hover-color: var(--squi-button-background-color, #ffb724);
|
|
22
25
|
--my-button-text-color: var(--squi-button-text-color, #084c61);
|
|
23
26
|
--my-button-font-family: var(--squi-primary-font-family, Oswald);
|
|
24
27
|
|
|
25
|
-
--my-button-width: var(--
|
|
28
|
+
--my-button-width: var(--pd-input-field-width, 140px);
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
display: flex;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
|
|
34
|
+
width: var(--pd-button-width, 140px);
|
|
35
|
+
height: var(--pd-button-height, 2rem);
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
border-radius: var(--pd-border-radius, 1px);
|
|
39
|
+
|
|
40
|
+
background-color: var(--pd-button-bg-col, var(--pd-default-third-color));
|
|
41
|
+
color: var(--pd-button-font-col, var(--pd-default-bg-color));
|
|
42
|
+
|
|
43
|
+
font-family: var(--pd-default-font-title-family);
|
|
44
|
+
font-size: var(--pd-button-font-size, var(--pd-default-font-content-size));
|
|
45
|
+
font-weight: var(--pd-button-font-weight, normal);
|
|
46
|
+
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
|
|
49
|
+
box-shadow: -1px 1px 2px var(--pd-default-third-color);
|
|
50
|
+
|
|
51
|
+
margin: 0.5rem;
|
|
26
52
|
|
|
27
|
-
display: block;
|
|
28
53
|
/*
|
|
29
54
|
height: 100%;
|
|
30
55
|
width: 100%; => Ohne diese Angabe eht die % Angaben icht
|
|
31
56
|
*/
|
|
32
57
|
}
|
|
33
|
-
|
|
58
|
+
|
|
59
|
+
:host(:not([disabled]):hover) {
|
|
60
|
+
background-color: var(--pd-button-bg-col-hover, var(--pd-default-hover-color));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:host([primary]) {
|
|
64
|
+
background-color: var(--pd-button-primary-bg-col, var(--pd-default-color));
|
|
65
|
+
color: var(--pd-button-primary-font-col, var(--pd-default-bg-color));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:host([gradient]) {
|
|
69
|
+
background: linear-gradient(to right, var(--my-background-gradient-color, red) 0%, var(--my-background-color, blue) 100%);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:host([disabled]) {
|
|
73
|
+
cursor: auto;
|
|
74
|
+
border-color: var(--pd-default-disabled-color);
|
|
75
|
+
background-color: var(--pd-button-bg-col-disabled, var(--pd-default-disabled-color));
|
|
76
|
+
color: var(--pd-button-font-col-disabled, var(--pd-default-third-color));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
:host([disabled]:hover) {
|
|
80
|
+
box-shadow: -1px 1px 2px #1f2b2a;
|
|
81
|
+
}
|
|
82
|
+
|
|
34
83
|
/* Style for Button */
|
|
35
84
|
a {
|
|
36
85
|
display: inline-block;
|
|
37
86
|
text-decoration: none;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
text-align: center;
|
|
87
|
+
border: none;
|
|
88
|
+
white-space: nowrap;
|
|
89
|
+
margin: 0.5rem;
|
|
90
|
+
|
|
43
91
|
/*box-shadow: -2px 2px 4px #999;/* TODO: From var */
|
|
44
92
|
/*border-bottom: 1px solid var(--my-border-color);*/
|
|
45
|
-
|
|
46
|
-
background-color: var(--my-button-background-color);
|
|
47
|
-
border-radius: var(--my-border-radius);
|
|
48
|
-
border: none;
|
|
49
|
-
cursor: pointer;
|
|
50
93
|
/*will-change: transform; Dann über Menu bei Scroll...*/
|
|
51
|
-
|
|
52
|
-
|
|
94
|
+
|
|
95
|
+
/*
|
|
53
96
|
transition-property: box-shadow, background;
|
|
54
97
|
transition: .2s ease-in;
|
|
55
98
|
box-sizing: border-box;
|
|
56
|
-
|
|
99
|
+
*/
|
|
57
100
|
|
|
58
101
|
/*overflow: hidden;
|
|
59
102
|
text-overflow: ellipsis;*/
|
|
60
|
-
margin: 1rem auto;
|
|
61
|
-
|
|
62
103
|
|
|
63
104
|
/*padding: var(--squi-input-padding, .5rem);*/
|
|
64
|
-
|
|
65
|
-
width: var(--my-button-width);
|
|
66
|
-
height: var(--my-input-height);
|
|
67
|
-
|
|
68
105
|
}
|
|
69
106
|
|
|
70
107
|
a *{
|
|
71
|
-
pointer-events: none;
|
|
72
|
-
cursor: pointer;
|
|
108
|
+
pointer-events: none;
|
|
73
109
|
}
|
|
74
|
-
|
|
75
|
-
a[disabled] {
|
|
76
|
-
border-color: #5a5858;
|
|
77
|
-
color: var(--raw-game-color-light-lightest, #4b4848);
|
|
78
|
-
background-color: #d3d2d2;
|
|
79
|
-
text-shadow: 2px 2px 3px var(--raw-game-color-dark-darker, #999);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
a:not([disabled]):hover {
|
|
83
|
-
box-shadow: -1px 1px 2px #1f2b2a;
|
|
84
|
-
background: var(--my-button-background-hover-color);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
a.primary:not([disabled]):hover {
|
|
88
|
-
/* tbd: at the momment the same definition as without primary style */
|
|
89
|
-
box-shadow: -1px 1px 2px #1f2b2a;
|
|
90
|
-
background: var(--my-border-color-hover);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
a.primary {
|
|
94
|
-
background-color: var(--my-primary-color);
|
|
95
|
-
color: #fefefe; /* ToDo */
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
a.primary[disabled] {
|
|
99
|
-
background-color: #d3d2d2;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.b-gradient {
|
|
103
|
-
background: linear-gradient(to right, var(--my-background-gradient-color) 0%, var(--my-background-color) 100%);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.b-gradient.primary {
|
|
107
|
-
background: linear-gradient(to right, var(--my-primary-color) 0%, var(--my-background-color) 100%);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.b-gradient[disabled] {
|
|
111
|
-
background: linear-gradient(to right, lightgrey 0%, grey 100%);
|
|
112
|
-
}
|
|
110
|
+
|
|
113
111
|
|
|
114
112
|
/* button icon not integrated at the moment */
|
|
115
113
|
.button-icon {
|
|
@@ -183,10 +181,15 @@ export class PdButton extends LitElement {
|
|
|
183
181
|
}
|
|
184
182
|
|
|
185
183
|
render() {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
184
|
+
return html`
|
|
185
|
+
<div @onClick="${this._handleClick}">
|
|
186
|
+
<a ?disabled="${this.disabled}">${this.text}</a>
|
|
187
|
+
</div>`;
|
|
190
188
|
}
|
|
191
189
|
|
|
190
|
+
_handleClick() {
|
|
191
|
+
if (!this.disabled) {
|
|
192
|
+
this.dispatchEvent(new CustomEvent("button-clicked"));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
192
195
|
}
|