@progressive-development/pd-dialog 0.1.83 → 0.5.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/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ import { PdPopup } from "./src/PdPopup.js";
2
+ import { PdPopupDialog } from "./src/PdPopupDialog.js";
3
+ import { PdSubmitDialog, STATUS_SEND, STATUS_SEND_FAILED, STATUS_SEND_SUCCESS } from "./src/PdSubmitDialog.js";
4
+ import { templates } from "./locales/be.js";
5
+ import { templates as templates2 } from "./locales/de.js";
6
+ import { templates as templates3 } from "./locales/en.js";
7
+ export {
8
+ PdPopup,
9
+ PdPopupDialog,
10
+ PdSubmitDialog,
11
+ STATUS_SEND,
12
+ STATUS_SEND_FAILED,
13
+ STATUS_SEND_SUCCESS,
14
+ templates as beTemplates,
15
+ templates2 as deTemplates,
16
+ templates3 as enTemplates
17
+ };
@@ -0,0 +1,7 @@
1
+ const templates = {
2
+ "pd.submit.dialog.closeStay": `Bewerk gegevens`,
3
+ "pd.submit.dialog.startPage": `Naar startpagina`
4
+ };
5
+ export {
6
+ templates
7
+ };
@@ -0,0 +1,7 @@
1
+ const templates = {
2
+ "pd.submit.dialog.closeStay": `Daten bearbeiten`,
3
+ "pd.submit.dialog.startPage": `Zur Startseite`
4
+ };
5
+ export {
6
+ templates
7
+ };
@@ -0,0 +1,7 @@
1
+ const templates = {
2
+ "pd.submit.dialog.closeStay": `Edit data`,
3
+ "pd.submit.dialog.startPage": `Go to homepage`
4
+ };
5
+ export {
6
+ templates
7
+ };
@@ -0,0 +1,4 @@
1
+ import { PdPopupDialog } from "./src/PdPopupDialog.js";
2
+ if (!customElements.get("pd-popup-dialog")) {
3
+ window.customElements.define("pd-popup-dialog", PdPopupDialog);
4
+ }
@@ -0,0 +1,4 @@
1
+ import { PdPopup } from "./src/PdPopup.js";
2
+ if (!customElements.get("pd-popup")) {
3
+ window.customElements.define("pd-popup", PdPopup);
4
+ }
@@ -0,0 +1,4 @@
1
+ import { PdSubmitDialog } from "./src/PdSubmitDialog.js";
2
+ if (!customElements.get("pd-submit-dialog")) {
3
+ window.customElements.define("pd-submit-dialog", PdSubmitDialog);
4
+ }
@@ -1,24 +1,12 @@
1
+ import { LitElement, css, html } from "lit";
2
+ import { ICON_CLOSE } from "@progressive-development/pd-icon";
3
+ import "@progressive-development/pd-icon/pd-icon";
4
+ import { PDColorStyles } from "@progressive-development/pd-shared-styles";
1
5
  /**
2
6
  * @license
3
7
  * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
4
8
  */
