@progressive-development/pd-dialog 0.6.23 → 0.9.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.
Files changed (41) hide show
  1. package/dist/index.d.ts +3 -3
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +9 -14
  4. package/dist/locales/be.js +2 -3
  5. package/dist/locales/de.js +2 -3
  6. package/dist/locales/en.js +2 -3
  7. package/dist/pd-popup/PdPopup.d.ts +31 -0
  8. package/dist/pd-popup/PdPopup.d.ts.map +1 -0
  9. package/dist/pd-popup/PdPopup.js +137 -0
  10. package/dist/pd-popup/pd-popup.d.ts +3 -0
  11. package/dist/pd-popup/pd-popup.d.ts.map +1 -0
  12. package/dist/{stories → pd-popup}/pd-popup.stories.d.ts +1 -1
  13. package/dist/pd-popup/pd-popup.stories.d.ts.map +1 -0
  14. package/dist/pd-popup-dialog/PdPopupDialog.d.ts +37 -0
  15. package/dist/pd-popup-dialog/PdPopupDialog.d.ts.map +1 -0
  16. package/dist/pd-popup-dialog/PdPopupDialog.js +264 -0
  17. package/dist/pd-popup-dialog/pd-popup-dialog.d.ts +3 -0
  18. package/dist/pd-popup-dialog/pd-popup-dialog.d.ts.map +1 -0
  19. package/dist/{stories → pd-popup-dialog}/pd-popup-dialog.stories.d.ts +1 -1
  20. package/dist/pd-popup-dialog/pd-popup-dialog.stories.d.ts.map +1 -0
  21. package/dist/pd-popup-dialog.d.ts +2 -34
  22. package/dist/pd-popup-dialog.js +6 -265
  23. package/dist/pd-popup.d.ts +2 -29
  24. package/dist/pd-popup.js +6 -139
  25. package/dist/pd-submit-dialog/PdSubmitDialog.d.ts +32 -0
  26. package/dist/pd-submit-dialog/PdSubmitDialog.d.ts.map +1 -0
  27. package/dist/pd-submit-dialog/PdSubmitDialog.js +197 -0
  28. package/dist/pd-submit-dialog/pd-submit-dialog.d.ts +3 -0
  29. package/dist/pd-submit-dialog/pd-submit-dialog.d.ts.map +1 -0
  30. package/dist/{stories → pd-submit-dialog}/pd-submit-dialog.stories.d.ts +1 -1
  31. package/dist/pd-submit-dialog/pd-submit-dialog.stories.d.ts.map +1 -0
  32. package/dist/pd-submit-dialog.d.ts +2 -30
  33. package/dist/pd-submit-dialog.js +6 -198
  34. package/dist/types.js +2 -3
  35. package/package.json +28 -48
  36. package/dist/pd-popup-dialog.d.ts.map +0 -1
  37. package/dist/pd-popup.d.ts.map +0 -1
  38. package/dist/pd-submit-dialog.d.ts.map +0 -1
  39. package/dist/stories/pd-popup-dialog.stories.d.ts.map +0 -1
  40. package/dist/stories/pd-popup.stories.d.ts.map +0 -1
  41. package/dist/stories/pd-submit-dialog.stories.d.ts.map +0 -1
