@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.
- package/LICENSE +21 -2
- package/README.md +29 -56
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/pd-contact/PdContact.d.ts +39 -24
- package/dist/pd-contact/PdContact.d.ts.map +1 -1
- package/dist/pd-contact/PdContact.js +521 -74
- package/dist/pd-contact/pd-contact-edit.stories.d.ts +51 -16
- package/dist/pd-contact/pd-contact-edit.stories.d.ts.map +1 -1
- package/dist/pd-contact/pd-contact-view.stories.d.ts +53 -11
- package/dist/pd-contact/pd-contact-view.stories.d.ts.map +1 -1
- package/dist/pd-page/dist/pd-socialmedia/PdSocialmedia.js +426 -0
- package/dist/pd-page/dist/pd-socialmedia/pd-socialmedia-model.js +240 -0
- package/dist/pd-page/dist/pd-socialmedia.js +7 -0
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -6
package/LICENSE
CHANGED
|
@@ -1,2 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021-present PD Progressive Development UG
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,76 +1,49 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @progressive-development/pd-contact
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@progressive-development/pd-contact)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
Contact form and address display component for managing personal and business contacts.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- **Lit 3 & TypeScript** – Modern, type-safe web components
|
|
11
|
+
- **Accessible** – WCAG 2.1 compliant, keyboard navigation, ARIA support
|
|
12
|
+
- **Themeable** – CSS Custom Properties for easy customization
|
|
13
|
+
- **Localized** – Built-in i18n support (EN, DE, BE)
|
|
14
|
+
- **Lightweight** – No heavy dependencies, tree-shakeable
|
|
15
|
+
- **Framework-agnostic** – Works with React, Vue, Angular, or vanilla JS
|
|
16
|
+
- **Dual Contact Types** – Switch between personal and business contacts with automatic field adaptation
|
|
17
|
+
- **Flexible Field Configuration** – Control visible and required fields via simple arrays
|
|
18
|
+
- **Smart Phone Normalization** – Auto-transforms local phone numbers to international format based on country
|
|
19
|
+
- **Edit & View Modes** – Same component for form input and formatted address display with clickable links
|
|
4
20
|
|
|
5
21
|
## Installation
|
|
6
22
|
|
|
7
23
|
```bash
|
|
8
|
-
npm
|
|
24
|
+
npm install @progressive-development/pd-contact
|
|
9
25
|
```
|
|
10
26
|
|
|
11
|
-
##
|
|
27
|
+
## Quick Start
|
|
12
28
|
|
|
13
29
|
```html
|
|
14
30
|
<script type="module">
|
|
15
|
-
import '
|
|
31
|
+
import '@progressive-development/pd-contact';
|
|
16
32
|
</script>
|
|
17
33
|
|
|
18
34
|
<pd-contact></pd-contact>
|
|
19
35
|
```
|
|
20
36
|
|
|
21
|
-
##
|
|
37
|
+
## Components
|
|
22
38
|
|
|
23
|
-
|
|
39
|
+
| Component | Description |
|
|
40
|
+
|-----------|-------------|
|
|
41
|
+
| `<pd-contact>` | Contact form with edit and view modes |
|
|
24
42
|
|
|
25
|
-
|
|
26
|
-
npm run lint
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
To automatically fix linting and formatting errors, run
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
npm run format
|
|
33
|
-
```
|
|
43
|
+
## Documentation
|
|
34
44
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
To execute a single test run:
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npm run test
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
To run the tests in interactive watch mode run:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
npm run test:watch
|
|
47
|
-
```
|
|
45
|
+
📖 **Full documentation:** [pd-components.web.app](https://pd-components.web.app/)
|
|
48
46
|
|
|
49
|
-
##
|
|
50
|
-
|
|
51
|
-
To run a local instance of Storybook for your component, run
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
npm run storybook
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
To build a production version of Storybook, run
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
npm run storybook:build
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
## Tooling configs
|
|
65
|
-
|
|
66
|
-
For most of the tools, the configuration is in the `package.json` to minimize the amount of files in your project.
|
|
67
|
-
|
|
68
|
-
If you customize the configuration a lot, you can consider moving them to individual files.
|
|
69
|
-
|
|
70
|
-
## Local Demo with `web-dev-server`
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
npm start
|
|
74
|
-
```
|
|
47
|
+
## License
|
|
75
48
|
|
|
76
|
-
|
|
49
|
+
MIT © [PD Progressive Development UG](https://progressive-development.com)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { PdContact } from './pd-contact/pd-contact.js';
|
|
2
|
-
export type { PdContactData, PdContactFormOptions, PdContactMatch, C_ADDITIONAL, C_BTWNR, C_CITY, C_COMPANY, C_EMAIL, C_FIRSTNAME, C_LASTNAME, C_PHONE1, C_PROPERTY_DATE, C_STREET, C_STREET_NR, C_TYPE, C_ZIP, } from './types.js';
|
|
2
|
+
export type { PdContactData, PdContactFormOptions, PdContactMatch, SocialEntry, C_ADDITIONAL, C_BTWNR, C_CITY, C_COMPANY, C_EMAIL, C_FIRSTNAME, C_LASTNAME, C_LOGO, C_PHONE1, C_PROPERTY_DATE, C_SOCIAL_MEDIA, C_STREET, C_STREET_NR, C_TITLE_NAME, C_TYPE, C_WEBSITE, C_ZIP, } from './types.js';
|
|
3
3
|
export { templates as beTemplates } from './generated/locales/be.js';
|
|
4
4
|
export { templates as deTemplates } from './generated/locales/de.js';
|
|
5
5
|
export { templates as enTemplates } from './generated/locales/en.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,YAAY,EACZ,OAAO,EACP,MAAM,EACN,SAAS,EACT,OAAO,EACP,WAAW,EACX,UAAU,EACV,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,WAAW,EACX,MAAM,EACN,KAAK,GACN,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,YAAY,EACZ,OAAO,EACP,MAAM,EACN,SAAS,EACT,OAAO,EACP,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,eAAe,EACf,cAAc,EACd,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,MAAM,EACN,SAAS,EACT,KAAK,GACN,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -1,46 +1,52 @@
|
|
|
1
1
|
import { LitElement, PropertyValues, CSSResultGroup } from 'lit';
|
|
2
2
|
import { PdContactData, PdContactMatch } from '../types';
|
|
3
3
|
/**
|
|
4
|
+
* Contact component for displaying and editing contact information.
|
|
5
|
+
*
|
|
4
6
|
* @tagname pd-contact
|
|
7
|
+
* @summary Contact form/view with private/business support and validation.
|
|
8
|
+
*
|
|
9
|
+
* @csspart card-wrapper - Outer container for the card view layout, provides container query context.
|
|
10
|
+
*
|
|
11
|
+
* @cssprop --pd-contact-address-col - Text color for address content. Default: `var(--pd-default-font-content-col)`.
|
|
12
|
+
* @cssprop --pd-contact-address-title-col - Text color for address title. Default: `var(--pd-default-font-title-col)`.
|
|
13
|
+
* @cssprop --pd-contact-icon-col - Icon fill color. Default: `var(--pd-default-col)`.
|
|
14
|
+
* @cssprop --pd-contact-card-bg - Card view background color. Default: `var(--pd-default-bg-col)`.
|
|
15
|
+
* @cssprop --pd-contact-card-divider-col - Card divider line color. Default: `var(--pd-default-disabled-light-col)`.
|
|
16
|
+
* @cssprop --pd-contact-card-padding - Card inner padding. Default: `2rem`.
|
|
17
|
+
* @cssprop --pd-contact-card-radius - Card border radius. Default: `var(--pd-radius-lg)`.
|
|
18
|
+
* @cssprop --pd-contact-card-shadow - Card box shadow. Default: `var(--pd-shadow-xl)`.
|
|
19
|
+
* @cssprop --pd-contact-card-subtitle-col - Card subtitle (real name) text color. Default: `var(--pd-default-font-muted-col)`.
|
|
20
|
+
* @cssprop --pd-contact-card-title-col - Card title (display name) text color. Default: `var(--pd-default-font-title-col)`.
|
|
5
21
|
*/
|
|
6
22
|
export declare class PdContact extends LitElement {
|
|
7
|
-
/**
|
|
8
|
-
* Title shown above address block.
|
|
9
|
-
*/
|
|
23
|
+
/** Title shown above address block. */
|
|
10
24
|
addressTitle: string;
|
|
11
|
-
/**
|
|
12
|
-
* If true, phone and email are rendered as clickable links with icons.
|
|
13
|
-
*/
|
|
25
|
+
/** Render phone and email as clickable links with icons. */
|
|
14
26
|
phoneMailLink: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* If true, render only summary view instead of full editable form.
|
|
17
|
-
*/
|
|
27
|
+
/** Render only summary view instead of full editable form. */
|
|
18
28
|
summary: boolean;
|
|
19
|
-
/**
|
|
20
|
-
|
|
29
|
+
/** View type: 'detail' shows existing behavior, 'card' shows business card. */
|
|
30
|
+
viewType: "detail" | "card";
|
|
31
|
+
/** Layout mode for card view. */
|
|
32
|
+
cardLayout: "auto" | "horizontal" | "vertical";
|
|
33
|
+
/** Show property date selection field.
|
|
21
34
|
* TODO: Refactor, give selectable property dates from outside, show if set
|
|
22
35
|
*/
|
|
23
36
|
withPropertyDate: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* List of required input field keys (optional).
|
|
26
|
-
*/
|
|
37
|
+
/** List of required input field keys. */
|
|
27
38
|
requiredFields: string[];
|
|
28
|
-
/**
|
|
29
|
-
* List of fields to be rendered (optional).
|
|
30
|
-
*/
|
|
39
|
+
/** List of fields to be rendered (empty = all fields). */
|
|
31
40
|
inputFields: string[];
|
|
32
|
-
/**
|
|
33
|
-
* Contact object to show or edit.
|
|
34
|
-
*/
|
|
41
|
+
/** Contact data object to show or edit. */
|
|
35
42
|
contact?: PdContactData;
|
|
36
|
-
/**
|
|
37
|
-
* Optional location match data.
|
|
38
|
-
*/
|
|
43
|
+
/** Optional location match data for auto-fill. */
|
|
39
44
|
match?: PdContactMatch;
|
|
40
45
|
/**
|
|
41
46
|
* Business or private contact (internal flag).
|
|
42
|
-
*/
|
|
47
|
+
* @ignore */
|
|
43
48
|
private _business;
|
|
49
|
+
/** @ignore */
|
|
44
50
|
private _contactForm;
|
|
45
51
|
static styles: CSSResultGroup;
|
|
46
52
|
willUpdate(changedProps: PropertyValues<this>): void;
|
|
@@ -48,6 +54,15 @@ export declare class PdContact extends LitElement {
|
|
|
48
54
|
private _renderEditContact;
|
|
49
55
|
private _getRadioValue;
|
|
50
56
|
private _renderViewContact;
|
|
57
|
+
private _renderCardView;
|
|
58
|
+
private _renderCardLogo;
|
|
59
|
+
private _renderCardNames;
|
|
60
|
+
private _renderCardContactInfo;
|
|
61
|
+
private _renderCardDivider;
|
|
62
|
+
private _renderCardSocialMedia;
|
|
63
|
+
private _hasCardContactInfo;
|
|
64
|
+
private _ensureHttps;
|
|
65
|
+
private _formatWebsiteDisplay;
|
|
51
66
|
get valid(): boolean;
|
|
52
67
|
triggerValidate(): Promise<boolean>;
|
|
53
68
|
getValues(): PdContactData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PdContact.d.ts","sourceRoot":"","sources":["../../src/pd-contact/PdContact.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,c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