5
-
6
- import { LitElement, html, css } from 'lit';
7
- import { ICON_CLOSE as CLOSEICON } from '@progressive-development/pd-icon/src/PdIcon.js';
8
-
9
- import '@progressive-development/pd-icon/pd-icon.js';
10
-
11
- import { PDColorStyles } from '@progressive-development/pd-shared-styles';
12
-
13
-
14
-
15
- /**
16
- * An example element.
17
- *
18
- * @slot - This element has a slot
19
- * @csspart button - The button
20
- */
21
- export class PdPopup extends LitElement {
9
+ class PdPopup extends LitElement {
22
10
  static get styles() {
23
11
  return [
24
12
  PDColorStyles,
@@ -68,9 +56,8 @@ export class PdPopup extends LitElement {
68
56
  right: 1.2em;
69
57
  top: 1.2em;
70
58
  }`
71
- ];
59
+ ];
72
60
  }
73
-
74
61
  render() {
75
62
  return html`
76
63
  <!-- Trigger/Open The Modal -->
@@ -82,7 +69,7 @@ export class PdPopup extends LitElement {
82
69
  <div id="modalId" class="modal">
83
70
  <!-- Modal content -->
84
71
  <div class="modal-content">
85
- <pd-icon icon="${CLOSEICON}" class="close-icon"
72
+ <pd-icon icon="${ICON_CLOSE}" class="close-icon"
86
73
  @click="${this._closePopup}"></pd-icon>
87
74
  <div class="modal-content-slot">
88
75
  <slot name="content"></slot>
@@ -91,40 +78,35 @@ export class PdPopup extends LitElement {
91
78
  </div>
92
79
  `;
93
80
  }
94
-
95
81
  showPopup() {
96
82
  this._activatePopup();
97
83
  }
98
-
99
84
  hidePopup() {
100
85
  this._closePopup();
101
86
  }
102
-
103
87
  _activatePopup() {
104
- // $('.hover_bkgr_fricc').show();
105
- const modal = this.shadowRoot.getElementById('modalId');
106
- modal.style.display = 'block';
88
+ const modal = this.shadowRoot.getElementById("modalId");
89
+ modal.style.display = "block";
107
90
  }
108
-
109
91
  _closePopup() {
110
- // $('.hover_bkgr_fricc').hide();
111
- const modal = this.shadowRoot.getElementById('modalId');
112
- modal.style.display = 'none';
113
-
92
+ const modal = this.shadowRoot.getElementById("modalId");
93
+ modal.style.display = "none";
114
94
  this.dispatchEvent(
115
- new CustomEvent('popup-close', {
95
+ new CustomEvent("popup-close", {
116
96
  bubbles: true,
117
97
  composed: true
118
98
  })
119
99
  );
120
100
  }
121
-
122
101
  /*
123
- // When the user clicks anywhere outside of the modal, close it
124
- window.onclick = function(event) {
125
- if (event.target == modal) {
126
- modal.style.display = "none";
102
+ // When the user clicks anywhere outside of the modal, close it
103
+ window.onclick = function(event) {
104
+ if (event.target == modal) {
105
+ modal.style.display = "none";
106
+ }
127
107
  }
108
+ */
128
109
  }
129
- */
130
- }
110
+ export {
111
+ PdPopup
112
+ };
@@ -1,28 +1,18 @@
1
+ import { LitElement, css, html } from "lit";
2
+ import "@progressive-development/pd-forms/pd-button";
3
+ import { PDColorStyles, PDFontStyles } from "@progressive-development/pd-shared-styles";
1
4
  /**
2
5
  * @license
3
6
  * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
4
7
  */
5
-
6
- import { LitElement, html, css } from 'lit';
7
-
8
- import '@progressive-development/pd-forms/pd-button.js';
9
-
10
- import { PDColorStyles, PDFontStyles } from '@progressive-development/pd-shared-styles';
11
-
12
- /**
13
- * An example element.
14
- *
15
- * @slot - This element has a slot
16
- * @csspart button - The button
17
- */
18
- export class PdPopupDialog extends LitElement {
8
+ class PdPopupDialog extends LitElement {
19
9
  /**
20
10
  * @event submit-button-clicked - fired if one of the configured buttons was clicked.
21
11
  */
22
-
23
12
  static get styles() {
24
13
  return [
25
- PDColorStyles, PDFontStyles,
14
+ PDColorStyles,
15
+ PDFontStyles,
26
16
  css`
27
17
  :host {
28
18
  display: block;
@@ -103,24 +93,22 @@ export class PdPopupDialog extends LitElement {
103
93
  align-items: center;
104
94
  justify-content: space-around;
105
95
  }
106
- `];
96
+ `
97
+ ];
107
98
  }
108
-
109
99
  static get properties() {
110
100
  return {
111
101
  type: { type: String },
112
102
  title: { type: String },
113
- buttons: { type: Array },
103
+ buttons: { type: Array }
114
104
  };
115
105
  }
116
-
117
106
  constructor() {
118
107
  super();
119
- this.type = 'info';
120
- this.title = 'Popup Title';
108
+ this.type = "info";
109
+ this.title = "Popup Title";
121
110
  this.buttons = [];
122
111
  }
123
-
124
112
  render() {
125
113
  return html`
126
114
  <!-- The Modal -->
@@ -136,7 +124,7 @@ export class PdPopupDialog extends LitElement {
136
124
  </div>
137
125
  <div class="footer">
138
126
  ${this.buttons.map(
139
- bt => html`
127
+ (bt) => html`
140
128
  <pd-button
141
129
  data-key="${bt.key}"
142
130
  @button-clicked="${this._handleButtonEvent}"
@@ -145,61 +133,56 @@ export class PdPopupDialog extends LitElement {
145
133
  text="${bt.name}"
146
134
  ></pd-button>
147
135
  `
148
- )}
136
+ )}
149
137
  </div>
150
138
  </div>
151
139
  </div>
152
140
  `;
153
141
  }
154
-
155
142
  _handleButtonEvent(e) {
156
143
  this.dispatchEvent(
157
- new CustomEvent('submit-button-clicked', {
144
+ new CustomEvent("submit-button-clicked", {
158
145
  detail: {
159
- button: e.target.dataset.key,
160
- },
146
+ button: e.target.dataset.key
147
+ }
161
148
  })
162
149
  );
163
150
  }
164
-
165
151
  _getIconForType() {
166
152
  if (!this.type || this.type === "") {
167
153
  return "";
168
154
  }
169
155
  switch (this.type) {
170
- case 'warn':
156
+ case "warn":
171
157
  return html`<pd-icon icon="warningIconFld" class="info-logo warn"></pd-icon>`;
172
- case 'error':
158
+ case "error":
173
159
  return html`<pd-icon icon="errorIconFld" class="info-logo error"></pd-icon>`;
174
- case 'help':
160
+ case "help":
175
161
  return html`<pd-icon icon="helpIconFld" class="info-logo help"></pd-icon>`;
176
162
  default:
177
163
  return html`<pd-icon icon="infoIconFld" class="info-logo info"></pd-icon>`;
178
164
  }
179
165
  }
180
-
181
166
  showPopup() {
182
167
  this._activatePopup();
183
168
  }
184
-
185
169
  _activatePopup() {
186
- // $('.hover_bkgr_fricc').show();
187
- const modal = this.shadowRoot.getElementById('modalId');
188
- modal.style.display = 'block';
170
+ const modal = this.shadowRoot.getElementById("modalId");
171
+ modal.style.display = "block";
189
172
  }
190
-
191
173
  _closePopup() {
192
- // $('.hover_bkgr_fricc').hide();
193
- const modal = this.shadowRoot.getElementById('modalId');
194
- modal.style.display = 'none';
174
+ const modal = this.shadowRoot.getElementById("modalId");
175
+ modal.style.display = "none";
195
176
  }
196
-
197
177
  /*
198
- // When the user clicks anywhere outside of the modal, close it
199
- window.onclick = function(event) {
200
- if (event.target == modal) {
201
- modal.style.display = "none";
178
+ // When the user clicks anywhere outside of the modal, close it
179
+ window.onclick = function(event) {
180
+ if (event.target == modal) {
181
+ modal.style.display = "none";
182
+ }
202
183
  }
184
+ */
203
185
  }
204
- */
205
- }
186
+ export {
187
+ PdPopupDialog
188
+ };
@@ -1,31 +1,19 @@
1
+ import { LitElement, css, html } from "lit";
2
+ import { msg } from "@lit/localize";
3
+ import "@progressive-development/pd-icon/pd-icon";
4
+ import { PDColorStyles } from "@progressive-development/pd-shared-styles";
5
+ import "../pd-popup-dialog.js";
1
6
  /**
2
7
  * @license
3
8
  * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
4
9
  */
5
-
6
- import { LitElement, html, css } from 'lit';
7
-
8
- import '@progressive-development/pd-icon/pd-icon.js';
9
-
10
- import { PDColorStyles } from '@progressive-development/pd-shared-styles';
11
-
12
- import '../pd-popup-dialog.js';
13
-
14
- export const STATUS_SEND = 1;
15
- export const STATUS_SEND_SUCCESS = 2;
16
- export const STATUS_SEND_FAILED = 3;
17
-
18
- /**
19
- * An example element.
20
- *
21
- * @slot - This element has a slot
22
- * @csspart button - The button
23
- */
24
- export class PdSubmitDialog extends LitElement {
10
+ const STATUS_SEND = 1;
11
+ const STATUS_SEND_SUCCESS = 2;
12
+ const STATUS_SEND_FAILED = 3;
13
+ class PdSubmitDialog extends LitElement {
25
14
  /**
26
15
  * @event button-clicked - navigate to start page or close popup (failure case).
27
16
  */
28
-
29
17
  static get styles() {
30
18
  return [
31
19
  PDColorStyles,
@@ -83,60 +71,44 @@ export class PdSubmitDialog extends LitElement {
83
71
  transform: rotate(360deg);
84
72
  }
85
73
  }
86
- `];
74
+ `
75
+ ];
87
76
  }
88
-
89
77
  static get properties() {
90
78
  return {
91
79
  title: { type: String },
92
- type: { type: String }, // mail, editDate, order (default)
80
+ type: { type: String },
81
+ // mail, editDate, order (default)
93
82
  status: { type: Number },
94
83
  statusMsg: { type: String },
95
84
  confirmMail: { type: String },
96
85
  progressTxtMap: { type: Object },
97
- _buttons: { type: Array },
86
+ _buttons: { type: Array }
98
87
  };
99
88
  }
100
-
101
89
  constructor() {
102
90
  super();
103
- this.title = 'Order Submit Title';
104
- this.type = 'order';
91
+ this.title = "Order Submit Title";
92
+ this.type = "order";
105
93
  this.status = 0;
106
- this.statusMsg = '';
107
- this.confirmMail = '';
94
+ this.statusMsg = "";
95
+ this.confirmMail = "";
108
96
  this._buttons = [];
109
97
  }
110
-
111
98
  updated(changedProps) {
112
- if (changedProps.has('status')) {
99
+ if (changedProps.has("status")) {
113
100
  if (this.status === STATUS_SEND_SUCCESS) {
114
-
115
101
  this._buttons = [
116
- {name: 'Close', key: 2},];
117
-
118
- /*
119
- if (this.type === 'mail') {
120
- this._buttons = [
121
- {name: 'Close Popup'},];
122
-
123
- } else {
124
- this._buttons = [
125
- {
126
- name: 'Terug naar de startpagina',
127
- key: 10
128
- },];
129
- }
130
- */
131
-
102
+ { name: "Close", key: 2 }
103
+ ];
132
104
  } else if (this.status === STATUS_SEND_FAILED) {
133
105
  this._buttons = [];
134
- if (this.type === 'mail') {
135
- this._buttons = [{ name: 'Close' }];
106
+ if (this.type === "mail") {
107
+ this._buttons = [{ name: "Close" }];
136
108
  } else {
137
109
  this._buttons = [
138
- { name: 'Bewerk gegevens', key: 2 },
139
- { name: 'Naar startpagina' },
110
+ { name: msg("Daten bearbeiten", { id: "pd.submit.dialog.closeStay" }), key: 2 },
111
+ { name: msg("Zur Startseite", { id: "pd.submit.dialog.startPage" }) }
140
112
  ];
141
113
  }
142
114
  } else {
@@ -144,7 +116,6 @@ export class PdSubmitDialog extends LitElement {
144
116
  }
145
117
  }
146
118
  }
147
-
148
119
  render() {
149
120
  return html`
150
121
  <pd-popup-dialog
@@ -163,7 +134,6 @@ export class PdSubmitDialog extends LitElement {
163
134
  </pd-popup-dialog>
164
135
  `;
165
136
  }
166
-
167
137
  _renderProgressRow() {
168
138
  let value;
169
139
  switch (this.status) {
@@ -192,19 +162,24 @@ export class PdSubmitDialog extends LitElement {
192
162
  <span class="progress-txt">${this.progressTxtMap.get(STATUS_SEND_FAILED)}</span>`;
193
163
  break;
194
164
  default:
195
- console.warn('Unexpected value');
165
+ console.warn("Unexpected value");
196
166
  }
197
167
  return value;
198
168
  }
