@progressive-development/pd-contact 0.5.1 → 0.5.2

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,3 +1,4 @@
1
+ import { str } from "@lit/localize";
1
2
  const templates = {
2
3
  "pd.contact.address.title": `Adres`,
3
4
  "pd.contact.check.company": `Bedrijf`,
@@ -10,10 +11,13 @@ const templates = {
10
11
  "pd.contact.label.firstName": `Voornaam`,
11
12
  "pd.contact.label.lastName": `Achternaam`,
12
13
  "pd.contact.label.phone": `Telefoon`,
14
+ "pd.contact.label.propertyDate": `Datum van het pand`,
13
15
  "pd.contact.label.street": `Straat`,
14
16
  "pd.contact.label.streetNr": `Nr.`,
17
+ "pd.contact.label.summary.propertyDate": str`Bouwjaar: ${0}`,
15
18
  "pd.contact.label.type": `Type`,
16
- "pd.contact.label.zip": `Postcode`
19
+ "pd.contact.label.zip": `Postcode`,
20
+ "pd.contact.property.year.selection": `Bouwjaar selecteren`
17
21
  };
18
22
  export {
19
23
  templates
@@ -1,4 +1,6 @@
1
+ import { str } from "@lit/localize";
1
2
  const templates = {
3
+ "pd.contact.property.year.selection": `Baujahr auswählen`,
2
4
  "pd.contact.address.title": `Adresse`,
3
5
  "pd.contact.label.type": `Typ`,
4
6
  "pd.contact.check.private": `Privatperson`,
@@ -12,8 +14,10 @@ const templates = {
12
14
  "pd.contact.label.zip": `PLZ`,
13
15
  "pd.contact.label.city": `Ort`,
14
16
  "pd.contact.label.additional": `Addresszusatz`,
17
+ "pd.contact.label.propertyDate": `Datum der Immobilie`,
15
18
  "pd.contact.label.phone": `Telefon`,
16
- "pd.contact.label.email": `E-mail`
19
+ "pd.contact.label.email": `E-mail`,
20
+ "pd.contact.label.summary.propertyDate": str`Baujahr: ${0}`
17
21
  };
18
22
  export {
19
23
  templates
@@ -1,3 +1,4 @@
1
+ import { str } from "@lit/localize";
1
2
  const templates = {
2
3
  "pd.contact.address.title": `Address`,
3
4
  "pd.contact.check.company": `Company`,
@@ -10,10 +11,13 @@ const templates = {
10
11
  "pd.contact.label.firstName": `First Name`,
11
12
  "pd.contact.label.lastName": `Last Name`,
12
13
  "pd.contact.label.phone": `Phone`,
14
+ "pd.contact.label.propertyDate": `Property date`,
13
15
  "pd.contact.label.street": `Street`,
14
16
  "pd.contact.label.streetNr": `No.`,
17
+ "pd.contact.label.summary.propertyDate": str`Year of construction: ${0}`,
15
18
  "pd.contact.label.type": `Type`,
16
- "pd.contact.label.zip": `ZIP Code`
19
+ "pd.contact.label.zip": `ZIP Code`,
20
+ "pd.contact.property.year.selection": `Select year of construction`
17
21
  };
18
22
  export {
19
23
  templates
@@ -1,2 +1,4 @@
1
1
  import { PdContact } from "./src/PdContact.js";
2
- window.customElements.define("pd-contact", PdContact);
2
+ if (!customElements.get("pd-contact")) {
3
+ window.customElements.define("pd-contact", PdContact);
4
+ }
@@ -1,11 +1,12 @@
1
1
  import { LitElement, css, html } from "lit";
2
- import { msg } from "@lit/localize";
2
+ import { msg, str } from "@lit/localize";
3
3
  import { PDFontStyles } from "@progressive-development/pd-shared-styles";
4
4
  import "@progressive-development/pd-icon/pd-icon";
5
5
  import "@progressive-development/pd-forms/pd-checkbox";
6
6
  import "@progressive-development/pd-forms/pd-form-container";
7
7
  import "@progressive-development/pd-forms/pd-form-row";
8
8
  import "@progressive-development/pd-forms/pd-input";
9
+ import "@progressive-development/pd-forms/pd-select";
9
10
  import "@progressive-development/pd-forms/pd-radio-group";
10
11
  /**
11
12
  * @license
@@ -50,75 +51,23 @@ const C_CITY = "city";
50
51
  const C_ADDITIONAL = "additionalHint";
51
52
  const C_PHONE1 = "phone1";
52
53
  const C_EMAIL = "email";
54
+ const yearSelection = [
55
+ { value: "UNDEF", name: msg("Baujahr auswählen", { id: "pd.contact.property.year.selection" }) },
56
+ { value: "<2014", name: "< 2014" },
57
+ { value: "2014", name: "2014" },
58
+ { value: "2015", name: "2015" },
59
+ { value: "2016", name: "2016" },
60
+ { value: "2017", name: "2017" },
61
+ { value: "2018", name: "2018" },
62
+ { value: "2019", name: "2019" },
63
+ { value: "2020", name: "2020" },
64
+ { value: "2021", name: "2021" },
65
+ { value: "2022", name: "2022" },
66
+ { value: "2023", name: "2023" },
67
+ { value: "2024", name: "2024" },
68
+ { value: "2025", name: "2025" }
69
+ ];
53
70
  class PdContact extends LitElement {
54
- static get styles() {
55
- return [
56
- PDFontStyles,
57
- css`
58
- :host {
59
- display: block;
60
- }
61
-
62
- .contact {
63
- display: flex;
64
- flex-direction: column;
65
- }
66
-
67
- address {
68
- color: var(--pd-contact-address-col, var(--pd-default-font-content-col));
69
- line-height: 1.8;
70
- font-style: normal;
71
- }
72
-
73
- dl {
74
- margin: 0;
75
- padding: 0;
76
- }
77
-
78
- dt {
79
- font-weight: bold;
80
- padding-top: 10px;
81
- color: var(--pd-contact-address-title-col, var(--pd-default-font-title-col));
82
- }
83
-
84
- dd {
85
- font-weight: 400;
86
- font-size: 1em;
87
- margin: 0;
88
- padding: 0;
89
- }
90
-
91
- dd.larger {
92
- padding-top: 3px;
93
- padding-bottom: 5px;
94
- }
95
-
96
- .contact-form {
97
- --row-padding-top: 10px;
98
- }
99
-
100
- .link-icon {
101
- --pd-icon-bg-col-active: #859900;
102
- --pd-icon-bg-col-hover: #859900;
103
- --pd-icon-size: 14px;
104
- --pd-icon-stroke-col-active: white;
105
- --pd-icon-col-active: white;
106
- }
107
-
108
- .link-item {
109
- display: flex;
110
- align-items: center;
111
- text-decoration: none;
112
- color: var(--pd-default-font-link-col, inherit);
113
- }
114
-
115
- .link-item:hover {
116
- color: var(--pd-default-font-link-col-hover, #451A46) ;
117
- }
118
-
119
- `
120
- ];
121
- }
122
71
  static get properties() {
123
72
  return {
124
73
  addressTitle: { type: String },
@@ -131,6 +80,10 @@ class PdContact extends LitElement {
131
80
  * summary (true) or view (false) contact data
132
81
  */
133
82
  summary: { type: Boolean },
83
+ /**
84
+ * withPropertyDate (true) input for property date
85
+ */
86
+ withPropertyDate: { type: Boolean },
134
87
  /**
135
88
  * List with required contact fields, if not set use default (previous existing values to be consitent during update)
136
89
  */
@@ -148,6 +101,74 @@ class PdContact extends LitElement {
148
101
  _errorMap: { type: Object }
149
102
  };
150
103
  }
104
+ static get styles() {
105
+ return [
106
+ PDFontStyles,
107
+ css`
108
+ :host {
109
+ display: block;
110
+ }
111
+
112
+ .contact {
113
+ display: flex;
114
+ flex-direction: column;
115
+ }
116
+
117
+ address {
118
+ color: var(--pd-contact-address-col, var(--pd-default-font-content-col));
119
+ line-height: 1.8;
120
+ font-style: normal;
121
+ }
122
+
123
+ dl {
124
+ margin: 0;
125
+ padding: 0;
126
+ }
127
+
128
+ dt {
129
+ font-weight: bold;
130
+ padding-top: 10px;
131
+ color: var(--pd-contact-address-title-col, var(--pd-default-font-title-col));
132
+ }
133
+
134
+ dd {
135
+ font-weight: 400;
136
+ font-size: 1em;
137
+ margin: 0;
138
+ padding: 0;
139
+ }
140
+
141
+ dd.larger {
142
+ padding-top: 3px;
143
+ padding-bottom: 5px;
144
+ }
145
+
146
+ .contact-form {
147
+ --row-padding-top: 10px;
148
+ }
149
+
150
+ .link-icon {
151
+ --pd-icon-bg-col-active: #859900;
152
+ --pd-icon-bg-col-hover: #859900;
153
+ --pd-icon-size: 14px;
154
+ --pd-icon-stroke-col-active: white;
155
+ --pd-icon-col-active: white;
156
+ }
157
+
158
+ .link-item {
159
+ display: flex;
160
+ align-items: center;
161
+ text-decoration: none;
162
+ color: var(--pd-default-font-link-col, inherit);
163
+ }
164
+
165
+ .link-item:hover {
166
+ color: var(--pd-default-font-link-col-hover, #451A46) ;
167
+ }
168
+
169
+ `
170
+ ];
171
+ }
151
172
  constructor() {
152
173
  super();
153
174
  this.addressTitle = msg("Adresse", { id: "pd.contact.address.title" });
@@ -337,6 +358,18 @@ class PdContact extends LitElement {
337
358
  ></pd-input>
338
359
  </pd-form-row>
339
360
  ` : ""}
361
+ ${this.withPropertyDate ? html`
362
+ <pd-form-row class="contact-form">
363
+ <pd-select
364
+ class="quarter3"
365
+ id="propertyDateId"
366
+ label="${msg("Datum der Immobilie", { id: "pd.contact.label.propertyDate" })}"
367
+ value="${this.contact ? this.contact.propertyDate : ""}"
368
+ .values="${yearSelection}"
369
+ required
370
+ ></pd-select>
371
+ </pd-form-row>
372
+ ` : ""}
340
373
  ${this.inputFields.length === 0 || this._showInput(C_PHONE1) ? html`
341
374
  <pd-form-row class="contact-form">
342
375
  <pd-input
@@ -391,6 +424,7 @@ class PdContact extends LitElement {
391
424
  <dd>${this._getFullStreet()}</dd>
392
425
  <dd>${this._getFullLocation()}</dd>
393
426
  ${this.contact.additionalHint ? html`<dd>${this.contact.additionalHint}</dd>` : ""}
427
+ ${this.contact.propertyDate ? html`<dd>${msg(str`Baujahr: ${this.contact.propertyDate}`, { id: "pd.contact.label.summary.propertyDate" })}</dd>` : ""}
394
428
  <dd>${this.contact.country}</dd>
395
429
 
396
430
  ${this.contact.phone1 ? html`
@@ -555,17 +589,30 @@ class PdContact extends LitElement {
555
589
  }
556
590
  }
557
591
  _setFormData() {
558
- const companyName = this._business ? this.shadowRoot.getElementById("compNameId").value : void 0;
559
- const vatNr = this._business ? this.shadowRoot.getElementById("vatId").value : void 0;
560
- const firstName = this._business ? void 0 : this.shadowRoot.getElementById("firstNameId").value;
561
- const lastName = this._business ? void 0 : this.shadowRoot.getElementById("lastNameId").value;
562
- const street = this.shadowRoot.getElementById("streetId").value;
563
- const streetNr = this.shadowRoot.getElementById("streetNrId").value;
564
- const additionalHint = this.shadowRoot.getElementById("additionalHintId").value;
565
- const zip = this.shadowRoot.getElementById("zipId").value;
566
- const city = this.shadowRoot.getElementById("cityId").value;
567
- const phone1 = this.shadowRoot.getElementById("phoneId").value;
568
- const email = this.shadowRoot.getElementById("mailId").value;
592
+ const elCompanyName = this._business ? this.shadowRoot.getElementById("compNameId") : void 0;
593
+ const companyName = elCompanyName ? elCompanyName.value : void 0;
594
+ const elVatNr = this._business ? this.shadowRoot.getElementById("vatId") : void 0;
595
+ const vatNr = elVatNr ? elVatNr.value : void 0;
596
+ const elFirstName = this._business ? void 0 : this.shadowRoot.getElementById("firstNameId");
597
+ const firstName = elFirstName ? elFirstName.value : void 0;
598
+ const elLastName = this._business ? void 0 : this.shadowRoot.getElementById("lastNameId");
599
+ const lastName = elLastName ? elLastName.value : void 0;
600
+ const elStreet = this.shadowRoot.getElementById("streetId");
601
+ const street = elStreet ? elStreet.value : void 0;
602
+ const elStreetNr = this.shadowRoot.getElementById("streetNrId");
603
+ const streetNr = elStreetNr ? elStreetNr.value : void 0;
604
+ const elAdditionalHint = this.shadowRoot.getElementById("additionalHintId");
605
+ const additionalHint = elAdditionalHint ? elAdditionalHint.value : void 0;
606
+ const elPropertyDate = this.withPropertyDate ? this.shadowRoot.getElementById("propertyDateId") : void 0;
607
+ const propertyDate = elPropertyDate ? elPropertyDate.value : void 0;
608
+ const elZip = this.shadowRoot.getElementById("zipId");
609
+ const zip = elZip ? elZip.value : void 0;
610
+ const elCity = this.shadowRoot.getElementById("cityId");
611
+ const city = elCity ? elCity.value : void 0;
612
+ const elPhone1 = this.shadowRoot.getElementById("phoneId");
613
+ const phone1 = elPhone1 ? elPhone1.value : void 0;
614
+ const elEmail = this.shadowRoot.getElementById("mailId");
615
+ const email = elEmail ? elEmail.value : void 0;
569
616
  return {
570
617
  business: this._business,
571
618
  companyName,
@@ -575,6 +622,7 @@ class PdContact extends LitElement {
575
622
  street,
576
623
  streetNr,
577
624
  additionalHint,
625
+ propertyDate,
578
626
  zip,
579
627
  city,
580
628
  phone1,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Progressive Development Contact component",
4
4
  "author": "PD Progressive Development",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
- "version": "0.5.1",
6
+ "version": "0.5.2",
7
7
  "main": "./dist/index.js",
8
8
  "module": "./dist/index.js",
9
9
  "exports": {
@@ -34,28 +34,30 @@
34
34
  "build-storybook": "storybook build"
35
35
  },
36
36
  "dependencies": {
37
- "@lit/localize": "^0.11.4",
37
+ "@lit/localize": "^0.12.2",
38
38
  "@progressive-development/pd-forms": "^0.5.0",
39
39
  "@progressive-development/pd-icon": "^0.5.0",
40
40
  "@progressive-development/pd-shared-styles": "^0.1.1",
41
41
  "lit": "^2.8.0"
42
42
  },
43
43
  "devDependencies": {
44
+ "@chromatic-com/storybook": "^1.3.4",
44
45
  "@custom-elements-manifest/analyzer": "^0.4.17",
45
46
  "@lit/localize-tools": "^0.7.2",
46
- "@storybook/addon-essentials": "^7.6.20",
47
- "@storybook/addon-links": "^7.6.20",
48
- "@storybook/blocks": "^7.5.3",
49
- "@storybook/web-components": "^7.5.3",
50
- "@storybook/web-components-vite": "^7.6.20",
47
+ "@storybook/addon-essentials": "^8.0.10",
48
+ "@storybook/addon-links": "^8.0.10",
49
+ "@storybook/blocks": "^8.0.10",
50
+ "@storybook/test": "^8.0.10",
51
+ "@storybook/web-components": "^8.0.10",
52
+ "@storybook/web-components-vite": "^8.0.10",
51
53
  "eslint": "^7.32.0",
52
54
  "eslint-config-prettier": "^8.10.0",
53
- "eslint-plugin-storybook": "^0.6.15",
55
+ "eslint-plugin-storybook": "^0.8.0",
54
56
  "husky": "^4.3.8",
55
57
  "lint-staged": "^10.5.4",
56
58
  "prettier": "^2.8.8",
57
59
  "rollup-plugin-visualizer": "^5.13.1",
58
- "storybook": "^7.6.20",
60
+ "storybook": "^8.0.10",
59
61
  "vite": "^5.4.11",
60
62
  "vitest": "^2.1.8"
61
63
  },