@@ -1,267 +1,8 @@
1
- import { css, LitElement, html } from "lit";
2
- import { property, customElement } from "lit/decorators.js";
3
- import "@progressive-development/pd-forms/pd-icon-panel-button";
4
- import "@progressive-development/pd-icon/pd-icon";
5
- import { PdColorStyles, PdFontStyles } from "@progressive-development/pd-shared-styles";
6
- var __defProp = Object.defineProperty;
7
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
- var __decorateClass = (decorators, target, key, kind) => {
9
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
10
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
11
- if (decorator = decorators[i])
12
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
13
- if (kind && result) __defProp(target, key, result);
14
- return result;
15
- };
16
- let PdPopupDialog = class extends LitElement {
17
- constructor() {
18
- super(...arguments);
19
- this.type = "info";
20
- this.title = "Popup Title";
21
- this.buttons = [];
22
- this.closeByEscape = false;
23
- this._handleKeyDown = (e) => {
24
- if (e.key === "Escape") this.hidePopup();
25
- };
26
- }
27
- connectedCallback() {
28
- super.connectedCallback();
29
- if (this.closeByEscape) {
30
- document.addEventListener("keydown", this._handleKeyDown);
31
- }
32
- }
33
- disconnectedCallback() {
34
- super.disconnectedCallback();
35
- if (this.closeByEscape) {
36
- document.removeEventListener("keydown", this._handleKeyDown);
37
- }
38
- }
39
- render() {
40
- return html`
41
- <div id="modalId" class="modal">
42
- <div class="modal-content">
43
- <div class="header">
44
- ${this._renderIcon()}
45
- <span class="header-txt">${this.title}</span>
46
- </div>
47
- <div class="content">
48
- <slot name="content"></slot>
49
- </div>
50
- <div class="footer">
51
- ${this.buttons.map(
52
- (bt) => html`
53
- <pd-icon-panel-button
54
- data-key=${bt.key}
55
- buttonText=${bt.name}
56
- ?disabled=${bt.disabled}
57
- ?primary=${bt.primary}
58
- @button-clicked=${this._onButtonClick}
59
- ></pd-icon-panel-button>
60
- `
61
- )}
62
- </div>
63
- </div>
64
- </div>
65
- `;
66
- }
67
- _onButtonClick(e) {
68
- const key = e.target.dataset.key;
69
- this.dispatchEvent(
70
- new CustomEvent("submit-button-clicked", {
71
- detail: { button: key },
72
- bubbles: true,
73
- composed: true
74
- })
75
- );
76
- }
77
- _renderIcon() {
78
- switch (this.type) {
79
- case "warn":
80
- return html`<pd-icon
81
- icon="warningIconFld"
82
- class="info-logo warn"
83
- ></pd-icon>`;
84
- case "error":
85
- return html`<pd-icon
86
- icon="errorIconFld"
87
- class="info-logo error"
88
- ></pd-icon>`;
89
- case "help":
90
- return html`<pd-icon
91
- icon="helpIconFld"
92
- class="info-logo help"
93
- ></pd-icon>`;
94
- case "info":
95
- default:
96
- return html`<pd-icon
97
- icon="infoIconFld"
98
- class="info-logo info"
99
- ></pd-icon>`;
100
- }
101
- }
102
- /**
103
- * Öffnet das Popup-Dialog manuell
104
- */
105
- showPopup() {
106
- this._setModalDisplay(true);
107
- }
108
- /**
109
- * Schließt das Popup-Dialog manuell
110
- */
111
- hidePopup() {
112
- this._setModalDisplay(false);
113
- }
114
- _setModalDisplay(visible) {
115
- var _a;
116
- const modal = (_a = this.shadowRoot) == null ? void 0 : _a.getElementById("modalId");
117
- if (modal) {
118
- modal.style.display = visible ? "block" : "none";
119
- }
120
- }
121
- };
122
- PdPopupDialog.styles = [
123
- PdColorStyles,
124
- PdFontStyles,
125
- css`
126
- :host {
127
- display: block;
128
- }
1
+ import { PdPopupDialog } from './pd-popup-dialog/PdPopupDialog.js';
129
2
 
130
- .modal {
131
- position: fixed;
132
- box-sizing: border-box;
3
+ const tag = "pd-popup-dialog";
4
+ if (!customElements.get(tag)) {
5
+ customElements.define(tag, PdPopupDialog);
6
+ }
133
7
 
134
- z-index: 100;
135
- left: 0;
136
- top: 0;
137
- width: 100%;
138
- height: 100%;
139
- overflow: auto;
140
- background-color: var(
141
- --pd-popup-modal-bg-rgba,
142
- rgba(175, 193, 210, 0.8)
143
- );
144
- display: block;
145
- padding: 1rem;
146
-
147
- max-width: 100vw;
148
- overflow-x: hidden;
149
- }
150
-
151
- .modal-content {
152
- position: relative;
153
- top: 50%;
154
- transform: translateY(-50%);
155
- margin: 0 auto;
156
- padding: 0;
157
- width: 100%;
158
- max-width: var(--pd-popup-max-width, 700px);
159
- border-radius: var(--pd-border-radius, 8px);
160
- border: 1px solid var(--pd-default-light-col);
161
- box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
162
- background: white;
163
- }
164
-
165
- .header {
166
- display: flex;
167
- gap: 0.5em;
168
- align-items: center;
169
- background-color: var(--pd-popup-header-col, var(--pd-default-col));
170
- height: var(--pd-popup-header-height, 45px);
171
- padding: 0.5rem;
172
-
173
- border-top-left-radius: var(--pd-border-radius, 8px);
174
- border-top-right-radius: var(--pd-border-radius, 8px);
175
- }
176
-
177
- .header-txt {
178
- font-family: var(--pd-default-font-title-family);
179
- font-size: var(--pd-popup-header-font-size, 1.3em);
180
- color: var(--pd-popup-header-font-col, var(--pd-default-bg-col));
181
- }
182
-
183
- .info-logo {
184
- width: 2em;
185
- }
186
-
187
- .error {
188
- --pd-icon-col: var(--pd-default-error-col);
189
- }
190
-
191
- .info,
192
- .help {
193
- --pd-icon-col: #6b86ff;
194
- }
195
-
196
- .warn {
197
- --pd-icon-col: #ffbf00;
198
- }
199
-
200
- .content {
201
- padding: 1em;
202
- background-color: var(
203
- --pd-popup-header-font-col,
204
- var(--pd-default-bg-col)
205
- );
206
- height: 100%;
207
- }
208
-
209
- .footer {
210
- display: flex;
211
- background: linear-gradient(
212
- to right,
213
- var(--pd-popup-footer-col, var(--pd-default-light-col)) 0%,
214
- var(--pd-default-disabled-light-col) 100%
215
- );
216
- align-items: center;
217
- justify-content: space-around;
218
-
219
- padding: 1em;
220
-
221
- border-bottom-left-radius: var(--pd-border-radius, 8px);
222
- border-bottom-right-radius: var(--pd-border-radius, 8px);
223
-
224
- --pd-icon-button-width: 100%;
225
- }
226
-
227
- .footer pd-icon-panel-button {
228
- width: 38%;
229
- }
230
-
231
- @media (max-width: 640px) {
232
- .footer {
233
- --pd-icon-button-font-size: 100%;
234
- }
235
- }
236
-
237
- @media (max-width: 500px) {
238
- .footer {
239
- flex-direction: column;
240
- gap: 0.5rem;
241
- padding: 1rem;
242
- }
243
-
244
- .footer pd-icon-panel-button {
245
- width: 90%;
246
- }
247
- }
248
- `
249
- ];
250
- __decorateClass([
251
- property({ type: String })
252
- ], PdPopupDialog.prototype, "type", 2);
253
- __decorateClass([
254
- property({ type: String })
255
- ], PdPopupDialog.prototype, "title", 2);
256
- __decorateClass([
257
- property({ type: Array })
258
- ], PdPopupDialog.prototype, "buttons", 2);
259
- __decorateClass([
260
- property({ type: Boolean })
261
- ], PdPopupDialog.prototype, "closeByEscape", 2);
262
- PdPopupDialog = __decorateClass([
263
- customElement("pd-popup-dialog")
264
- ], PdPopupDialog);
265
- export {
266
- PdPopupDialog
267
- };
8
+ export { PdPopupDialog };
@@ -1,29 +1,2 @@
1
- import { LitElement, CSSResultGroup } from 'lit';
2
- /**
3
- * Popup-Komponente, die bei Klick auf ein Trigger-Element (Slot `small-view`)
4
- * ein modales Fenster (Slot `content`) öffnet.
5
- *
6
- * @element pd-popup
7
- * @slot small-view - Inhalt, der das Popup triggert (z.B. Icon, Text)
8
- * @slot content - Inhalt, der im Popup angezeigt wird
9
- * @event popup-close - Wird ausgelöst, wenn das Popup geschlossen wurde
10
- */
11
- export declare class PdPopup extends LitElement {
12
- closeByEscape: boolean;
13
- static styles: CSSResultGroup;
14
- connectedCallback(): void;
15
- disconnectedCallback(): void;
16
- /**
17
- * Öffnet das Popup programmatisch
18
- */
19
- showPopup(): void;
20
- /**
21
- * Schließt das Popup programmatisch
22
- */
23
- hidePopup(): void;
24
- protected render(): import('lit-html').TemplateResult<1>;
25
- private _activatePopup;
26
- private _closePopup;
27
- private _handleKeyDown;
28
- }
29
- //# sourceMappingURL=pd-popup.d.ts.map
1
+ export * from './pd-popup/pd-popup'
2
+ export {}
package/dist/pd-popup.js CHANGED
@@ -1,141 +1,8 @@
1
- import { css, LitElement, html } from "lit";
2
- import { property, customElement } from "lit/decorators.js";
3
- import { pdIcons } from "@progressive-development/pd-icon";
4
- import { PdColorStyles } from "@progressive-development/pd-shared-styles";
5
- import "@progressive-development/pd-icon/pd-icon";
6
- var __defProp = Object.defineProperty;
7
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
- var __decorateClass = (decorators, target, key, kind) => {
9
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
10
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
11
- if (decorator = decorators[i])
12
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
13
- if (kind && result) __defProp(target, key, result);
14
- return result;
15
- };
16
- let PdPopup = class extends LitElement {
17
- constructor() {
18
- super(...arguments);
19
- this.closeByEscape = false;
20
- this._handleKeyDown = (e) => {
21
- if (e.key === "Escape") this._closePopup();
22
- };
23
- }
24
- connectedCallback() {
25
- super.connectedCallback();
26
- if (this.closeByEscape) {
27
- document.addEventListener("keydown", this._handleKeyDown);
28
- }
29
- }
30
- disconnectedCallback() {
31
- super.disconnectedCallback();
32
- if (this.closeByEscape) {
33
- document.removeEventListener("keydown", this._handleKeyDown);
34
- }
35
- }
36
- /**
37
- * Öffnet das Popup programmatisch
38
- */
39
- showPopup() {
40
- this._activatePopup();
41
- }
42
- /**
43
- * Schließt das Popup programmatisch
44
- */
45
- hidePopup() {
46
- this._closePopup();
47
- }
48
- render() {
49
- return html`
50
- <span @click=${this._activatePopup} @keypress=${this._activatePopup}>
51
- <slot name="small-view"></slot>
52
- </span>
1
+ import { PdPopup } from './pd-popup/PdPopup.js';
53
2
 
54
- <div id="modalId" class="modal">
55
- <div class="modal-content">
56
- <pd-icon
57
- icon=${pdIcons.ICON_CLOSE}
58
- class="close-icon"
59
- @click=${this._closePopup}
60
- ></pd-icon>
61
- <div class="modal-content-slot">
62
- <slot name="content"></slot>
63
- </div>
64
- </div>
65
- </div>
66
- `;
67
- }
68
- _activatePopup() {
69
- var _a;
70
- const modal = (_a = this.shadowRoot) == null ? void 0 : _a.getElementById("modalId");
71
- if (modal) modal.style.display = "block";
72
- }
73
- _closePopup() {
74
- var _a;
75
- const modal = (_a = this.shadowRoot) == null ? void 0 : _a.getElementById("modalId");
76
- if (modal) modal.style.display = "none";
77
- this.dispatchEvent(
78
- new CustomEvent("popup-close", {
79
- bubbles: true,
80
- composed: true
81
- })
82
- );
83
- }
84
- };
85
- PdPopup.styles = [
86
- PdColorStyles,
87
- css`
88
- :host {
89
- display: block;
90
- }
3
+ const tag = "pd-popup";
4
+ if (!customElements.get(tag)) {
5
+ customElements.define(tag, PdPopup);
6
+ }
91
7
 
92
- .modal {
93
- position: fixed;
94
- z-index: 100;
95
- left: 0;
96
- top: 0;
97
- width: 100%;
98
- height: 100%;
99
- overflow: auto;
100
- background-color: var(
101
- --pd-popup-modal-bg-rgba,
102
- rgba(175, 193, 210, 0.8)
103
- );
104
- display: var(--pd-popup-default-display, none);
105
- padding-top: 100px;
106
- }
107
-
108
- .modal-content {
109
- background-color: var(--pd-default-bg-col);
110
- opacity: 1;
111
- margin: auto;
112
- padding: var(--pd-popup-modal-padding, 20px);
113
- padding-bottom: 130px;
114
- border: 2px solid var(--pd-default-col);
115
- width: 80%;
116
- max-width: 1200px;
117
- position: relative;
118
- }
119
-
120
- .modal-content-slot {
121
- max-width: var(--pd-popup-modal-slot-max-width, 1000px);
122
- margin: var(--pd-popup-modal-slot-margin, 0 30px);
123
- }
124
-
125
- .close-icon {
126
- position: absolute;
127
- cursor: pointer;
128
- right: 1.2em;
129
- top: 1.2em;
130
- }
131
- `
132
- ];
133
- __decorateClass([
134
- property({ type: Boolean })
135
- ], PdPopup.prototype, "closeByEscape", 2);
136
- PdPopup = __decorateClass([
137
- customElement("pd-popup")
138
- ], PdPopup);
139
- export {
140
- PdPopup
141
- };
8
+ export { PdPopup };
@@ -0,0 +1,32 @@
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ /**
3
+ * @tagname pd-submit-dialog
4
+ *
5
+ * A submit dialog that shows progress, success or failure state.
6
+ *
7
+ * @fires submit-button-clicked - Triggered when a footer button is clicked, e.g. "Close" or "Back to Start".
8
+ * @slot submit-content - Content shown above the progress area
9
+ */
10
+ export declare class PdSubmitDialog extends LitElement {
11
+ static styles: import('lit').CSSResult[];
12
+ /** Dialog title */
13
+ title: string;
14
+ /** Dialog type: `mail`, `editDate`, `order` (default) */
15
+ type: "mail" | "editDate" | "order";
16
+ /** Current status */
17
+ status: number;
18
+ /** Optional status message shown below the progress */
19
+ statusMsg: string;
20
+ /** Confirmation email address shown inside the content */
21
+ confirmMail: string;
22
+ /** Optional map with custom progress texts */
23
+ progressTxtMap: Map<number, string>;
24
+ /** Internal list of buttons shown in the popup dialog */
25
+ private _buttons;
26
+ updated(changedProps: PropertyValues<this>): void;
27
+ private _updateButtonsBasedOnStatus;
28
+ render(): import('lit').TemplateResult<1>;
29
+ private _renderProgressRow;
30
+ private _goToStartpage;
31
+ }
32
+ //# sourceMappingURL=PdSubmitDialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PdSubmitDialog.d.ts","sourceRoot":"","sources":["../../src/pd-submit-dialog/PdSubmitDialog.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAI5D,OAAO,0CAA0C,CAAC;AAKlD,OAAO,uCAAuC,CAAC;AAE/C;;;;;;;GAOG;AACH,qBAAa,cAAe,SAAQ,UAAU;IAC5C,OAAgB,MAAM,4BAuDpB;IAEF,mBAAmB;IAEnB,KAAK,SAAwB;IAE7B,yDAAyD;IAEzD,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAW;IAE9C,qBAAqB;IAErB,MAAM,SAAK;IAEX,uDAAuD;IAEvD,SAAS,SAAM;IAEf,0DAA0D;IAE1D,WAAW,SAAM;IAEjB,8CAA8C;IAE9C,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAa;IAEhD,yDAAyD;IAChD,OAAO,CAAC,QAAQ,CAAwB;IAExC,OAAO,CAAC,YAAY,EAAE,cAAc,CAAC,IAAI,CAAC;IAMnD,OAAO,CAAC,2BAA2B;IAuB1B,MAAM;IAmBf,OAAO,CAAC,kBAAkB;IAiC1B,OAAO,CAAC,cAAc;CAUvB"}
@@ -0,0 +1,197 @@
1
+ import { LitElement, css, html } from 'lit';
2
+ import { property, state } from 'lit/decorators.js';
3
+ import { msg } from '@lit/localize';
4
+ import '@progressive-development/pd-icon/pd-icon';
5
+ import { PdColorStyles } from '@progressive-development/pd-shared-styles';
6
+ import { PdSubmitDialogStatus } from '../types.js';
7
+ import '../pd-popup-dialog.js';
8
+
9
+ var __defProp = Object.defineProperty;
10
+ var __decorateClass = (decorators, target, key, kind) => {
11
+ var result = void 0 ;
12
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
13
+ if (decorator = decorators[i])
14
+ result = (decorator(target, key, result) ) || result;
15
+ if (result) __defProp(target, key, result);
16
+ return result;
17
+ };
18
+ class PdSubmitDialog extends LitElement {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.title = "Order Submit Title";
22
+ this.type = "order";
23
+ this.status = 0;
24
+ this.statusMsg = "";
25
+ this.confirmMail = "";
26
+ this.progressTxtMap = /* @__PURE__ */ new Map();
27
+ this._buttons = [];
28
+ }
29
+ static {
30
+ this.styles = [
31
+ PdColorStyles,
32
+ css`
33
+ :host {
34
+ display: block;
35
+ }
36
+
37
+ .progress-container {
38
+ padding: 20px;
39
+ }
40
+
41
+ .progress-row {
42
+ display: flex;
43
+ justify-content: start;
44
+ align-items: center;
45
+ }
46
+
47
+ .first-row-tmp {
48
+ width: 80px;
49
+ height: 40px;
50
+ }
51
+
52
+ .loader {
53
+ border: 16px solid var(--pd-default-disabled-light-col);
54
+ border-top: 16px solid var(--pd-default-col);
55
+ border-radius: 50%;
56
+ width: 10px;
57
+ height: 10px;
58
+ animation: spin 2s linear infinite;
59
+ }
60
+
61
+ .success-icon {
62
+ padding-top: 5px;
63
+ --pd-icon-col-active: var(--pd-default-success-col);
64
+ }
65
+
66
+ .error-icon {
67
+ padding-top: 5px;
68
+ --pd-icon-col: var(--pd-default-error-col);
69
+ }
70
+
71
+ .progress-txt {
72
+ font-size: 1em;
73
+ color: var(--pd-default-dark-col);
74
+ }
75
+
76
+ @keyframes spin {
77
+ 0% {
78
+ transform: rotate(0deg);
79
+ }
80
+ 100% {
81
+ transform: rotate(360deg);
82
+ }
83
+ }
84
+ `
85
+ ];
86
+ }
87
+ updated(changedProps) {
88
+ if (changedProps.has("status")) {
89
+ this._updateButtonsBasedOnStatus();
90
+ }
91
+ }
92
+ _updateButtonsBasedOnStatus() {
93
+ if (this.status === PdSubmitDialogStatus.SUCCESS) {
94
+ this._buttons = [{ name: "Close", key: 2 }];
95
+ } else if (this.status === PdSubmitDialogStatus.FAILED) {
96
+ if (this.type === "mail") {
97
+ this._buttons = [{ name: "Close", key: 2 }];
98
+ } else {
99
+ this._buttons = [
100
+ {
101
+ name: msg("Daten bearbeiten", { id: "pd.submit.dialog.closeStay" }),
102
+ key: 2
103
+ },
104
+ {
105
+ name: msg("Zur Startseite", { id: "pd.submit.dialog.startPage" }),
106
+ key: 1
107
+ }
108
+ ];
109
+ }
110
+ } else {
111
+ this._buttons = [];
112
+ }
113
+ }
114
+ render() {
115
+ return html`
116
+ <pd-popup-dialog
117
+ class="popup-dialog"
118
+ .title=${this.title}
119
+ .buttons=${this._buttons}
120
+ @submit-button-clicked=${this._goToStartpage}
121
+ >
122
+ <div slot="content">
123
+ <slot name="submit-content"></slot>
124
+ <div class="progress-container">
125
+ <div class="progress-row">${this._renderProgressRow()}</div>
126
+ </div>
127
+ <p>${this.statusMsg}</p>
128
+ </div>
129
+ </pd-popup-dialog>
130
+ `;
131
+ }
132
+ _renderProgressRow() {
133
+ switch (this.status) {
134
+ case PdSubmitDialogStatus.SEND:
135
+ return html`
136
+ <div class="first-row-tmp"><div class="loader"></div></div>
137
+ <span class="progress-txt"
138
+ >${this.progressTxtMap.get(PdSubmitDialogStatus.SEND)}</span
139
+ >
140
+ `;
141
+ case PdSubmitDialogStatus.SUCCESS:
142
+ return html`
143
+ <div class="first-row-tmp">
144
+ <pd-icon class="success-icon" icon="checkBox" activeIcon></pd-icon>
145
+ </div>
146
+ <span class="progress-txt"
147
+ >${this.progressTxtMap.get(PdSubmitDialogStatus.SUCCESS)}</span
148
+ >
149
+ `;
150
+ case PdSubmitDialogStatus.FAILED:
151
+ return html`
152
+ <div class="first-row-tmp">
153
+ <pd-icon class="error-icon" icon="checkBox"></pd-icon>
154
+ </div>
155
+ <span class="progress-txt"
156
+ >${this.progressTxtMap.get(PdSubmitDialogStatus.FAILED)}</span
157
+ >
158
+ `;
159
+ default:
160
+ console.warn("Unexpected status:", this.status);
161
+ return "";
162
+ }
163
+ }
164
+ _goToStartpage(e) {
165
+ const clickedKey = e.detail?.button ?? this._buttons[0]?.key ?? 0;
166
+ this.dispatchEvent(
167
+ new CustomEvent("submit-button-clicked", {
168
+ detail: { button: clickedKey },
169
+ bubbles: true,
170
+ composed: true
171
+ })
172
+ );
173
+ }
174
+ }
175
+ __decorateClass([
176
+ property({ type: String })
177
+ ], PdSubmitDialog.prototype, "title");
178
+ __decorateClass([
179
+ property({ type: String })
180
+ ], PdSubmitDialog.prototype, "type");
181
+ __decorateClass([
182
+ property({ type: Number })
183
+ ], PdSubmitDialog.prototype, "status");
184
+ __decorateClass([
185
+ property({ type: String })
186
+ ], PdSubmitDialog.prototype, "statusMsg");
187
+ __decorateClass([
188
+ property({ type: String })
189
+ ], PdSubmitDialog.prototype, "confirmMail");
190
+ __decorateClass([
191
+ property({ type: Object })
192
+ ], PdSubmitDialog.prototype, "progressTxtMap");
193
+ __decorateClass([
194
+ state()
195
+ ], PdSubmitDialog.prototype, "_buttons");
196
+
197
+ export { PdSubmitDialog };
@@ -0,0 +1,3 @@
1
+ import { PdSubmitDialog } from './PdSubmitDialog.js';
2
+ export { PdSubmitDialog };
3
+ //# sourceMappingURL=pd-submit-dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pd-submit-dialog.d.ts","sourceRoot":"","sources":["../../src/pd-submit-dialog/pd-submit-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAOrD,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -3,7 +3,7 @@ import { PdSubmitDialogStatus } from '../types.js';
3
3
  declare const meta: {
4
4
  title: string;
5
5
  component: string;
6
- render: ({ title, status, statusMsg, confirmMail }: import('@storybook/web-components').Args) => import('lit-html').TemplateResult<1>;
6
+ render: ({ title, status, statusMsg, confirmMail }: import('@storybook/web-components').Args) => import('lit').TemplateResult<1>;
7
7
  argTypes: {
8
8
  title: {
9
9
  control: "text";