@progressive-development/pd-contact 0.5.0 → 0.5.1

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 (24) hide show
  1. package/dist/src/PdContact.js +6 -6
  2. package/package.json +7 -6
  3. package/dist/node_modules/@progressive-development/pd-forms/pd-checkbox.js +0 -2
  4. package/dist/node_modules/@progressive-development/pd-forms/pd-form-container.js +0 -2
  5. package/dist/node_modules/@progressive-development/pd-forms/pd-form-row.js +0 -2
  6. package/dist/node_modules/@progressive-development/pd-forms/pd-hover-box.js +0 -2
  7. package/dist/node_modules/@progressive-development/pd-forms/pd-input.js +0 -2
  8. package/dist/node_modules/@progressive-development/pd-forms/pd-radio-group.js +0 -2
  9. package/dist/node_modules/@progressive-development/pd-forms/src/PdBaseInputElement.js +0 -86
  10. package/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUi.js +0 -33
  11. package/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUiInput.js +0 -229
  12. package/dist/node_modules/@progressive-development/pd-forms/src/PdCheckbox.js +0 -230
  13. package/dist/node_modules/@progressive-development/pd-forms/src/PdFormContainer.js +0 -167
  14. package/dist/node_modules/@progressive-development/pd-forms/src/PdFormRow.js +0 -92
  15. package/dist/node_modules/@progressive-development/pd-forms/src/PdHoverBox.js +0 -108
  16. package/dist/node_modules/@progressive-development/pd-forms/src/PdInput.js +0 -79
  17. package/dist/node_modules/@progressive-development/pd-forms/src/PdRadioGroup.js +0 -72
  18. package/dist/node_modules/@progressive-development/pd-forms/src/shared-input-field-styles.js +0 -152
  19. package/dist/node_modules/@progressive-development/pd-forms/src/shared-input-styles.js +0 -64
  20. package/dist/node_modules/@progressive-development/pd-icon/pd-icon.js +0 -4
  21. package/dist/node_modules/@progressive-development/pd-icon/src/PdIcon.js +0 -595
  22. package/dist/node_modules/lit-html/directive.js +0 -27
  23. package/dist/node_modules/lit-html/directives/class-map.js +0 -36
  24. package/dist/node_modules/lit-html/lit-html.js +0 -242
@@ -1,12 +1,12 @@
1
1
  import { LitElement, css, html } from "lit";
2
2
  import { msg } from "@lit/localize";
3
3
  import { PDFontStyles } from "@progressive-development/pd-shared-styles";
