@progressive-development/pd-contact 0.9.1 → 1.0.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.
@@ -1,8 +1,8 @@
1
- import { LitElement, css, html } from 'lit';
1
+ import { LitElement, css, html, nothing } from 'lit';
2
2
  import { property, state, query } from 'lit/decorators.js';
3
3
  import { msg, str } from '@lit/localize';
4
- import { PdFontStyles, PdColorStyles } from '@progressive-development/pd-shared-styles';
5
4
  import '@progressive-development/pd-icon/pd-icon';
5
+ import '../pd-page/dist/pd-socialmedia.js';
6
6
  import '@progressive-development/pd-forms/pd-checkbox';
7
7
  import '@progressive-development/pd-forms/pd-form-container';
8
8
  import '@progressive-development/pd-forms/pd-form-row';
@@ -60,6 +60,8 @@ const _PdContact = class _PdContact extends LitElement {
60
60
  this.addressTitle = msg("Adresse", { id: "pd.contact.address.title" });
61
61
  this.phoneMailLink = false;
62
62
  this.summary = false;
63
+ this.viewType = "detail";
64
+ this.cardLayout = "auto";
63
65
  this.withPropertyDate = false;
64
66
  this.requiredFields = [];
65
67
  this.inputFields = [];
@@ -67,8 +69,6 @@ const _PdContact = class _PdContact extends LitElement {
67
69
  }
68
70
  static {
69
71
  this.styles = [
70
- PdFontStyles,
71
- PdColorStyles,
72
72
  css`
73
73
  :host {
74
74
  display: block;
@@ -135,6 +135,329 @@ const _PdContact = class _PdContact extends LitElement {
135
135
  .link-item:hover {
136
136
  color: var(--pd-default-font-link-col-hover, #451a46);
137
137
  }
138
+
139
+ /* ========================================
140
+ DETAIL VIEW STYLES
141
+ ======================================== */
142
+
143
+ .detail-view {
144
+ display: flex;
145
+ flex-direction: column;
146
+ gap: var(--pd-spacing-md, 1rem);
147
+ }
148
+
149
+ .detail-names {
150
+ display: flex;
151
+ flex-direction: column;
152
+ gap: var(--pd-spacing-xs, 0.25rem);
153
+ }
154
+
155
+ .detail-title {
156
+ margin: 0;
157
+ font-family: var(--pd-default-font-title-family, inherit);
158
+ font-size: 1.25rem;
159
+ font-weight: 700;
160
+ color: var(--pd-default-font-title-col, #0a3a48);
161
+ line-height: 1.3;
162
+ }
163
+
164
+ .detail-company,
165
+ .detail-vat {
166
+ margin: 0;
167
+ color: var(--pd-default-font-content-col, #353738);
168
+ }
169
+
170
+ .detail-name {
171
+ margin: 0;
172
+ color: var(--pd-default-font-muted-col, #6b7280);
173
+ font-weight: 300;
174
+ }
175
+
176
+ .detail-address {
177
+ display: flex;
178
+ flex-direction: column;
179
+ gap: var(--pd-spacing-xs, 0.25rem);
180
+ }
181
+
182
+ .detail-address p {
183
+ margin: 0;
184
+ color: var(--pd-default-font-content-col, #353738);
185
+ line-height: 1.5;
186
+ }
187
+
188
+ .detail-contact-info {
189
+ display: flex;
190
+ flex-direction: column;
191
+ gap: var(--pd-spacing-sm, 0.5rem);
192
+ }
193
+
194
+ .detail-bank {
195
+ display: flex;
196
+ flex-direction: column;
197
+ gap: var(--pd-spacing-xs, 0.25rem);
198
+ }
199
+
200
+ .detail-bank p {
201
+ margin: 0;
202
+ color: var(--pd-default-font-content-col, #353738);
203
+ }
204
+
205
+ .detail-label {
206
+ font-weight: 700;
207
+ color: var(--pd-default-font-title-col, #0a3a48) !important;
208
+ padding-top: var(--pd-spacing-sm, 0.5rem);
209
+ }
210
+
211
+ .detail-divider {
212
+ border: none;
213
+ border-top: 1px solid var(--pd-default-disabled-light-col, #e0e0e0);
214
+ margin: var(--pd-spacing-sm, 0.5rem) 0;
215
+ opacity: 0.5;
216
+ }
217
+
218
+ /* ========================================
219
+ CARD VIEW STYLES
220
+ ======================================== */
221
+
222
+ .card-wrapper {
223
+ container-type: inline-size;
224
+ container-name: contact-card;
225
+ }
226
+
227
+ .card {
228
+ display: grid;
229
+ background: var(
230
+ --pd-contact-card-bg,
231
+ var(--pd-default-bg-col, #fefefe)
232
+ );
233
+ border-radius: var(--pd-contact-card-radius, var(--pd-radius-lg, 8px));
234
+ box-shadow: var(
235
+ --pd-contact-card-shadow,
236
+ var(--pd-shadow-xl, 0 8px 16px rgba(0, 0, 0, 0.15))
237
+ );
238
+ padding: var(--pd-contact-card-padding, 2rem);
239
+ overflow: hidden;
240
+ }
241
+
242
+ .card-content {
243
+ display: flex;
244
+ flex-direction: column;
245
+ gap: var(--pd-spacing-md, 1rem);
246
+ }
247
+
248
+ .card-logo {
249
+ display: flex;
250
+ align-items: center;
251
+ justify-content: center;
252
+ }
253
+
254
+ .card-logo img {
255
+ max-width: 100%;
256
+ max-height: 100%;
257
+ object-fit: contain;
258
+ }
259
+
260
+ .card-names {
261
+ display: flex;
262
+ flex-direction: column;
263
+ gap: var(--pd-spacing-xs, 0.25rem);
264
+ }
265
+
266
+ .title-name {
267
+ margin: 0;
268
+ font-family: var(--pd-default-font-title-family, inherit);
269
+ color: var(
270
+ --pd-contact-card-title-col,
271
+ var(--pd-default-font-title-col, #0a3a48)
272
+ );
273
+ font-weight: 700;
274
+ line-height: 1.2;
275
+ }
276
+
277
+ .real-name {
278
+ margin: 0;
279
+ font-family: var(--pd-default-font-content-family, inherit);
280
+ color: var(
281
+ --pd-contact-card-subtitle-col,
282
+ var(--pd-default-font-muted-col, #6b7280)
283
+ );
284
+ font-weight: 300;
285
+ }
286
+
287
+ .card-contact-info {
288
+ display: flex;
289
+ flex-direction: column;
290
+ gap: var(--pd-spacing-sm, 0.5rem);
291
+ }
292
+
293
+ .contact-item {
294
+ display: flex;
295
+ align-items: center;
296
+ gap: var(--pd-spacing-sm, 0.5rem);
297
+ text-decoration: none;
298
+ color: var(--pd-default-font-content-col, #353738);
299
+ font-size: var(--pd-default-font-content-size, 1rem);
300
+ }
301
+
302
+ .contact-item:hover {
303
+ color: var(--pd-default-font-link-col-hover, #ffc857);
304
+ }
305
+
306
+ .contact-icon {
307
+ --pd-icon-size: 16px;
308
+ --pd-icon-col: var(
309
+ --pd-contact-icon-col,
310
+ var(--pd-default-col, #067394)
311
+ );
312
+ flex-shrink: 0;
313
+ }
314
+
315
+ .card-divider {
316
+ border: none;
317
+ border-top: 1px solid
318
+ var(
319
+ --pd-contact-card-divider-col,
320
+ var(--pd-default-disabled-light-col, #e0e0e0)
321
+ );
322
+ margin: var(--pd-spacing-sm, 0.5rem) 0;
323
+ opacity: 0.5;
324
+ }
325
+
326
+ /* VERTICAL LAYOUT (default for narrow containers) */
327
+ @container contact-card (max-width: 499px) {
328
+ .card:not(.layout-horizontal) {
329
+ grid-template-rows: auto 1fr;
330
+ grid-template-columns: 1fr;
331
+ text-align: center;
332
+ }
333
+
334
+ .card:not(.layout-horizontal) .card-logo {
335
+ width: 100%;
336
+ max-height: 150px;
337
+ padding-bottom: var(--pd-spacing-md, 1rem);
338
+ }
339
+
340
+ .card:not(.layout-horizontal) .card-names {
341
+ align-items: center;
342
+ }
343
+
344
+ .card:not(.layout-horizontal) .title-name {
345
+ font-size: 1.25rem;
346
+ }
347
+
348
+ .card:not(.layout-horizontal) .real-name {
349
+ font-size: 0.9rem;
350
+ }
351
+
352
+ .card:not(.layout-horizontal) .card-contact-info {
353
+ align-items: center;
354
+ }
355
+
356
+ .card:not(.layout-horizontal) .contact-item {
357
+ justify-content: center;
358
+ font-size: 0.85rem;
359
+ }
360
+
361
+ .card:not(.layout-horizontal) pd-socialmedia {
362
+ display: flex;
363
+ justify-content: center;
364
+ }
365
+ }
366
+
367
+ /* HORIZONTAL LAYOUT (for wider containers) */
368
+ @container contact-card (min-width: 500px) {
369
+ .card:not(.layout-vertical) {
370
+ grid-template-columns: 1fr minmax(120px, 200px);
371
+ grid-template-rows: 1fr;
372
+ align-items: start;
373
+ gap: var(--pd-spacing-md, 1rem);
374
+ }
375
+
376
+ .card:not(.layout-vertical) .card-logo {
377
+ order: 2;
378
+ width: 100%;
379
+ }
380
+
381
+ .card:not(.layout-vertical) .card-content {
382
+ order: 1;
383
+ }
384
+
385
+ .card:not(.layout-vertical) .title-name {
386
+ font-size: 1.5rem;
387
+ }
388
+
389
+ .card:not(.layout-vertical) .real-name {
390
+ font-size: 1rem;
391
+ }
392
+
393
+ .card:not(.layout-vertical) .contact-item {
394
+ font-size: 0.9rem;
395
+ }
396
+ }
397
+
398
+ /* FORCED HORIZONTAL LAYOUT */
399
+ .card.layout-horizontal {
400
+ grid-template-columns: 1fr minmax(120px, 200px) !important;
401
+ grid-template-rows: 1fr !important;
402
+ text-align: left !important;
403
+ align-items: start !important;
404
+ gap: var(--pd-spacing-md, 1rem) !important;
405
+ }
406
+
407
+ .card.layout-horizontal .card-logo {
408
+ order: 2 !important;
409
+ width: 100% !important;
410
+ }
411
+
412
+ .card.layout-horizontal .card-content {
413
+ order: 1 !important;
414
+ }
415
+
416
+ .card.layout-horizontal .title-name {
417
+ font-size: 1.5rem;
418
+ }
419
+
420
+ .card.layout-horizontal .real-name {
421
+ font-size: 1rem;
422
+ }
423
+
424
+ /* FORCED VERTICAL LAYOUT */
425
+ .card.layout-vertical {
426
+ grid-template-rows: auto 1fr !important;
427
+ grid-template-columns: 1fr !important;
428
+ text-align: center !important;
429
+ }
430
+
431
+ .card.layout-vertical .card-logo {
432
+ width: 100% !important;
433
+ max-height: 150px !important;
434
+ padding-bottom: var(--pd-spacing-md, 1rem);
435
+ }
436
+
437
+ .card.layout-vertical .card-names {
438
+ align-items: center !important;
439
+ }
440
+
441
+ .card.layout-vertical .card-contact-info {
442
+ align-items: center !important;
443
+ }
444
+
445
+ .card.layout-vertical .contact-item {
446
+ justify-content: center;
447
+ }
448
+
449
+ .card.layout-vertical pd-socialmedia {
450
+ display: flex;
451
+ justify-content: center;
452
+ }
453
+
454
+ .card.layout-vertical .title-name {
455
+ font-size: 1.25rem;
456
+ }
457
+
458
+ .card.layout-vertical .real-name {
459
+ font-size: 0.9rem;
460
+ }
138
461
  `
139
462
  ];
140
463
  }
@@ -146,7 +469,7 @@ const _PdContact = class _PdContact extends LitElement {
146
469
  render() {
147
470
  return html`
148
471
  <div class="contact">
149
- ${this.summary ? this._renderViewContact() : this._renderEditContact()}
472
+ ${this.viewType === "card" && this.summary ? this._renderCardView() : this.summary ? this._renderViewContact() : this._renderEditContact()}
150
473
  </div>
151
474
  `;
152
475
  }
@@ -157,7 +480,6 @@ const _PdContact = class _PdContact extends LitElement {
157
480
  <pd-form-row>
158
481
  <pd-radio-group
159
482
  id="contactTypeRadioId"
160
- class="quarter3"
161
483
  label="${msg("Typ", { id: "pd.contact.label.type" })}"
162
484
  required
163
485
  initValue="${this._getRadioValue()}"
@@ -188,7 +510,6 @@ const _PdContact = class _PdContact extends LitElement {
188
510
  <pd-form-row class="contact-form">
189
511
  <pd-input
190
512
  id="compNameId"
191
- class="quarter3"
192
513
  label="${msg("Name des Unternehmen", {
193
514
  id: "pd.contact.label.company"
194
515
  })}"
@@ -203,7 +524,6 @@ const _PdContact = class _PdContact extends LitElement {
203
524
  <pd-form-row class="contact-form">
204
525
  <pd-input
205
526
  id="vatId"
206
- class="quarter3"
207
527
  label="${msg("USt-IdNr.", {
208
528
  id: "pd.contact.label.btw"
209
529
  })}"
