@progressive-development/pd-page 0.0.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.
package/.editorconfig ADDED
@@ -0,0 +1,29 @@
1
+ # EditorConfig helps developers define and maintain consistent
2
+ # coding styles between different editors and IDEs
3
+ # editorconfig.org
4
+
5
+ root = true
6
+
7
+
8
+ [*]
9
+
10
+ # Change these settings to your own preference
11
+ indent_style = space
12
+ indent_size = 2
13
+
14
+ # We recommend you to keep these unchanged
15
+ end_of_line = lf
16
+ charset = utf-8
17
+ trim_trailing_whitespace = true
18
+ insert_final_newline = true
19
+
20
+ [*.md]
21
+ trim_trailing_whitespace = false
22
+
23
+ [*.json]
24
+ indent_size = 2
25
+
26
+ [*.{html,js,md}]
27
+ block_comment_start = /**
28
+ block_comment = *
29
+ block_comment_end = */
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ stories: ['../stories/**/*.stories.{js,md,mdx}'],
3
+ };
@@ -0,0 +1,8 @@
1
+ import { storybookPlugin } from '@web/dev-server-storybook';
2
+ import baseConfig from '../web-dev-server.config.mjs';
3
+
4
+ export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
5
+ ...baseConfig,
6
+ open: '/',
7
+ plugins: [storybookPlugin({ type: 'web-components' }), ...baseConfig.plugins],
8
+ });
package/LICENSE ADDED
@@ -0,0 +1,2 @@
1
+ No License, all rights reserved
2
+ @2021 - PD Progressive Development UG
package/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # \<pd-page>
2
+
3
+ This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm i pd-page
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```html
14
+ <script type="module">
15
+ import 'pd-page/pd-page.js';
16
+ </script>
17
+
18
+ <pd-page></pd-page>
19
+ ```
20
+
21
+ ## Linting and formatting
22
+
23
+ To scan the project for linting and formatting errors, run
24
+
25
+ ```bash
26
+ npm run lint
27
+ ```
28
+
29
+ To automatically fix linting and formatting errors, run
30
+
31
+ ```bash
32
+ npm run format
33
+ ```
34
+
35
+ ## Testing with Web Test Runner
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
+ ```
48
+
49
+ ## Demoing with Storybook
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
+ ```
75
+
76
+ To run a local development server that serves the basic demo located in `demo/index.html`
@@ -0,0 +1,29 @@
1
+ <!doctype html>
2
+ <html lang="en-GB">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <style>
6
+ body {
7
+ background: #fafafa;
8
+ }
9
+ </style>
10
+ </head>
11
+ <body>
12
+ <div id="demo"></div>
13
+
14
+ <script type="module">
15
+ import { html, render } from 'lit';
16
+ import '../pd-page.js';
17
+
18
+ const title = 'Hello owc World!';
19
+ render(
20
+ html`
21
+ <pd-page .title=${title}>
22
+ some light-dom
23
+ </pd-page>
24
+ `,
25
+ document.querySelector('#demo')
26
+ );
27
+ </script>
28
+ </body>
29
+ </html>
package/index.js ADDED
@@ -0,0 +1 @@
1
+ export { PdPage } from './src/PdPage.js';
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@progressive-development/pd-page",
3
+ "description": "Progressive development page helper, teaser, menu, footer.",
4
+ "license": "SEE LICENSE IN LICENSE",
5
+ "author": "PD Progressive Development",
6
+ "version": "0.0.1",
7
+ "main": "index.js",
8
+ "module": "index.js",
9
+ "scripts": {
10
+ "analyze": "cem analyze --litelement",
11
+ "start": "web-dev-server",
12
+ "lint": "eslint --ext .js,.html . --ignore-path .gitignore && prettier \"**/*.js\" --check --ignore-path .gitignore",
13
+ "format": "eslint --ext .js,.html . --fix --ignore-path .gitignore && prettier \"**/*.js\" --write --ignore-path .gitignore",
14
+ "test": "web-test-runner --coverage",
15
+ "test:watch": "web-test-runner --watch",
16
+ "storybook": "npm run analyze -- --exclude dist && web-dev-server -c .storybook/server.mjs",
17
+ "storybook:build": "npm run analyze -- --exclude dist && build-storybook"
18
+ },
19
+ "dependencies": {
20
+ "lit": "^2.0.2",
21
+ "@progressive-development/pd-contact": "0.0.2",
22
+ "@progressive-development/pd-forms": "0.0.13",
23
+ "@progressive-development/pd-dialog": "0.0.7",
24
+ "@progressive-development/pd-icon": "0.0.4"
25
+ },
26
+ "devDependencies": {
27
+ "@custom-elements-manifest/analyzer": "^0.4.17",
28
+ "@open-wc/eslint-config": "^4.3.0",
29
+ "@open-wc/testing": "next",
30
+ "@web/dev-server": "^0.1.25",
31
+ "@web/dev-server-storybook": "next",
32
+ "@web/test-runner": "^0.13.20",
33
+ "eslint": "^7.32.0",
34
+ "eslint-config-prettier": "^8.3.0",
35
+ "husky": "^4.3.8",
36
+ "lint-staged": "^10.5.4",
37
+ "prettier": "^2.4.1"
38
+ },
39
+ "customElements": "custom-elements.json",
40
+ "eslintConfig": {
41
+ "extends": [
42
+ "@open-wc",
43
+ "prettier"
44
+ ]
45
+ },
46
+ "prettier": {
47
+ "singleQuote": true,
48
+ "arrowParens": "avoid"
49
+ },
50
+ "husky": {
51
+ "hooks": {
52
+ "pre-commit": "lint-staged"
53
+ }
54
+ },
55
+ "lint-staged": {
56
+ "*.js": [
57
+ "eslint --fix",
58
+ "prettier --write"
59
+ ]
60
+ },
61
+ "keywords": [
62
+ "pd",
63
+ "progressive",
64
+ "development",
65
+ "menu",
66
+ "footer",
67
+ "teaser"
68
+ ]
69
+ }
@@ -0,0 +1,3 @@
1
+ import { PdContactUs } from './src/PdContactUs.js';
2
+
3
+ window.customElements.define('pd-contact-us', PdContactUs);
package/pd-footer.js ADDED
@@ -0,0 +1,3 @@
1
+ import { PdFooter } from './src/PdFooter.js';
2
+
3
+ window.customElements.define('pd-footer', PdFooter);
package/pd-menu.js ADDED
@@ -0,0 +1,3 @@
1
+ import { PdMenu } from './src/PdMenu.js';
2
+
3
+ window.customElements.define('pd-menu', PdMenu);
package/pd-teaser.js ADDED
@@ -0,0 +1,5 @@
1
+ import { PdTeaser } from './src/PdTeaser.js';
2
+ import { PdTeaserContent } from './src/PdTeaserContent.js';
3
+
4
+ window.customElements.define('pd-teaser', PdTeaser);
5
+ window.customElements.define('pd-teaser-content', PdTeaserContent);
@@ -0,0 +1,267 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
4
+ */
5
+
6
+ import { LitElement, html, css } from 'lit';
7
+
8
+ import '@progressive-development/pd-forms/PdButton.js';
9
+ import '@progressive-development/pd-forms/PdFormContainer.js';
10
+ import '@progressive-development/pd-forms/PdFormRow.js';
11
+ import '@progressive-development/pd-forms/PdInput.js';
12
+ import '@progressive-development/pd-forms/PdInputArea.js';
13
+ import '@progressive-development/pd-contact/pd-contact.js';
14
+
15
+ /**
16
+ * An example element.
17
+ *
18
+ * @slot - This element has a slot
19
+ * @csspart button - The button
20
+ */
21
+ export class PdContactUs extends LitElement {
22
+ /**
23
+ * Fired when free date clicked => At the moment only for freeDates
24
+ * @event send-contact-request
25
+ */
26
+
27
+ static get styles() {
28
+ return css`
29
+ :host {
30
+ --my-background-color: var(--squi-test, #177e89);
31
+ --my-text-color: var(--squi-test, white);
32
+ --my-background-img: var(
33
+ --squi-bg-image,
34
+ url('/images/contact_bg.svg')
35
+ );
36
+
37
+ display: flex;
38
+ flex-flow: row;
39
+ background-color: var(--my-background-color);
40
+
41
+ background-image: var(--my-background-img);
42
+ background-repeat: no-repeat;
43
+
44
+ min-height: 500px; /* Temporär hier... */
45
+ width: 100%;
46
+ }
47
+
48
+ h1,
49
+ h2,
50
+ h3,
51
+ h4 {
52
+ font-family: var(--my-primary-font, 'Oswald');
53
+ font-style: normal;
54
+ color: #fefefe;
55
+ margin: 0;
56
+ padding: 0;
57
+ }
58
+
59
+ h2 {
60
+ line-height: 1.4;
61
+ margin-top: 1.4em;
62
+ margin-bottom: 2.5rem;
63
+ font-size: 2.5rem;
64
+ }
65
+
66
+ p {
67
+ margin-bottom: 1rem;
68
+ line-height: 1.5;
69
+ text-rendering: optimizeLegibility;
70
+ margin: 0;
71
+ padding: 0;
72
+
73
+ color: #323031;
74
+ font-size: 1.1rem;
75
+ }
76
+
77
+ .content-block {
78
+ display: flex;
79
+ flex-direction: column;
80
+ align-items: left;
81
+ justify-content: flex-start;
82
+ flex-grow: 1;
83
+ max-width: 1170px;
84
+ margin: 0 auto;
85
+ text-align: left;
86
+ padding-left: 10px;
87
+ }
88
+
89
+ .contact-block {
90
+ display: flex;
91
+ flex-wrap: wrap;
92
+ padding-bottom: 50px;
93
+ }
94
+
95
+ .left-content {
96
+ width: 30%;
97
+ min-width: 230px;
98
+ }
99
+
100
+ .right-content {
101
+ width: 70%;
102
+ }
103
+
104
+ .company-contact {
105
+ --squi-addrress-txt-color: #fefefe;
106
+ }
107
+
108
+ /* Size Elements for small width */
109
+ @media (max-width: 440px) {
110
+ .item {
111
+ display: none;
112
+ }
113
+ ul {
114
+ justify-content: left;
115
+ }
116
+ }
117
+ `;
118
+ }
119
+
120
+ static get properties() {
121
+ return {
122
+ contact: { type: Object },
123
+ _errorMap: { type: Object },
124
+ };
125
+ }
126
+
127
+ constructor() {
128
+ super();
129
+
130
+ this.contact = {};
131
+ this._errorMap = new Map();
132
+ }
133
+
134
+ firstUpdated() {
135
+ this.addEventListener('key-pressed', e => {
136
+ this._errorMap.set(e.detail.name, '');
137
+ super.requestUpdate();
138
+ });
139
+ }
140
+
141
+ render() {
142
+ return html`
143
+ <div class="content-block">
144
+ <h2>Contacteer ons</h2>
145
+
146
+ <div class="contact-block">
147
+ <div class="left-content">
148
+ <pd-contact
149
+ class="company-contact"
150
+ .contact="${this.contact}"
151
+ summary
152
+ ></pd-contact>
153
+ </div>
154
+
155
+ <div class="right-content">
156
+ <squi-form-container>
157
+ <squi-form-row>
158
+ <squi-input
159
+ id="nameInputId"
160
+ class="quarter3"
161
+ placeHolder="Naam"
162
+ valueName="name"
163
+ errorMsg="${this._getErrorMsg('name')}"
164
+ ></squi-input>
165
+ </squi-form-row>
166
+
167
+ <squi-form-row>
168
+ <squi-input
169
+ id="mailInputId"
170
+ class="quarter3"
171
+ placeHolder="Email"
172
+ valueName="mail"
173
+ errorMsg="${this._getErrorMsg('mail')}"
174
+ ></squi-input>
175
+ </squi-form-row>
176
+
177
+ <squi-form-row>
178
+ <squi-input
179
+ id="phoneInputId"
180
+ class="quarter3"
181
+ placeHolder="Telefoon Nummer"
182
+ valueName="phone"
183
+ errorMsg="${this._getErrorMsg('phone')}"
184
+ ></squi-input>
185
+ </squi-form-row>
186
+
187
+ <squi-form-row>
188
+ <squi-input-area
189
+ id="msgInputId"
190
+ class="quarter3-area"
191
+ placeHolder="Type uw bericht hier"
192
+ rows="15"
193
+ valueName="msg"
194
+ errorMsg="${this._getErrorMsg('msg')}"
195
+ ></squi-input-area>
196
+ </squi-form-row>
197
+ </squi-form-container>
198
+
199
+ <squi-button
200
+ text="Verzenden"
201
+ @click="${this._sendMail}"
202
+ ></squi-button>
203
+ </div>
204
+ </div>
205
+ </div>
206
+ `;
207
+ }
208
+
209
+ clear() {
210
+ this.shadowRoot.getElementById('nameInputId').clear();
211
+ this.shadowRoot.getElementById('mailInputId').clear();
212
+ this.shadowRoot.getElementById('phoneInputId').clear();
213
+ this.shadowRoot.getElementById('msgInputId').clear();
214
+ }
215
+
216
+ _sendMail() {
217
+ // get inpus
218
+ const name = this.shadowRoot.getElementById('nameInputId').value;
219
+ const email = this.shadowRoot.getElementById('mailInputId').value;
220
+ const phone = this.shadowRoot.getElementById('phoneInputId').value;
221
+ const msg = this.shadowRoot.getElementById('msgInputId').value;
222
+
223
+ const newErrorMap = new Map();
224
+ if (!name || name === '') {
225
+ newErrorMap.set('name', 'Verplicht veld');
226
+ }
227
+ if (!email || email === '') {
228
+ newErrorMap.set('mail', 'Verplicht veld');
229
+ } else if (!PdContactUs._mailIsValid(email)) {
230
+ newErrorMap.set('mail', 'Invalid address');
231
+ }
232
+ if (!phone || phone === '') {
233
+ newErrorMap.set('phone', 'Verplicht veld');
234
+ } else if (!PdContactUs._phoneIsValid(phone)) {
235
+ newErrorMap.set('phone', 'Invalid phone number');
236
+ }
237
+ if (!msg || msg === '') {
238
+ newErrorMap.set('msg', 'Verplicht veld');
239
+ }
240
+
241
+ this._errorMap = newErrorMap;
242
+ if (newErrorMap.size === 0) {
243
+ this.dispatchEvent(
244
+ new CustomEvent('send-contact-request', {
245
+ detail: {
246
+ msgObj: { name, email, phone, msg },
247
+ },
248
+ })
249
+ );
250
+ }
251
+ }
252
+
253
+ _getErrorMsg(itemId) {
254
+ return this._errorMap.get(itemId) || '';
255
+ }
256
+
257
+ static _mailIsValid(email) {
258
+ const mValid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
259
+ return mValid;
260
+ }
261
+
262
+ static _phoneIsValid(phone) {
263
+ // Valid +49 830 9001 | 49 221 123 | 08912379
264
+ const mValid = /^\+?[0-9 ]{7,15}$/.test(phone);
265
+ return mValid;
266
+ }
267
+ }
@@ -0,0 +1,186 @@
1
+ /* eslint-disable lit-a11y/anchor-is-valid */
2
+ /**
3
+ * @license
4
+ * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
5
+ */
6
+
7
+ import { LitElement, html, css } from 'lit';
8
+
9
+ import '@progressive-development/pd-dialog/pd-popup.js';
10
+
11
+ /**
12
+ * An example element.
13
+ *
14
+ * @slot - This element has a slot
15
+ * @csspart button - The button
16
+ */
17
+ export class PdFooter extends LitElement {
18
+ /**
19
+ * Fired when free date clicked => At the moment only for freeDates
20
+ * @event book-date
21
+ */
22
+
23
+ static get styles() {
24
+ return css`
25
+ :host {
26
+ --my-height: var(--squi-teaser-height, 130px);
27
+
28
+ --my-header-background-color: var(--squi-test, #084c61);
29
+ --my-header-text-color: var(--squi-test, white);
30
+
31
+ --my-background: var(--squi-teaser-image, url('/images/hero_1.svg'));
32
+
33
+ --my-footer-background-color: var(--squi-test, #2bcadb);
34
+
35
+ display: flex;
36
+ flex-flow: row;
37
+ justify-content: space-between;
38
+ background-color: #10565d; /*#177e89;/* #084c61;*/
39
+ height: var(--my-height);
40
+ width: 100%;
41
+ }
42
+
43
+ h1,
44
+ h2,
45
+ h3,
46
+ h4 {
47
+ font-family: var(--my-primary-font, 'Oswald');
48
+ font-style: normal;
49
+ margin: 0;
50
+ padding: 0;
51
+ }
52
+
53
+ .left-content {
54
+ width: 50%;
55
+ padding-left: 30px;
56
+ align-self: flex-end;
57
+ height: calc(var(--my-height) / 1.4);
58
+ }
59
+
60
+ .right-content {
61
+ width: 50%;
62
+ padding-right: 30px;
63
+ }
64
+
65
+ .right-content ul {
66
+ display: flex;
67
+ justify-content: flex-end;
68
+ list-style: none;
69
+ margin-top: 0px;
70
+ margin-bottom: 0px;
71
+ height: 100%;
72
+ }
73
+
74
+ .right-content li {
75
+ display: flex;
76
+ align-items: center;
77
+ padding: 0rem 1rem;
78
+ height: 100%;
79
+ }
80
+
81
+ .item,
82
+ .right-content p,
83
+ .left-content p {
84
+ color: #2bcadb;
85
+ font-size: 1.1rem;
86
+ }
87
+
88
+ .version {
89
+ color: #9fbdc0;
90
+ font-style: italic;
91
+ font-size: 0.9rem;
92
+ }
93
+
94
+ .item a:hover {
95
+ color: #ffc857;
96
+ cursor: pointer;
97
+ /*border-bottom: 1px solid #ffc857;*/
98
+ }
99
+
100
+ .logo {
101
+ max-width: 6rem;
102
+ padding-right: 10px;
103
+ }
104
+
105
+ /* Size Elements for small width */
106
+ @media (max-width: 440px) {
107
+ .item {
108
+ display: none;
109
+ }
110
+ ul {
111
+ justify-content: left;
112
+ }
113
+ }
114
+ `;
115
+ }
116
+
117
+ static get properties() {
118
+ return {
119
+ logo: { type: Object },
120
+ agb: { type: Object },
121
+ privacy: { type: Object },
122
+ version: { type: Object },
123
+ };
124
+ }
125
+
126
+ constructor() {
127
+ super();
128
+ this.logo = undefined;
129
+ this.agb = undefined;
130
+ this.privacy = undefined;
131
+ this.version = undefined;
132
+ }
133
+
134
+ firstUpdated() {}
135
+
136
+ render() {
137
+ return html`
138
+ <div class="left-content">
139
+ <p>
140
+ © ticomi technics ${this.logo} <br /><span class="version"
141
+ >${this.version}</span
142
+ >
143
+ </p>
144
+ </div>
145
+
146
+ <div class="right-content">
147
+ <ul>
148
+ <li class="item">
149
+ <a
150
+ @keypress="${() => {
151
+ console.log();
152
+ }}"
153
+ @click="${this._legalClicked}"
154
+ >Verkoopvoorwaarden</a
155
+ >
156
+ </li>
157
+ <li class="item">
158
+ <a
159
+ @keypress="${() => {
160
+ console.log();
161
+ }}"
162
+ @click="${this._policyClicked}"
163
+ >Privacy</a
164
+ >
165
+ </li>
166
+ </ul>
167
+ </div>
168
+
169
+ <pd-popup id="legalPopupId">
170
+ <div slot="content">${this.agb}</div>
171
+ </pd-popup>
172
+
173
+ <pd-popup id="privacyPopupId">
174
+ <div slot="content">${this.privacy}</div>
175
+ </pd-popup>
176
+ `;
177
+ }
178
+
179
+ _legalClicked() {
180
+ this.shadowRoot.getElementById('legalPopupId').showPopup();
181
+ }
182
+
183
+ _policyClicked() {
184
+ this.shadowRoot.getElementById('privacyPopupId').showPopup();
185
+ }
186
+ }