199
-
200
169
  _goToStartpage() {
201
170
  this.dispatchEvent(
202
- new CustomEvent('submit-button-clicked', {
171
+ new CustomEvent("submit-button-clicked", {
203
172
  detail: {
204
173
  // TODO: Get index from event
205
- button: this._buttons[0].key,
206
- },
174
+ button: this._buttons[0].key
175
+ }
207
176
  })
208
177
  );
209
178
  }
210
179
  }
180
+ export {
181
+ PdSubmitDialog,
182
+ STATUS_SEND,
183
+ STATUS_SEND_FAILED,
184
+ STATUS_SEND_SUCCESS
185
+ };
package/package.json CHANGED
@@ -1,46 +1,73 @@
1
1
  {
2
- "name": "@progressive-development/pd-dialog",
3
- "description": "Progressive Development dialog components.",
4
- "license": "SEE LICENSE IN LICENSE",
2
+ "name": "@progressive-development/pd-dialog",
3
+ "description": "Progressive Development dialog components.",
5
4
  "author": "PD Progressive Development",
6
- "version": "0.1.83",
7
- "main": "index.js",
8
- "module": "index.js",
5
+ "license": "SEE LICENSE IN LICENSE",
6
+ "version": "0.5.0",
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.js",
9
+ "exports": {
10
+ ".": "./dist/index.js",
11
+ "./pd-popup-dialog": "./dist/pd-popup-dialog.js",
12
+ "./pd-popup": "./dist/pd-popup.js",
13
+ "./pd-submit-dialog": "./dist/pd-submit-dialog.js",
14
+ "./locales/be": "./dist/locales/be.js",
15
+ "./locales/de": "./dist/locales/de.js",
16
+ "./locales/en": "./dist/locales/en.js"
17
+ },
18
+ "files": [
19
+ "dist/",
20
+ "package.json",
21
+ "README.md",
22
+ "LICENSE"
23
+ ],
9
24
  "scripts": {
10
25
  "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"
26
+ "start": "vite",
27
+ "build": "vite build",
28
+ "preview": "vite preview",
29
+ "lint": "eslint --ext .js,.html . --ignore-path .gitignore && prettier \"**/*.{js,html}\" --check --ignore-path .gitignore",
30
+ "format": "eslint --ext .js,.html . --fix --ignore-path .gitignore && prettier \"**/*.{js,html}\" --write --ignore-path .gitignore",
31
+ "test": "vitest run --coverage",
32
+ "test:watch": "vitest --watch",
33
+ "localizeExtract": "lit-localize extract",
34
+ "localizeBuild": "lit-localize build",
35
+ "storybook": "storybook dev -p 6006",
36
+ "build-storybook": "storybook build"
18
37
  },
19
- "dependencies": {
20
- "@progressive-development/pd-forms": "^0.2.15",
21
- "@progressive-development/pd-icon": "^0.1.22",
22
- "@progressive-development/pd-price": "^0.1.10",
38
+ "dependencies": {
39
+ "@progressive-development/pd-forms": "^0.5.0",
40
+ "@progressive-development/pd-icon": "^0.5.0",
41
+ "@progressive-development/pd-price": "^0.5.0",
23
42
  "@progressive-development/pd-shared-styles": "0.1.1",
24
- "lit": "^2.2.0"
43
+ "@lit/localize": "^0.12.2",
44
+ "lit": "^2.8.0"
25
45
  },
26
46
  "devDependencies": {
27
47
  "@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.30",
31
- "@web/dev-server-storybook": "next",
32
- "@web/test-runner": "^0.13.27",
48
+ "@lit/localize-tools": "^0.7.2",
49
+ "@storybook/addon-essentials": "^7.6.20",
50
+ "@storybook/addon-links": "^7.6.20",
51
+ "@storybook/blocks": "^7.5.3",
52
+ "@storybook/web-components": "^7.5.3",
53
+ "@storybook/web-components-vite": "^7.6.20",
33
54
  "eslint": "^7.32.0",
34
- "eslint-config-prettier": "^8.4.0",
55
+ "eslint-config-prettier": "^8.10.0",
56
+ "eslint-plugin-storybook": "^0.6.15",
35
57
  "husky": "^4.3.8",
36
58
  "lint-staged": "^10.5.4",
37
- "prettier": "^2.5.1"
59
+ "prettier": "^2.8.8",
60
+ "rollup-plugin-visualizer": "^5.13.1",
61
+ "storybook": "^7.6.20",
62
+ "vite": "^5.4.11",
63
+ "vitest": "^2.1.8"
38
64
  },
39
65
  "customElements": "custom-elements.json",
40
66
  "eslintConfig": {
41
67
  "extends": [
42
68
  "@open-wc",
43
- "prettier"
69
+ "prettier",
70
+ "plugin:storybook/recommended"
44
71
  ]
45
72
  },
46
73
  "prettier": {
package/.editorconfig DELETED
@@ -1,29 +0,0 @@
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 = */
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- stories: ['../stories/**/*.stories.{js,md,mdx}'],
3
- };
@@ -1,8 +0,0 @@
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/demo/index.html DELETED
@@ -1,29 +0,0 @@
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-dialog.js';
17
-
18
- const title = 'Hello owc World!';
19
- render(
20
- html`
21
- <pd-dialog .title=${title}>
22
- some light-dom
23
- </pd-dialog>
24
- `,
25
- document.querySelector('#demo')
26
- );
27
- </script>
28
- </body>
29
- </html>
package/index.js DELETED
@@ -1 +0,0 @@
1
-
@@ -1,5 +0,0 @@
1
- import { PdBookDatePopup } from './src/PdBookDatePopup.js';
2
-
3
- window.customElements.define('pd-book-date-popup', PdBookDatePopup);
4
-
5
- export { PdBookDatePopup };
@@ -1,5 +0,0 @@
1
- import { PdPopupDialog } from './src/PdPopupDialog.js';
2
-
3
- window.customElements.define('pd-popup-dialog', PdPopupDialog);
4
-
5
- export { PdPopupDialog };
package/pd-popup.js DELETED
@@ -1,3 +0,0 @@
1
- import { PdPopup } from './src/PdPopup.js';
2
-
3
- window.customElements.define('pd-popup', PdPopup);
@@ -1,5 +0,0 @@
1
- import { PdSubmitDialog, STATUS_SEND, STATUS_SEND_FAILED, STATUS_SEND_SUCCESS} from './src/PdSubmitDialog.js';
2
-
3
- window.customElements.define('pd-submit-dialog', PdSubmitDialog);
4
-
5
- export { PdSubmitDialog, STATUS_SEND, STATUS_SEND_FAILED, STATUS_SEND_SUCCESS };
@@ -1,92 +0,0 @@
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-price/pd-price.js';
9
-
10
- import { PDFontStyles } from '@progressive-development/pd-shared-styles';
11
-
12
- import '../pd-popup-dialog.js';
13
-
14
- /**
15
- * An example element.
16
- *
17
- * @slot - This element has a slot
18
- * @csspart button - The button
19
- */
20
- export class PdBookDatePopup extends LitElement {
21
- /**
22
- * @event date-approval - fired if date approved
23
- */
24
-
25
- /**
26
- * @event close-popup - fired if date canceled
27
- */
28
-
29
- static get styles() {
30
- return [
31
- PDFontStyles,
32
- css`
33
- p {
34
- color: var(--pd-default-font-content-col);
35
- font-size: var(--pd-default-font-content-size);
36
- font-family: var(--pd-default-font-content-family);
37
- max-width: 600px;
38
- }
39
- `];
40
- }
41
-
42
- static get properties() {
43
- return {
44
- date: { type: String },
45
- price: { type: Number },
46
- };
47
- }
48
-
49
- constructor() {
50
- super();
51
- this.date = '';
52
- this.price = 0;
53
- this._buttons = [
54
- { name: 'Akkoord', key: 1 },
55
- { name: 'Cancel', key: 2 },
56
- ];
57
- }
58
-
59
- render() {
60
- return html`
61
- <pd-popup-dialog
62
- class="popup-dialog"
63
- title="Akkoord datum"
64
- .buttons="${this._buttons}"
65
- @submit-button-clicked="${this._buttonClicked}"
66
- >
67
- <div slot="content">
68
- <p><b>Datum van herstelling: </b>${this.date}</p>
69
- <p>
70
- Als uw woning ouder is dan 10 jaar, hebt U als particulier recht op
71
- een verlaagd BTW-tarief van 6%, na het eenmalig invullen van een
72
- BTW-attest. Anders geldt het normale tarief van 21%.
73
- </p>
74
- <pd-price
75
- nettoPrice="${this.price}"
76
- .taxArray="${[0.06, 0.21]}"
77
- ></pd-price>
78
- </div>
79
- </pd-popup-dialog>
80
- `;
81
- }
82
-
83
- _buttonClicked(e) {
84
- let eventName;
85
- if (e.detail.button === '1') {
86
- eventName = 'date-approval';
87
- } else {
88
- eventName = 'close-popup';
89
- }
90
- this.dispatchEvent(new CustomEvent(eventName));
91
- }
92
- }
@@ -1,16 +0,0 @@
1
- import { html } from 'lit';
2
-
3
- export default {
4
- title: 'PdDialog',
5
- component: 'pd-dialog',
6
- argTypes: {
7
- },
8
- };
9
-
10
- function Template() {
11
- return html`
12
- <p>ToDo: Summary</p>
13
- `;
14
- }
15
-
16
- export const Examples = Template.bind({});
@@ -1,47 +0,0 @@
1
- import { html } from 'lit';
2
- import '../pd-popup-dialog.js';
3
-
4
- export default {
5
- title: 'PdDialog/Popup Dialog',
6
- component: 'pd-popup-dialog',
7
- argTypes: {},
8
- };
9
-
10
- function PopupTemplate({type}) {
11
- return html`
12
- <h1>Dialog Test</h1>
13
- <button>Ok</button>
14
- <pd-popup-dialog title="Title Information" type="${type}">
15
- <div slot="content">
16
- <p>
17
- Tank you for your order. And another prima text here. Maybe more than
18
- one line.
19
- </p>
20
- </div>
21
- </pd-popup-dialog>
22
- `;
23
- }
24
-
25
- export const PopupDialog = PopupTemplate.bind({});
26
- PopupDialog.args = {
27
- };
28
-
29
- export const PopupInfoDialog = PopupTemplate.bind({});
30
- PopupInfoDialog.args = {
31
- type: "info",
32
- };
33
-
34
- export const PopupHelpDialog = PopupTemplate.bind({});
35
- PopupHelpDialog.args = {
36
- type: "help",
37
- };
38
-
39
- export const PopupWarnDialog = PopupTemplate.bind({});
40
- PopupWarnDialog.args = {
41
- type: "warn",
42
- };
43
-
44
- export const PopupErrorDialog = PopupTemplate.bind({});
45
- PopupErrorDialog.args = {
46
- type: "error",
47
- };
@@ -1,34 +0,0 @@
1
- import { html } from 'lit';
2
- import '../pd-popup.js';
3
-
4
- export default {
5
- title: 'PdDialog/Popup',
6
- component: 'pd-popup',
7
- argTypes: {},
8
- };
9
-
10
- function PopupTemplate() {
11
- return html`
12
-
13
- <style>
14
- .image-div {
15
- background-image: url('https://mobimg.b-cdn.net/v3/fetch/4a/4a6da09ed52fc9f8f0a98dceba2d5fc2.jpeg');
16
- width: 100vw;
17
- height: 100vh;
18
- }
19
- </style>
20
- <div class="image-div">
21
- <pd-popup>
22
- <div slot="small-view">Open Popup</div>
23
- <div slot="content">
24
- <h2>Test PopUp Content</h2>
25
- <p>Hier steht dann etwas....</p>
26
- </div>
27
- </pd-popup>
28
-
29
- </div>
30
- `;
31
- }
32
-
33
- export const Popup = PopupTemplate.bind({});
34
- Popup.args = {};
@@ -1,90 +0,0 @@
1
- import { html } from 'lit';
2
- import {
3
- PdSubmitDialog,
4
- STATUS_SEND,
5
- STATUS_SEND_FAILED,
6
- STATUS_SEND_SUCCESS,
7
- } from '../pd-submit-dialog.js';
8
-
9
- export default {
10
- title: 'PdDialog/Submit Dialog',
11
- component: 'pd-submit-dialog',
12
- argTypes: {},
13
- };
14
-
15
- const STATUS_TXT_MAP = new Map();
16
- STATUS_TXT_MAP.set(STATUS_SEND, "Text for status send");
17
- STATUS_TXT_MAP.set(STATUS_SEND_SUCCESS, "Text for status send success");
18
- STATUS_TXT_MAP.set(STATUS_SEND_FAILED, "Text for status send failed");
19
-
20
- function PopupTemplate({ status, statusMsg, progressTxtMapParam }) {
21
- return html`
22
- <pd-submit-dialog
23
- title="Service informatie"
24
- status="${status}"
25
- confirmMail="myemail@web.de"
26
- statusMsg="${statusMsg}"
27
- .progressTxtMap="${progressTxtMapParam}"
28
- >
29
- <p slot="submit-content">
30
- Hier steht dann etwas spezifisches.
31
- </p>
32
- </pd-submit-dialog>
33
- `;
34
- }
35
-
36
- function PopupTemplatePr({ status, statusMsg, progressTxtMapParam }) {
37
-
38
- const popupEl = new PdSubmitDialog();
39
- popupEl.title = "Test Dialog Title"
40
- popupEl.status = status;
41
- popupEl.statusMsg = statusMsg;
42
- popupEl.confirmMail = "test@progressive-development.com";
43
- popupEl.progressTxtMap = progressTxtMapParam;
44
-
45
- const slotElement = document.createElement("p");
46
- slotElement.setAttribute("slot", "submit-content")
47
- slotElement.innerHTML = `Bedankt voor uw e-mail. Deze wordt nu verzonden. Je ontvangt reactie op uw mail per e-mail naar <em>${popupEl.confirmMail}</em>.`;
48
- popupEl.appendChild(slotElement);
49
-
50
- // popupEl.type = 'mail';
51
-
52
- popupEl.addEventListener('submit-button-clicked', () => {
53
- this.shadowRoot.removeChild(popupEl);
54
- this.shadowRoot.getElementById('contactUsId').clear();
55
- });
56
-
57
- return popupEl;
58
- }
59
-
60
-
61
-
62
-
63
- export const SubmitDialogSend = PopupTemplate.bind({});
64
- SubmitDialogSend.args = {
65
- status: STATUS_SEND,
66
- statusMsg: '',
67
- progressTxtMapParam: STATUS_TXT_MAP,
68
- };
69
-
70
- export const SubmitDialogSuccess = PopupTemplate.bind({});
71
- SubmitDialogSuccess.args = {
72
- status: STATUS_SEND_SUCCESS,
73
- statusMsg: '',
74
- progressTxtMapParam: STATUS_TXT_MAP,
75
- };
76
-
77
- export const SubmitDialogFailed = PopupTemplate.bind({});
78
- SubmitDialogFailed.args = {
79
- status: STATUS_SEND_FAILED,
80
- statusMsg:
81
- 'Sorry, there was a technical failure during order post. The order was not submitted, please try again later or contact us directly.',
82
- progressTxtMapParam: STATUS_TXT_MAP,
83
- };
84
-
85
- export const SubmitDialogSendPr = PopupTemplatePr.bind({});
86
- SubmitDialogSendPr.args = {
87
- status: STATUS_SEND,
88
- statusMsg: '',
89
- progressTxtMapParam: STATUS_TXT_MAP,
90
- };
@@ -1,32 +0,0 @@
1
- import { html } from 'lit';
2
- import { fixture, expect } from '@open-wc/testing';
3
-
4
- import '../pd-dialog.js';
5
-
6
- describe('PdDialog', () => {
7
- it('has a default title "Hey there" and counter 5', async () => {
8
- const el = await fixture(html`<pd-dialog></pd-dialog>`);
9
-
10
- expect(el.title).to.equal('Hey there');
11
- expect(el.counter).to.equal(5);
12
- });
13
-
14
- it('increases the counter on button click', async () => {
15
- const el = await fixture(html`<pd-dialog></pd-dialog>`);
16
- el.shadowRoot.querySelector('button').click();
17
-
18
- expect(el.counter).to.equal(6);
19
- });
20
-
21
- it('can override the title via attribute', async () => {
22
- const el = await fixture(html`<pd-dialog title="attribute title"></pd-dialog>`);
23
-
24
- expect(el.title).to.equal('attribute title');
25
- });
26
-
27
- it('passes the a11y audit', async () => {
28
- const el = await fixture(html`<pd-dialog></pd-dialog>`);
29
-
30
- await expect(el).shadowDom.to.be.accessible();
31
- });
32
- });
@@ -1,27 +0,0 @@
1
- // import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
2
-
3
- /** Use Hot Module replacement by adding --hmr to the start command */
4
- const hmr = process.argv.includes('--hmr');
5
-
6
- export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
7
- open: '/demo/',
8
- /** Use regular watch mode if HMR is not enabled. */
9
- watch: !hmr,
10
- /** Resolve bare module imports */
11
- nodeResolve: {
12
- exportConditions: ['browser', 'development'],
13
- },
14
-
15
- /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
16
- // esbuildTarget: 'auto'
17
-
18
- /** Set appIndex to enable SPA routing */
19
- // appIndex: 'demo/index.html',
20
-
21
- plugins: [
22
- /** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
23
- // hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
24
- ],
25
-
26
- // See documentation for all available options
27
- });
@@ -1,41 +0,0 @@
1
- // import { playwrightLauncher } from '@web/test-runner-playwright';
2
-
3
- const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
4
-
5
- export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
6
- /** Test files to run */
7
- files: 'test/**/*.test.js',
8
-
9
- /** Resolve bare module imports */
10
- nodeResolve: {
11
- exportConditions: ['browser', 'development'],
12
- },
13
-
14
- /** Filter out lit dev mode logs */
15
- filterBrowserLogs(log) {
16
- for (const arg of log.args) {
17
- if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
18
- return false;
19
- }
20
- }
21
- return true;
22
- },
23
-
24
- /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
25
- // esbuildTarget: 'auto',
26
-
27
- /** Amount of browsers to run concurrently */
28
- // concurrentBrowsers: 2,
29
-
30
- /** Amount of test files per browser to test concurrently */
31
- // concurrency: 1,
32
-
33
- /** Browsers to run tests on */
34
- // browsers: [
35
- // playwrightLauncher({ product: 'chromium' }),
36
- // playwrightLauncher({ product: 'firefox' }),
37
- // playwrightLauncher({ product: 'webkit' }),
38
- // ],
39
-
40
- // See documentation for all available options
41
- });