@@ -220,7 +540,6 @@ const _PdContact = class _PdContact extends LitElement {
220
540
  <pd-form-row class="contact-form">
221
541
  <pd-input
222
542
  id="firstNameId"
223
- class="quarter3"
224
543
  label="${msg("Vorname", {
225
544
  id: "pd.contact.label.firstName"
226
545
  })}"
@@ -235,7 +554,6 @@ const _PdContact = class _PdContact extends LitElement {
235
554
  <pd-form-row class="contact-form">
236
555
  <pd-input
237
556
  id="lastNameId"
238
- class="quarter3"
239
557
  label="${msg("Nachname", {
240
558
  id: "pd.contact.label.lastName"
241
559
  })}"
@@ -251,7 +569,7 @@ const _PdContact = class _PdContact extends LitElement {
251
569
  <pd-form-row class="contact-form">
252
570
  <pd-input
253
571
  id="streetId"
254
- class="quarter2"
572
+ span="three-quarters"
255
573
  label="${msg("Strasse", { id: "pd.contact.label.street" })}"
256
574
  valueName="street"
257
575
  initValue="${this.contact?.street || ""}"
@@ -260,7 +578,7 @@ const _PdContact = class _PdContact extends LitElement {
260
578
  ></pd-input>
261
579
  <pd-input
262
580
  id="streetNrId"
263
- class="quarter1"
581
+ span="quarter"
264
582
  label="${msg("Nr.", { id: "pd.contact.label.streetNr" })}"
265
583
  valueName="streetNr"
266
584
  initValue="${this.contact?.streetNr || ""}"
@@ -274,7 +592,7 @@ const _PdContact = class _PdContact extends LitElement {
274
592
  <pd-input
275
593
  readonly
276
594
  id="zipId"
277
- class="quarter1"
595
+ span="third"
278
596
  label="${msg("PLZ", { id: "pd.contact.label.zip" })}"
279
597
  valueName="zip"
280
598
  initValue="${this.match.zip}"
@@ -282,7 +600,7 @@ const _PdContact = class _PdContact extends LitElement {
282
600
  ` : html`
283
601
  <pd-input
284
602
  id="zipId"
285
- class="quarter1"
603
+ span="third"
286
604
  label="${msg("PLZ", { id: "pd.contact.label.zip" })}"
287
605
  fieldType="number"
288
606
  valueName="zip"
@@ -293,7 +611,7 @@ const _PdContact = class _PdContact extends LitElement {
293
611
  `}
294
612
  <pd-input
295
613
  id="cityId"
296
- class="quarter2"
614
+ span="two-thirds"
297
615
  label="${msg("Ort", { id: "pd.contact.label.city" })}"
298
616
  valueName="city"
299
617
  initValue="${this.contact?.city || ""}"
@@ -305,7 +623,6 @@ const _PdContact = class _PdContact extends LitElement {
305
623
  ${this.inputFields.length === 0 || this._showInput(C_ADDITIONAL) ? html`
306
624
  <pd-form-row class="contact-form">
307
625
  <pd-input
308
- class="quarter3"
309
626
  id="additionalHintId"
310
627
  label="${msg("Addresszusatz", {
311
628
  id: "pd.contact.label.additional"
@@ -319,7 +636,6 @@ const _PdContact = class _PdContact extends LitElement {
319
636
  ${this.withPropertyDate ? html`
320
637
  <pd-form-row class="contact-form">
321
638
  <pd-select
322
- class="quarter3"
323
639
  id="propertyDateId"
324
640
  label="${msg("Datum der Immobilie", {
325
641
  id: "pd.contact.label.propertyDate"
@@ -334,7 +650,6 @@ const _PdContact = class _PdContact extends LitElement {
334
650
  <pd-form-row class="contact-form">
335
651
  <pd-input
336
652
  id="phoneId"
337
- class="quarter3"
338
653
  label="${msg("Telefon", { id: "pd.contact.label.phone" })}"
339
654
  name="phone"
340
655
  valueName="phone1"
@@ -349,7 +664,6 @@ const _PdContact = class _PdContact extends LitElement {
349
664
  <pd-form-row class="contact-form">
350
665
  <pd-input
351
666
  id="mailId"
352
- class="quarter3"
353
667
  label="${msg("E-mail", { id: "pd.contact.label.email" })}"
354
668
  fieldType="mail"
355
669
  valueName="email"
@@ -372,66 +686,195 @@ const _PdContact = class _PdContact extends LitElement {
372
686
  if (!this.contact) return html`<p>Contact undefined</p>`;
373
687
  const trPhoneNr = transformPhone(
374
688
  this.contact.phone1 || "",
375
- this.contact.country || "be"
689
+ this.contact.country || "de"
376
690
  );
691
+ const displayTitle = this.contact.titleName || this.addressTitle;
377
692
  return html`
378
- <address>
379
- <dl>
380
- <dt>${this.addressTitle}</dt>
381
- <dd>${this.contact.companyName}</dd>
382
- <dd>${this.contact.vatNr}</dd>
383
- <dd>${this._getFullName()}</dd>
384
- <dd>${this._getFullStreet()}</dd>
385
- <dd>${this._getFullLocation()}</dd>
386
- ${this.contact.additionalHint ? html`<dd>${this.contact.additionalHint}</dd>` : ""}
387
- ${this.contact.propertyDate ? html`<dd>
693
+ <div class="detail-view">
694
+ <div class="detail-names">
695
+ ${displayTitle ? html`<h3 class="detail-title">${displayTitle}</h3>` : nothing}
696
+ ${this.contact.companyName ? html`<p class="detail-company">${this.contact.companyName}</p>` : nothing}
697
+ ${this.contact.vatNr ? html`<p class="detail-vat">${this.contact.vatNr}</p>` : nothing}
698
+ ${this._getFullName() && this._getFullName() !== displayTitle ? html`<p class="detail-name">${this._getFullName()}</p>` : nothing}
699
+ </div>
700
+
701
+ <div class="detail-address">
702
+ ${this._getFullStreet() ? html`<p>${this._getFullStreet()}</p>` : nothing}
703
+ ${this._getFullLocation() ? html`<p>${this._getFullLocation()}</p>` : nothing}
704
+ ${this.contact.additionalHint ? html`<p>${this.contact.additionalHint}</p>` : nothing}
705
+ ${this.contact.country ? html`<p>${this.contact.country}</p>` : nothing}
706
+ ${this.contact.propertyDate ? html`<p>
388
707
  ${msg(str`Baujahr: ${this.contact.propertyDate}`, {
389
708
  id: "pd.contact.label.summary.propertyDate"
390
709
  })}
391
- </dd>` : ""}
392
- <dd>${this.contact.country}</dd>
393
-
394
- ${this.contact.phone1 ? html` <dd class="larger">
395
- ${this.phoneMailLink && trPhoneNr ? html` <a
396
- href="tel:${trPhoneNr}"
397
- aria-label="Phone call: ${this.contact.phone1}"
398
- class="link-item"
399
- >
400
- <span style="margin-right: 8px;"
401
- >${this.contact.phone1}</span
402
- >
403
- <pd-icon
404
- activeIcon
405
- icon="phoneIcon"
406
- class="round link-icon"
407
- ></pd-icon>
408
- </a>` : this.contact.phone1}
409
- </dd>` : ""}
410
- ${this.contact.email ? html` <dd class="larger">
411
- ${this.phoneMailLink ? html` <a
412
- href="mailto:${this.contact.email}"
413
- aria-label="Send mail: ${this.contact.email}"
414
- class="link-item"
415
- >
416
- <span style="margin-right: 8px;"
417
- >${this.contact.email}</span
418
- >
419
- <pd-icon
420
- activeIcon
421
- icon="mailIcon"
422
- class="round link-icon"
423
- ></pd-icon>
424
- </a>` : this.contact.email}
425
- </dd>` : ""}
426
- ${this.contact.btw ? html` <dt>BTW</dt>
427
- <dd>${this.contact.btw}</dd>` : ""}
428
- ${this.contact.kbc ? html` <dt>Bankgegevens</dt>
429
- <dd>${this.contact.kbc}</dd>
430
- <dd>${this.contact.bank}</dd>` : ""}
431
- </dl>
432
- </address>
710
+ </p>` : nothing}
711
+ </div>
712
+
713
+ <div class="detail-contact-info">
714
+ ${this.contact.phone1 ? html`
715
+ <a
716
+ href="tel:${trPhoneNr || this.contact.phone1}"
717
+ class="contact-item"
718
+ aria-label="Phone: ${this.contact.phone1}"
719
+ >
720
+ <pd-icon icon="phoneIcon" class="contact-icon"></pd-icon>
721
+ <span>${this.contact.phone1}</span>
722
+ </a>
723
+ ` : nothing}
724
+ ${this.contact.email ? html`
725
+ <a
726
+ href="mailto:${this.contact.email}"
727
+ class="contact-item"
728
+ aria-label="Email: ${this.contact.email}"
729
+ >
730
+ <pd-icon icon="mailIcon" class="contact-icon"></pd-icon>
731
+ <span>${this.contact.email}</span>
732
+ </a>
733
+ ` : nothing}
734
+ ${this.contact.website ? html`
735
+ <a
736
+ href="${this._ensureHttps(this.contact.website)}"
737
+ target="_blank"
738
+ rel="noopener noreferrer"
739
+ class="contact-item"
740
+ aria-label="Website: ${this.contact.website}"
741
+ >
742
+ <pd-icon icon="circleIcon" class="contact-icon"></pd-icon>
743
+ <span
744
+ >${this._formatWebsiteDisplay(this.contact.website)}</span
745
+ >
746
+ </a>
747
+ ` : nothing}
748
+ </div>
749
+
750
+ ${this.contact.btw || this.contact.kbc ? html`
751
+ <div class="detail-bank">
752
+ ${this.contact.btw ? html`
753
+ <p class="detail-label">BTW</p>
754
+ <p>${this.contact.btw}</p>
755
+ ` : nothing}
756
+ ${this.contact.kbc ? html`
757
+ <p class="detail-label">Bankgegevens</p>
758
+ <p>${this.contact.kbc}</p>
759
+ ${this.contact.bank ? html`<p>${this.contact.bank}</p>` : nothing}
760
+ ` : nothing}
761
+ </div>
762
+ ` : nothing}
763
+ ${this.contact.socialMedia && this.contact.socialMedia.length > 0 ? html`
764
+ <hr class="detail-divider" />
765
+ <pd-socialmedia
766
+ summary
767
+ .initItems="${this.contact.socialMedia}"
768
+ ></pd-socialmedia>
769
+ ` : nothing}
770
+ </div>
771
+ `;
772
+ }
773
+ // ========================================
774
+ // CARD VIEW RENDER METHODS
775
+ // ========================================
776
+ _renderCardView() {
777
+ if (!this.contact) return html`<p>Contact undefined</p>`;
778
+ const layoutClass = this.cardLayout !== "auto" ? `layout-${this.cardLayout}` : "";
779
+ return html`
780
+ <div class="card-wrapper" part="card-wrapper">
781
+ <div class="card ${layoutClass}">
782
+ ${this._renderCardLogo()}
783
+ <div class="card-content">
784
+ ${this._renderCardNames()} ${this._renderCardContactInfo()}
785
+ ${this._hasCardContactInfo() ? this._renderCardDivider() : nothing}
786
+ ${this._renderCardSocialMedia()}
787
+ </div>
788
+ </div>
789
+ </div>
433
790
  `;
434
791
  }
792
+ _renderCardLogo() {
793
+ if (!this.contact?.logo) return nothing;
794
+ return html`
795
+ <div class="card-logo">
796
+ <img
797
+ src="${this.contact.logo}"
798
+ alt="${this.contact.titleName || "Logo"}"
799
+ />
800
+ </div>
801
+ `;
802
+ }
803
+ _renderCardNames() {
804
+ const titleName = this.contact?.titleName;
805
+ const fullName = this._getFullName();
806
+ return html`
807
+ <div class="card-names">
808
+ ${titleName ? html`<h2 class="title-name">${titleName}</h2>` : nothing}
809
+ ${fullName ? html`<p class="real-name">${fullName}</p>` : nothing}
810
+ </div>
811
+ `;
812
+ }
813
+ _renderCardContactInfo() {
814
+ const phone = this.contact?.phone1;
815
+ const email = this.contact?.email;
816
+ const website = this.contact?.website;
817
+ const trPhoneNr = phone ? transformPhone(phone, this.contact?.country || "de") : "";
818
+ return html`
819
+ <div class="card-contact-info">
820
+ ${phone ? html`
821
+ <a
822
+ href="tel:${trPhoneNr || phone}"
823
+ class="contact-item"
824
+ aria-label="Phone: ${phone}"
825
+ >
826
+ <pd-icon icon="phoneIcon" class="contact-icon"></pd-icon>
827
+ <span>${phone}</span>
828
+ </a>
829
+ ` : nothing}
830
+ ${email ? html`
831
+ <a
832
+ href="mailto:${email}"
833
+ class="contact-item"
834
+ aria-label="Email: ${email}"
835
+ >
836
+ <pd-icon icon="mailIcon" class="contact-icon"></pd-icon>
837
+ <span>${email}</span>
838
+ </a>
839
+ ` : nothing}
840
+ ${website ? html`
841
+ <a
842
+ href="${this._ensureHttps(website)}"
843
+ target="_blank"
844
+ rel="noopener noreferrer"
845
+ class="contact-item"
846
+ aria-label="Website: ${website}"
847
+ >
848
+ <pd-icon icon="circleIcon" class="contact-icon"></pd-icon>
849
+ <span>${this._formatWebsiteDisplay(website)}</span>
850
+ </a>
851
+ ` : nothing}
852
+ </div>
853
+ `;
854
+ }
855
+ _renderCardDivider() {
856
+ return html`<hr class="card-divider" />`;
857
+ }
858
+ _renderCardSocialMedia() {
859
+ const socialItems = this.contact?.socialMedia;
860
+ if (!socialItems || socialItems.length === 0) return nothing;
861
+ return html`
862
+ <pd-socialmedia summary .initItems="${socialItems}"></pd-socialmedia>
863
+ `;
864
+ }
865
+ _hasCardContactInfo() {
866
+ return !!(this.contact?.phone1 || this.contact?.email || this.contact?.website);
867
+ }
868
+ _ensureHttps(url) {
869
+ if (!url) return "";
870
+ return /^https?:\/\//i.test(url) ? url : `https://${url}`;
871
+ }
872
+ _formatWebsiteDisplay(url) {
873
+ return url.replace(/^https?:\/\/(www\.)?/i, "").replace(/\/$/, "");
874
+ }
875
+ // ========================================
876
+ // FORM METHODS
877
+ // ========================================
435
878
  get valid() {
436
879
  return this._contactForm?.valid === true;
437
880
  }
@@ -440,7 +883,6 @@ const _PdContact = class _PdContact extends LitElement {
440
883
  }
441
884
  getValues() {
442
885
  const contactFormValues = this._contactForm?.getValues().origin;
443
- console.log("VAlues:", contactFormValues);
444
886
  const commonValues = {
445
887
  business: this._business,
446
888
  street: contactFormValues.street,
@@ -468,7 +910,6 @@ const _PdContact = class _PdContact extends LitElement {
468
910
  };
469
911
  }
470
912
  _switchAddressType(e) {
471
- console.log("Do switch", e);
472
913
  if (e.detail.name === "contactTypeRadioId") {
473
914
  this._business = e.detail.value === "business";
474
915
  }
@@ -523,6 +964,12 @@ __decorateClass([
523
964
  __decorateClass([
524
965
  property({ type: Boolean })
525
966
  ], _PdContact.prototype, "summary");
967
+ __decorateClass([
968
+ property({ type: String, reflect: true, attribute: "view-type" })
969
+ ], _PdContact.prototype, "viewType");
970
+ __decorateClass([
971
+ property({ type: String, reflect: true, attribute: "card-layout" })
972
+ ], _PdContact.prototype, "cardLayout");
526
973
  __decorateClass([
527
974
  property({ type: Boolean })
528
975
  ], _PdContact.prototype, "withPropertyDate");