4
- import "../node_modules/@progressive-development/pd-icon/pd-icon.js";
5
- import "../node_modules/@progressive-development/pd-forms/pd-checkbox.js";
6
- import "../node_modules/@progressive-development/pd-forms/pd-form-container.js";
7
- import "../node_modules/@progressive-development/pd-forms/pd-form-row.js";
8
- import "../node_modules/@progressive-development/pd-forms/pd-input.js";
9
- import "../node_modules/@progressive-development/pd-forms/pd-radio-group.js";
4
+ import "@progressive-development/pd-icon/pd-icon";
5
+ import "@progressive-development/pd-forms/pd-checkbox";
6
+ import "@progressive-development/pd-forms/pd-form-container";
7
+ import "@progressive-development/pd-forms/pd-form-row";
8
+ import "@progressive-development/pd-forms/pd-input";
9
+ import "@progressive-development/pd-forms/pd-radio-group";
10
10
  /**
11
11
  * @license
12
12
  * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@progressive-development/pd-contact",
3
- "description": "Progressive Development Contact component",
3
+ "description": "Progressive Development Contact component",
4
4
  "author": "PD Progressive Development",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
- "version": "0.5.0",
6
+ "version": "0.5.1",
7
7
  "main": "./dist/index.js",
8
8
  "module": "./dist/index.js",
9
9
  "exports": {
@@ -34,11 +34,11 @@
34
34
  "build-storybook": "storybook build"
35
35
  },
36
36
  "dependencies": {
37
- "@progressive-development/pd-forms": "^0.2.16",
38
- "@progressive-development/pd-icon": "^0.1.23",
37
+ "@lit/localize": "^0.11.4",
38
+ "@progressive-development/pd-forms": "^0.5.0",
39
+ "@progressive-development/pd-icon": "^0.5.0",
39
40
  "@progressive-development/pd-shared-styles": "^0.1.1",
40
- "lit": "^2.8.0",
41
- "@lit/localize": "^0.11.4"
41
+ "lit": "^2.8.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@custom-elements-manifest/analyzer": "^0.4.17",
@@ -54,6 +54,7 @@
54
54
  "husky": "^4.3.8",
55
55
  "lint-staged": "^10.5.4",
56
56
  "prettier": "^2.8.8",
57
+ "rollup-plugin-visualizer": "^5.13.1",
57
58
  "storybook": "^7.6.20",
58
59
  "vite": "^5.4.11",
59
60
  "vitest": "^2.1.8"
@@ -1,2 +0,0 @@
1
- import { PdCheckbox } from "./src/PdCheckbox.js";
2
- window.customElements.define("pd-checkbox", PdCheckbox);
@@ -1,2 +0,0 @@
1
- import { PdFormContainer } from "./src/PdFormContainer.js";
2
- window.customElements.define("pd-form-container", PdFormContainer);
@@ -1,2 +0,0 @@
1
- import { PdFormRow } from "./src/PdFormRow.js";
2
- window.customElements.define("pd-form-row", PdFormRow);
@@ -1,2 +0,0 @@
1
- import { PdHoverBox } from "./src/PdHoverBox.js";
2
- window.customElements.define("pd-hover-box", PdHoverBox);
@@ -1,2 +0,0 @@
1
- import { PdInput } from "./src/PdInput.js";
2
- window.customElements.define("pd-input", PdInput);
@@ -1,2 +0,0 @@
1
- import { PdRadioGroup } from "./src/PdRadioGroup.js";
2
- window.customElements.define("pd-radio-group", PdRadioGroup);
@@ -1,86 +0,0 @@
1
- import { PdBaseUIInput, INPUT_TYPE_DATE, INPUT_TYPE_TEXT, INPUT_TYPE_FILE, INPUT_TYPE_SELECT, INPUT_TYPE_AREA } from "./PdBaseUiInput.js";
2
- import { SharedInputFieldStyles } from "./shared-input-field-styles.js";
3
- /**
4
- * @license
5
- * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
6
- *
7
- * Abstract base lit class for pd-input elements.
8
- *
9
- * Used from:
10
- * - pd-input
11
- * - pd-input-area
12
- * - pd-select
13
- *
14
- * Used to:
15
- * - define element specific css
16
- * - handle auto completion
17
- *
18
- * Events:
19
- * - TODO
20
- *
21
- * Custom Properties (shared-input-field-styles):
22
- * ... TODO
23
- *
24
- */
25
- class PdBaseInputElement extends PdBaseUIInput {
26
- /**
27
- * Fire when the `pd-input` loses focus.
28
- * @event focus-lost
29
- */
30
- static get styles() {
31
- return [PdBaseUIInput.styles, SharedInputFieldStyles];
32
- }
33
- static get properties() {
34
- return {
35
- placeHolder: { type: String },
36
- /* not used at the moment */
37
- name: { type: String },
38
- autoCompleteName: { type: String }
39
- };
40
- }
41
- constructor() {
42
- super();
43
- this.placeHolder = "";
44
- this.name = "";
45
- this._input = {};
46
- }
47
- firstUpdated() {
48
- this._input = this.shadowRoot.querySelector(this._getElementName());
49
- }
50
- focus() {
51
- this._input.focus();
52
- }
53
- _onBlur(event) {
54
- this.dispatchEvent(
55
- new CustomEvent("focus-lost", {
56
- detail: {
57
- value: this._input.value
58
- },
59
- composed: true,
60
- bubbles: true
61
- })
62
- );
63
- this._handleChangedValue(this._input.value, event, true, true);
64
- }
65
- _onKeyUp(event) {
66
- this._handleChangedValue(this._input.value, event, true);
67
- }
68
- _getElementName() {
69
- switch (this._inputType) {
70
- case INPUT_TYPE_AREA:
71
- return "textarea";
72
- case INPUT_TYPE_SELECT:
73
- return "select";
74
- case INPUT_TYPE_FILE:
75
- case INPUT_TYPE_TEXT:
76
- return "input";
77
- case INPUT_TYPE_DATE:
78
- return "pd-input";
79
- default:
80
- return "";
81
- }
82
- }
83
- }
84
- export {
85
- PdBaseInputElement
86
- };
@@ -1,33 +0,0 @@
1
- import { LitElement } from "lit";
2
- import { updateWhenLocaleChanges } from "@lit/localize";
3
- import { PDColorStyles, PDFontStyles } from "@progressive-development/pd-shared-styles";
4
- /**
5
- * @license
6
- * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
7
- *
8
- * Abstract base lit class for all pd-form elements.
9
- * Import shared-global-style to make common custom properties available to all components.
10
- *
11
- * Used from:
12
- * - pd-base-ui-input
13
- *
14
- * Used to:
15
- * - define css (import shared-global-styles.js)
16
- * - define common properties (detailieren, aktuell keine)
17
- * - define updateWhenLocaleChanges for all pd-elements (check, aktuell nur für pd-form-container benötigt)
18
- *
19
- * Custom Properties (shared-global-styles):
20
- * ... TODO
21
- */
22
- class PdBaseUI extends LitElement {
23
- static get styles() {
24
- return [PDColorStyles, PDFontStyles];
25
- }
26
- constructor() {
27
- super();
28
- updateWhenLocaleChanges(this);
29
- }
30
- }
31
- export {
32
- PdBaseUI
33
- };
@@ -1,229 +0,0 @@
1
- import { css, html } from "lit";
2
- import "../../pd-icon/pd-icon.js";
3
- import { PdBaseUI } from "./PdBaseUi.js";
4
- import { SharedInputStyles } from "./shared-input-styles.js";
5
- import "../pd-hover-box.js";
6
- /**
7
- * @license
8
- * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
9
- *
10
- * Abstract base lit class for pd-input elements.
11
- *
12
- * Used from:
13
- * - pd-checkbox
14
- * - pd-input
15
- * - pd-input-area
16
- * - pd-radio-group
17
- * - pd-range
18
- * - pd-select
19
- *
20
- * Used to:
21
- * - define css (import additional shared-input-styles.js)
22
- * - define common properties (detailieren, aktuell zu viele bzw. nicht für alle sub-elemente gültig)
23
- * - handle error msg (getter/setter)
24
- * - helpers for validation event after change and render label/error elements.
25
- *
26
- * Events:
27
- * - validate-form => fired when input element changed its value.
28
- * - enter-pressed => fired when enter pressed.
29
- * - field-change => fired when input element changed its value.
30
- *
31
- * Custom Properties (shared-input-styles):
32
- * ... TODO
33
- *
34
- */
35
- const INPUT_TYPE_TEXT = 1;
36
- const INPUT_TYPE_SELECT = 2;
37
- const INPUT_TYPE_CHECK = 3;
38
- const INPUT_TYPE_RANGE = 4;
39
- const INPUT_TYPE_AREA = 5;
40
- const INPUT_TYPE_DATE = 7;
41
- const INPUT_TYPE_FILE = 8;
42
- const KEY_RETURN = 13;
43
- let delayTimer = 0;
44
- const DELAY_WAIT_TIME_MS = 400;
45
- class PdBaseUIInput extends PdBaseUI {
46
- /**
47
- * Fired when an input element change its values.
48
- * @event validate-form
49
- */
50
- /**
51
- * Fired when enter was pressend during focus on input element.
52
- * @event enter-pressed
53
- */
54
- /**
55
- * Fired when field-value changed.
56
- * @event field-change
57
- */
58
- static get styles() {
59
- return [
60
- PdBaseUI.styles,
61
- SharedInputStyles,
62
- css`
63
- .label-header {
64
- display: flex;
65
- align-items: end;
66
- justify-content: space-between;
67
- }
68
-
69
- .label-header pd-icon {
70
- --pd-icon-size: 1.25rem;
71
- --pd-icon-col-active: var(--pd-default-col);
72
- --pd-icon-col-active-hover: var(--pd-default-hover-col);
73
- --pd-icon-stroke-width: 0;
74
- padding-right: 5px;
75
- cursor: help;
76
- }
77
- `
78
- ];
79
- }
80
- static get properties() {
81
- return {
82
- gradient: { type: Boolean },
83
- // true for gradient background
84
- disabled: { type: Boolean },
85
- // disabled flag for element
86
- readonly: { type: Boolean },
87
- // readonly flag for element
88
- required: { type: Boolean },
89
- // required flag for element
90
- requiredMsg: { type: String },
91
- // specific error msg for required field
92
- helperTxt: { type: String },
93
- // helper text
94
- valueName: { type: String },
95
- defaultRequiredChar: { type: String },
96
- defaultValue: { type: String },
97
- // default value for input element (used for reset) TODO: Das hier ggf. automatisch mit erstem gesetzten Wert füllen?
98
- label: { type: String },
99
- // label text for input
100
- value: { type: String },
101
- // current value (set from outside) TODO: Typ (Object, Number, Txt, Bool...)
102
- _errorMsg: { type: String, state: true },
103
- // errorMsg (could set fronm outside for busines validation, internal validation=> todo)
104
- _inputType: { type: Number, state: true }
105
- // number value for type (text, select, range....), set constructor of sub-class
106
- };
107
- }
108
- constructor() {
109
- super();
110
- this.gradient = false;
111
- this.disabled = false;
112
- this.readonly = false;
113
- this.defaultValue = "";
114
- this.label = "";
115
- this.value = "";
116
- this._errorMsg = "";
117
- this._inputType = -1;
118
- this.valueName = "";
119
- this.defaultRequiredChar = "*";
120
- }
121
- // Test: Clear input with value => Dann in BasisKlasse und alle leiten von Basis UI Element ab
122
- clear() {
123
- this.value = "";
124
- }
125
- // Test: Reset input with value
126
- reset() {
127
- this.value = this.defaultValue || "";
128
- }
129
- get errorMsg() {
130
- return this._errorMsg;
131
- }
132
- set errorMsg(msg) {
133
- this._errorMsg = msg;
134
- }
135
- /*
136
- get value() {
137
- return this._value;
138
- }
139
-
140
- set value(newValue) {
141
- console.info("Meine Werte vor Set _value, input.value, newValue: ", this._value, this._input.value, newValue);
142
- this._value = newValue;
143
- this._input.value = newValue;
144
- console.info("Meine Werte nach Set: ", this._value, this._input.value, newValue);
145
- }
146
- */
147
- _generateValidateEvent() {
148
- this.dispatchEvent(
149
- new CustomEvent("validate-form", {
150
- detail: {
151
- singleElement: this,
152
- errorMap: /* @__PURE__ */ new Map()
153
- },
154
- composed: true,
155
- bubbles: true
156
- })
157
- );
158
- }
159
- _handleChangedValue(newValue, event, checkReturn, showValidateMsg) {
160
- const changed = this.value !== newValue;
161
- this.value = newValue;
162
- const keyCode = event.keyCode ? Number(event.keyCode) : -1;
163
- const eventDetail = {
164
- value: newValue,
165
- name: this.valueName,
166
- keyCode,
167
- changed
168
- };
169
- const handleReturn = checkReturn && keyCode === KEY_RETURN;
170
- if (handleReturn) {
171
- this.dispatchEvent(
172
- new CustomEvent("enter-pressed", {
173
- detail: eventDetail,
174
- composed: true,
175
- bubbles: true
176
- })
177
- );
178
- event.preventDefault();
179
- }
180
- if (changed) {
181
- this.dispatchEvent(
182
- new CustomEvent("field-change", {
183
- detail: eventDetail,
184
- composed: true,
185
- bubbles: true
186
- })
187
- );
188
- }
189
- if (showValidateMsg) {
190
- clearTimeout(delayTimer);
191
- delayTimer = setTimeout(
192
- this._generateValidateEvent.bind(this),
193
- DELAY_WAIT_TIME_MS
194
- );
195
- }
196
- }
197
- _renderErrorMsg() {
198
- return this.errorMsg && this.errorMsg.length > 0 ? html`
199
- <div class="error-box error">
200
- <p class="error-msg">${this.errorMsg}</p>
201
- </div>
202
- ` : "";
203
- }
204
- _renderLabel(forParam, additionalValue) {
205
- return html`
206
- <div class="label-header">
207
- <label for="${forParam}">${this.label}${this.required && this.label ? this.defaultRequiredChar : ""}${additionalValue ? html` - <b>${additionalValue}</b>` : ""}</label>
208
- ${this.helperTxt ? html`
209
-
210
- <pd-hover-box>
211
- <pd-icon slot="normal-view" icon="helpIcon" activeIcon></pd-icon>
212
- <p slot="info-view">${this.helperTxt}</p>
213
- </pd-hover-box>
214
-
215
- ` : ""}
216
- </div>
217
- `;
218
- }
219
- }
220
- export {
221
- INPUT_TYPE_AREA,
222
- INPUT_TYPE_CHECK,
223
- INPUT_TYPE_DATE,
224
- INPUT_TYPE_FILE,
225
- INPUT_TYPE_RANGE,
226
- INPUT_TYPE_SELECT,
227
- INPUT_TYPE_TEXT,
228
- PdBaseUIInput
229
- };
@@ -1,230 +0,0 @@
1
- import { css, html } from "lit";
2
- import { classMap as o } from "../../../lit-html/directives/class-map.js";
3
- import "../../pd-icon/pd-icon.js";
4
- import { PdBaseUIInput, INPUT_TYPE_CHECK } from "./PdBaseUiInput.js";
5
- /**
6
- * @license
7
- * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
8
- */
9
- class PdCheckbox extends PdBaseUIInput {
10
- static get properties() {
11
- return {
12
- isSwitch: { type: Boolean },
13
- _hasInner: { type: Boolean, state: true }
14
- };
15
- }
16
- constructor() {
17
- super();
18
- this._inputType = INPUT_TYPE_CHECK;
19
- }
20
- static get styles() {
21
- return [
22
- PdBaseUIInput.styles,
23
- css`
24
- :host {
25
- display: inline-block;
26
-
27
- /* Style for active checkbox => use defaults from pd-icon if no custom properties set */
28
- --pd-icon-col-active: var(--pd-cb-col);
29
- --pd-icon-col-active-hover: var(--pd-cb-col-hover);
30
- --pd-icon-bg-col-active: var(--pd-cb-bg-col);
31
- --pd-icon-stroke-col-active: var(--pd-cb-stroke-col);
32
- --pd-icon-stroke-col-active-hover: var(--pd-cb-stroke-col-hover);
33
-
34
- /* Style for inactive checkbox */
35
- --pd-icon-col: var(--pd-cb-unset-col);
36
- --pd-icon-col-hover: var(--pd-cb-unset-col-hover);
37
- --pd-icon-bg-col: var(--pd-cb-unset-bg-col);
38
- --pd-icon-stroke-col: var(--pd-cb-unset-stroke-col);
39
- --pd-icon-stroke-col-hover: var(--pd-cb-unset-stroke-col-hover);
40
- }
41
-
42
- /* Switch pd-icon => Prüfen, bei mir musste ich reflect setzten, wird das verwendet? */
43
- :host([isSwitch]) {
44
- /* derzeit keine Angaben */
45
- }
46
-
47
- .div-container {
48
- display: flex;
49
- align-items: center;
50
- cursor: pointer;
51
- }
52
-
53
- .div-container.disabled {
54
- opacity: 0.5;
55
- cursor: auto;
56
- }
57
-
58
- .div-container.readonly {
59
- cursor: auto;
60
- }
61
-
62
- /*
63
- * Class checkbox for icon and a element (checkbox case)
64
- */
65
- .checkbox {
66
- display: flex;
67
- border-radius: 4px;
68
- line-height: 0;
69
- align-items: center;
70
- justify-content: center;
71
- /*
72
- Wurde das hier für Border verwendet? Aktuell border in folgendem Element gesetzt
73
- background-color: var(--pd-cb-border-col, var(--pd-primary-col, #067394));
74
- */
75
-
76
- }
77
-
78
- .checkbox pd-icon {
79
- margin-right: .2rem;
80
- margin-bottom: .2rem;
81
- border: 2px solid var(--pd-cb-border-col, var(--pd-default-col));
82
- border-radius: var(--pd-cb-border-radius, 3px);
83
- }
84
-
85
- .label {
86
- margin-left: 0.1rem;
87
- color: var(--pd-cb-font-col, var(--pd-default-font-input-col));
88
- font-family: var(--pd-default-font-input-family);
89
- text-align: left;
90
- font-size: var(--pd-default-font-input-size);
91
- }
92
-
93
- .readonly .label {
94
- color: var(--pd-cb-font-col-readonly, #4d4d4d);
95
- }
96
-
97
- .readonly .checkbox pd-icon {
98
- border-color: var(--pd-cb-border-col-readonly, transparent);
99
- }
100
-
101
- /* Switch styles */
102
- .switch {
103
- height: var(--pd-cb-switch-height);
104
- position: relative;
105
- outline: 0;
106
- -webkit-user-select: none;
107
- -moz-user-select: none;
108
- -ms-user-select: none;
109
- user-select: none;
110
- }
111
-
112
- .switch .label {
113
- margin-left: 0.5rem;
114
- }
115
-
116
- .switch-paddle {
117
- display: inline-block;
118
- vertical-align: baseline;
119
- margin: 0;
120
- position: relative;
121
- min-width: 4rem;
122
- max-width: 4rem;
123
- height: 2rem;
124
- border-radius: 0;
125
- background: var(--pd-cb-switch-paddle-col, var(--pd-default-col));
126
- font-weight: inherit;
127
- color: inherit;
128
- cursor: pointer;
129
- }
130
-
131
- .switch-paddle pd-icon {
132
- position: absolute;
133
- top: 0;
134
- left: 0;
135
- display: block;
136
- width: 1.5rem;
137
- height: 1.5rem;
138
- -webkit-transform: translate3d(0, 0, 0);
139
- transform: translate3d(0, 0, 0);
140
- border: 2px solid var(--pd-cb-border-col, var(--pd-default-col));
141
- box-shadow: rgba(0, 0, 0, 0.15) 1.95px 1.95px 2.6px;
142
- border-radius: var(--pd-cb-border-radius, 4px);
143
- -webkit-transition: all 0.25s ease-out;
144
- transition: all 0.25s ease-out;
145
- content: '';
146
- }
147
-
148
- .disabled .switch-paddle {
149
- cursor: auto;
150
- }
151
-
152
- .readonly .switch-paddle {
153
- cursor: auto;
154
- max-width: 2rem;
155
- min-width: 2rem;
156
- background: none;
157
-
158
- /* Prüfen TODO
159
- --pd-icon-bg: transparent;
160
- --pd-icon-fill: var(--card-dark-red);
161
- --pd-icon-fill-hover: var(--pd-icon-fill);
162
- --pd-icon-fill-active: var(--card-medium-green);
163
- */
164
- }
165
-
166
- .readonly .switch-paddle pd-icon {
167
- border-color: var(--pd-cb-border-col-readonly, transparent);
168
- }
169
-
170
- .readonly .isChecked.switch-paddle pd-icon {
171
- transform: translate3d(0, 0, 0);
172
- left: 0rem;
173
- }
174
-
175
- .isChecked.switch-paddle pd-icon {
176
- left: 2.25rem;
177
- }
178
-
179
- @media (min-width: 580px) {
180
- :host {
181
- font-size: 1rem;
182
- }
183
- }
184
- `
185
- ];
186
- }
187
- render() {
188
- if (!this._hasInnerSet) {
189
- this._hasInnerSet = true;
190
- this._hasInner = !!this.innerHTML.trim().length;
191
- }
192
- const checked = this.value === "true";
193
- const classMapVal = { "disabled": this.disabled, "switch": this.isSwitch, "readonly": this.readonly, "div-container": true };
194
- const aClassMap = { "switch-paddle": this.isSwitch, "checkbox": !this.isSwitch, "isChecked": checked, "isUnchecked": !checked };
195
- const inputId = `${this.id}Check`;
196
- return html`
197
- ${this._renderLabel(inputId)}
198
- <div @click="${this.onClick}" class="${o(classMapVal)}">
199
- <a href="#" @click="${this.linkClick}" @keypress="${this.onKeyPress}" class="${o(aClassMap)}">
200
- <pd-icon icon="${this.isSwitch ? "checkBox" : "checkBoxOnlyCheck"}" class="small" ?activeIcon="${checked}"></pd-icon>
201
- </a>
202
- ${this._hasInner ? html`
203
- <span class="label">
204
- <slot></slot>
205
- </span>` : ""}
206
- </div>
207
- ${this._renderErrorMsg()}
208
- `;
209
- }
210
- onClick(e) {
211
- if (this.disabled || this.readonly) {
212
- return;
213
- }
214
- const checked = this.value === "true";
215
- this._handleChangedValue(checked ? "false" : "true", e);
216
- }
217
- onKeyPress(e) {
218
- e.preventDefault();
219
- if (e.keyCode === 32 || e.code === "Space") {
220
- this.onClick(e);
221
- }
222
- }
223
- // eslint-disable-next-line class-methods-use-this
224
- linkClick(e) {
225
- e.preventDefault();
226
- }
227
- }
228
- export {
229
- PdCheckbox
230
- };