@progressive-development/pd-dialog 0.9.2 → 1.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.
Files changed (34) hide show
  1. package/LICENSE +21 -2
  2. package/README.md +34 -57
  3. package/dist/index.d.ts +5 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +2 -0
  6. package/dist/pd-confirm-dialog/PdConfirmDialog.d.ts +40 -0
  7. package/dist/pd-confirm-dialog/PdConfirmDialog.d.ts.map +1 -0
  8. package/dist/pd-confirm-dialog/PdConfirmDialog.js +108 -0
  9. package/dist/pd-confirm-dialog/pd-confirm-dialog.d.ts +7 -0
  10. package/dist/pd-confirm-dialog/pd-confirm-dialog.d.ts.map +1 -0
  11. package/dist/pd-confirm-dialog/pd-confirm-dialog.stories.d.ts +107 -0
  12. package/dist/pd-confirm-dialog/pd-confirm-dialog.stories.d.ts.map +1 -0
  13. package/dist/pd-form-dialog/PdFormDialog.d.ts +54 -0
  14. package/dist/pd-form-dialog/PdFormDialog.d.ts.map +1 -0
  15. package/dist/pd-form-dialog/PdFormDialog.js +181 -0
  16. package/dist/pd-form-dialog/pd-form-dialog.d.ts +6 -0
  17. package/dist/pd-form-dialog/pd-form-dialog.d.ts.map +1 -0
  18. package/dist/pd-form-dialog/pd-form-dialog.stories.d.ts +118 -0
  19. package/dist/pd-form-dialog/pd-form-dialog.stories.d.ts.map +1 -0
  20. package/dist/pd-popup/PdPopup.d.ts +36 -6
  21. package/dist/pd-popup/PdPopup.d.ts.map +1 -1
  22. package/dist/pd-popup/PdPopup.js +98 -27
  23. package/dist/pd-popup/pd-popup.stories.d.ts +56 -22
  24. package/dist/pd-popup/pd-popup.stories.d.ts.map +1 -1
  25. package/dist/pd-popup-dialog/PdPopupDialog.d.ts +36 -9
  26. package/dist/pd-popup-dialog/PdPopupDialog.d.ts.map +1 -1
  27. package/dist/pd-popup-dialog/PdPopupDialog.js +90 -47
  28. package/dist/pd-popup-dialog/pd-popup-dialog.stories.d.ts +52 -18
  29. package/dist/pd-popup-dialog/pd-popup-dialog.stories.d.ts.map +1 -1
  30. package/dist/pd-submit-dialog/PdSubmitDialog.d.ts +8 -4
  31. package/dist/pd-submit-dialog/PdSubmitDialog.d.ts.map +1 -1
  32. package/dist/pd-submit-dialog/pd-submit-dialog.stories.d.ts +46 -29
  33. package/dist/pd-submit-dialog/pd-submit-dialog.stories.d.ts.map +1 -1
  34. package/package.json +9 -6
@@ -1 +1 @@
1
- {"version":3,"file":"pd-popup.stories.d.ts","sourceRoot":"","sources":["../../src/pd-popup/pd-popup.stories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,eAAe,CAAC;AAGvB,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;CAqBM,CAAC;AAEjB,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC;AAEtB,eAAO,MAAM,YAAY,EAAE,KAK1B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAazB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAUjC,CAAC"}
1
+ {"version":3,"file":"pd-popup.stories.d.ts","sourceRoot":"","sources":["../../src/pd-popup/pd-popup.stories.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAGrE,OAAO,eAAe,CAAC;AAMvB;;;GAGG;AACH,UAAU,WAAW;IACnB,mCAAmC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,aAAa,EAAE,OAAO,CAAC;IACvB,sDAAsD;IACtD,eAAe,EAAE,OAAO,CAAC;IACzB,mCAAmC;IACnC,aAAa,EAAE,OAAO,CAAC;IACvB,2CAA2C;IAC3C,WAAW,EAAE,OAAO,CAAC;IACrB,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;CACpB;AAMD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,WAAW,CA8F3B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;AAMnC,8EAA8E;AAC9E,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAMjC,8EAA8E;AAC9E,eAAO,MAAM,WAAW,EAAE,KA8BzB,CAAC;AAMF,6FAA6F;AAC7F,eAAO,MAAM,cAAc,EAAE,KAiE5B,CAAC;AAMF,2FAA2F;AAC3F,eAAO,MAAM,eAAe,EAAE,KA6B7B,CAAC;AAMF,qGAAqG;AACrG,eAAO,MAAM,mBAAmB,EAAE,KA6CjC,CAAC;AAMF,gEAAgE;AAChE,eAAO,MAAM,aAAa,EAAE,KAyG3B,CAAC"}
@@ -1,22 +1,47 @@
1
1
  import { LitElement, CSSResultGroup } from 'lit';
2
2
  import { PdDialogButton } from '../types';
3
3
  /**
4
+ * Modal dialog with header, content, and configurable footer buttons.
5
+ *
4
6
  * @tagname pd-popup-dialog
7
+ * @summary Modal dialog with header, content slot, and footer buttons.
8
+ *
9
+ * @event submit-button-clicked - Fired when a footer button is clicked. Emits `{button}`.
10
+ *
11
+ * @slot content - Main dialog content.
12
+ *
13
+ * @cssprop --pd-popup-modal-bg-rgba - Modal overlay background.
14
+ * @cssprop --pd-popup-modal-padding - Modal padding. Default: `--pd-spacing-md`.
15
+ * @cssprop --pd-popup-max-width - Maximum dialog width. Default: `700px`.
16
+ * @cssprop --pd-popup-header-col - Header background. Default: `--pd-default-col`.
17
+ * @cssprop --pd-popup-header-height - Header min-height. Default: `45px`.
18
+ * @cssprop --pd-popup-header-gap - Header gap between icon and text. Default: `--pd-spacing-sm`.
19
+ * @cssprop --pd-popup-header-font-size - Header font size. Default: `1.3em`.
20
+ * @cssprop --pd-popup-header-font-col - Header text color. Default: `--pd-default-bg-col`.
21
+ * @cssprop --pd-popup-content-padding - Content area padding. Default: `--pd-spacing-md`.
22
+ * @cssprop --pd-popup-footer-col - Footer background. Default: `--pd-default-light-col`.
23
+ * @cssprop --pd-popup-footer-padding - Footer padding. Default: `--pd-spacing-md`.
24
+ * @cssprop --pd-popup-footer-button-width - Footer button width. Default: `38%`.
25
+ * @cssprop --pd-popup-z-index - Z-index for modal overlay. Default: `100`.
26
+ * @cssprop --pd-popup-border-radius - Dialog border radius. Default: `var(--pd-radius-lg)`.
5
27
  */
6
28
  export declare class PdPopupDialog extends LitElement {
7
- /**
8
- * Typ des Popups: info | warn | error | help
9
- */
29
+ /** Dialog type: info, warn, error, help. */
10
30
  type: string;
11
- /**
12
- * Titel, der im Header angezeigt wird
13
- */
31
+ /** Dialog title text. */
14
32
  title: string;
15
- /**
16
- * Konfigurierbare Buttons mit Text, Key und optionalem Status
17
- */
33
+ /** Footer button configurations. */
18
34
  buttons: PdDialogButton[];
35
+ /** Enable closing with Escape key. */
19
36
  closeByEscape: boolean;
37
+ /** Enable closing by clicking the backdrop overlay. */
38
+ closeByBackdrop: boolean;
39
+ /** Block body scroll when dialog is open. */
40
+ blockScroll: boolean;
41
+ /** @ignore */
42
+ private _modal;
43
+ /** Track if scroll was blocked by this instance */
44
+ private _scrollBlocked;
20
45
  static styles: CSSResultGroup;
21
46
  connectedCallback(): void;
22
47
  disconnectedCallback(): void;
@@ -33,5 +58,7 @@ export declare class PdPopupDialog extends LitElement {
33
58
  hidePopup(): void;
34
59
  private _setModalDisplay;
35
60
  private _handleKeyDown;
61
+ private _onBackdropClick;
62
+ private _stopPropagation;
36
63
  }
37
64
  //# sourceMappingURL=PdPopupDialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PdPopupDialog.d.ts","sourceRoot":"","sources":["../../src/pd-popup-dialog/PdPopupDialog.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,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O,CAAS;IAE7B,cAAc;IAEd,OAAO,CAAC,MAAM,CAAkB;IAEhC,mDAAmD;IACnD,OAAO,CAAC,cAAc,CAAS;IAE/B,OAAgB,MAAM,EAAE,cAAc,CAgIpC;IAEO,iBAAiB;IAYjB,oBAAoB;IAYpB,MAAM;IAsCf,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,WAAW;IA0BnB;;OAEG;IACI,SAAS;IAIhB;;OAEG;IACI,SAAS;IAQhB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,cAAc,CAEpB;IAEF,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,gBAAgB;CAGzB"}
@@ -1,6 +1,6 @@
1
1
  import { LitElement, css, html } from 'lit';
2
- import { property } from 'lit/decorators.js';
3
- import '@progressive-development/pd-forms/pd-panel-button';
2
+ import { property, query } from 'lit/decorators.js';
3
+ import '@progressive-development/pd-forms/pd-button';
4
4
  import '@progressive-development/pd-icon/pd-icon';
5
5
 
6
6
  var __defProp = Object.defineProperty;
@@ -19,6 +19,10 @@ class PdPopupDialog extends LitElement {
19
19
  this.title = "Popup Title";
20
20
  this.buttons = [];
21
21
  this.closeByEscape = false;
22
+ this.closeByBackdrop = false;
23
+ this.blockScroll = false;
24
+ /** Track if scroll was blocked by this instance */
25
+ this._scrollBlocked = false;
22
26
  this._handleKeyDown = (e) => {
23
27
  if (e.key === "Escape") this.hidePopup();
24
28
  };
@@ -28,13 +32,14 @@ class PdPopupDialog extends LitElement {
28
32
  css`
29
33
  :host {
30
34
  display: block;
35
+ --_dialog-radius: var(--pd-popup-border-radius, var(--pd-radius-lg));
31
36
  }
32
37
 
33
38
  .modal {
34
39
  position: fixed;
35
40
  box-sizing: border-box;
36
41
 
37
- z-index: 100;
42
+ z-index: var(--pd-popup-z-index, 100);
38
43
  left: 0;
39
44
  top: 0;
40
45
  width: 100%;
@@ -42,45 +47,53 @@ class PdPopupDialog extends LitElement {
42
47
  overflow: auto;
43
48
  background-color: var(
44
49
  --pd-popup-modal-bg-rgba,
45
- rgba(175, 193, 210, 0.8)
50
+ var(--pd-modal-overlay-col)
46
51
  );
47
- display: block;
48
- padding: 1rem;
52
+ display: flex;
53
+ justify-content: center;
54
+ align-items: center;
55
+ padding: var(--pd-popup-modal-padding, var(--pd-spacing-md));
49
56
 
50
57
  max-width: 100vw;
51
58
  overflow-x: hidden;
52
59
  }
53
60
 
54
61
  .modal-content {
55
- position: relative;
56
- top: 50%;
57
- transform: translateY(-50%);
58
- margin: 0 auto;
62
+ margin: auto;
59
63
  padding: 0;
60
64
  width: 100%;
61
65
  max-width: var(--pd-popup-max-width, 700px);
62
- border-radius: var(--pd-border-radius, 8px);
63
- border: 1px solid var(--pd-default-light-col);
64
- box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
65
- background: white;
66
+ border-radius: var(--_dialog-radius);
67
+ border: var(--pd-border-width) solid var(--pd-default-light-col);
68
+ box-shadow: var(--pd-shadow-xl);
69
+ background: var(--pd-default-bg-col);
70
+ }
71
+
72
+ /* Mobile: align to top for full scrollability */
73
+ @media (max-width: 767px) {
74
+ .modal {
75
+ align-items: flex-start;
76
+ }
66
77
  }
67
78
 
68
79
  .header {
69
80
  display: flex;
70
- gap: 0.5em;
81
+ gap: var(--pd-popup-header-gap, var(--pd-spacing-sm));
71
82
  align-items: center;
72
83
  background-color: var(--pd-popup-header-col, var(--pd-default-col));
73
- height: var(--pd-popup-header-height, 45px);
74
- padding: 0.5rem;
84
+ min-height: var(--pd-popup-header-height, 45px);
85
+ padding: var(--pd-spacing-sm);
75
86
 
76
- border-top-left-radius: var(--pd-border-radius, 8px);
77
- border-top-right-radius: var(--pd-border-radius, 8px);
87
+ border-top-left-radius: var(--_dialog-radius);
88
+ border-top-right-radius: var(--_dialog-radius);
78
89
  }
79
90
 
80
91
  .header-txt {
81
92
  font-family: var(--pd-default-font-title-family);
82
93
  font-size: var(--pd-popup-header-font-size, 1.3em);
83
94
  color: var(--pd-popup-header-font-col, var(--pd-default-bg-col));
95
+ overflow-wrap: break-word;
96
+ word-break: break-word;
84
97
  }
85
98
 
86
99
  .info-logo {
@@ -93,15 +106,15 @@ class PdPopupDialog extends LitElement {
93
106
 
94
107
  .info,
95
108
  .help {
96
- --pd-icon-col: #6b86ff;
109
+ --pd-icon-col: var(--pd-default-info-col);
97
110
  }
98
111
 
99
112
  .warn {
100
- --pd-icon-col: #ffbf00;
113
+ --pd-icon-col: var(--pd-default-warning-col);
101
114
  }
102
115
 
103
116
  .content {
104
- padding: 1em;
117
+ padding: var(--pd-popup-content-padding, var(--pd-spacing-md));
105
118
  background-color: var(
106
119
  --pd-popup-header-font-col,
107
120
  var(--pd-default-bg-col)
@@ -119,32 +132,26 @@ class PdPopupDialog extends LitElement {
119
132
  align-items: center;
120
133
  justify-content: space-around;
121
134
 
122
- padding: 1em;
135
+ padding: var(--pd-popup-footer-padding, var(--pd-spacing-md));
123
136
 
124
- border-bottom-left-radius: var(--pd-border-radius, 8px);
125
- border-bottom-right-radius: var(--pd-border-radius, 8px);
137
+ border-bottom-left-radius: var(--_dialog-radius);
138
+ border-bottom-right-radius: var(--_dialog-radius);
126
139
 
127
- --pd-icon-button-width: 100%;
140
+ --pd-button-width: 100%;
128
141
  }
129
142
 
130
- .footer pd-panel-button {
131
- width: 38%;
143
+ .footer pd-button {
144
+ width: var(--pd-popup-footer-button-width, 38%);
132
145
  }
133
146
 
134
- @media (max-width: 640px) {
135
- .footer {
136
- --pd-icon-button-font-size: 100%;
137
- }
138
- }
139
-
140
- @media (max-width: 500px) {
147
+ /* Mobile: stack buttons vertically */
148
+ @media (max-width: 767px) {
141
149
  .footer {
142
150
  flex-direction: column;
143
- gap: 0.5rem;
144
- padding: 1rem;
151
+ gap: var(--pd-spacing-sm);
145
152
  }
146
153
 
147
- .footer pd-panel-button {
154
+ .footer pd-button {
148
155
  width: 90%;
149
156
  }
150
157
  }
@@ -156,20 +163,36 @@ class PdPopupDialog extends LitElement {
156
163
  if (this.closeByEscape) {
157
164
  document.addEventListener("keydown", this._handleKeyDown);
158
165
  }
166
+ if (this.blockScroll) {
167
+ document.body.style.overflow = "hidden";
168
+ this._scrollBlocked = true;
169
+ }
159
170
  }
160
171
  disconnectedCallback() {
161
172
  super.disconnectedCallback();
162
173
  if (this.closeByEscape) {
163
174
  document.removeEventListener("keydown", this._handleKeyDown);
164
175
  }
176
+ if (this._scrollBlocked) {
177
+ document.body.style.overflow = "";
178
+ this._scrollBlocked = false;
179
+ }
165
180
  }
166
181
  render() {
182
+ const titleId = `${this.id || "popup"}-title`;
167
183
  return html`
168
- <div id="modalId" class="modal">
169
- <div class="modal-content">
184
+ <div
185
+ id="modalId"
186
+ class="modal"
187
+ role="dialog"
188
+ aria-modal="true"
189
+ aria-labelledby="${titleId}"
190
+ @click=${this._onBackdropClick}
191
+ >
192
+ <div class="modal-content" @click=${this._stopPropagation}>
170
193
  <div class="header">
171
194
  ${this._renderIcon()}
172
- <span class="header-txt">${this.title}</span>
195
+ <span id="${titleId}" class="header-txt">${this.title}</span>
173
196
  </div>
174
197
  <div class="content">
175
198
  <slot name="content"></slot>
@@ -177,13 +200,13 @@ class PdPopupDialog extends LitElement {
177
200
  <div class="footer">
178
201
  ${this.buttons.map(
179
202
  (bt) => html`
180
- <pd-panel-button
203
+ <pd-button
181
204
  data-key=${bt.key}
182
- buttonText=${bt.name}
205
+ text=${bt.name}
183
206
  ?disabled=${bt.disabled}
184
207
  ?primary=${bt.primary}
185
208
  @button-clicked=${this._onButtonClick}
186
- ></pd-panel-button>
209
+ ></pd-button>
187
210
  `
188
211
  )}
189
212
  </div>
@@ -236,14 +259,25 @@ class PdPopupDialog extends LitElement {
236
259
  * Schließt das Popup-Dialog manuell
237
260
  */
238
261
  hidePopup() {
262
+ if (this._scrollBlocked) {
263
+ document.body.style.overflow = "";
264
+ this._scrollBlocked = false;
265
+ }
239
266
  this._setModalDisplay(false);
240
267
  }
241
268
  _setModalDisplay(visible) {
242
- const modal = this.shadowRoot?.getElementById("modalId");
243
- if (modal) {
244
- modal.style.display = visible ? "block" : "none";
269
+ if (this._modal) {
270
+ this._modal.style.display = visible ? "block" : "none";
245
271
  }
246
272
  }
273
+ _onBackdropClick() {
274
+ if (this.closeByBackdrop) {
275
+ this.hidePopup();
276
+ }
277
+ }
278
+ _stopPropagation(e) {
279
+ e.stopPropagation();
280
+ }
247
281
  }
248
282
  __decorateClass([
249
283
  property({ type: String })
@@ -257,5 +291,14 @@ __decorateClass([
257
291
  __decorateClass([
258
292
  property({ type: Boolean })
259
293
  ], PdPopupDialog.prototype, "closeByEscape");
294
+ __decorateClass([
295
+ property({ type: Boolean })
296
+ ], PdPopupDialog.prototype, "closeByBackdrop");
297
+ __decorateClass([
298
+ property({ type: Boolean })
299
+ ], PdPopupDialog.prototype, "blockScroll");
300
+ __decorateClass([
301
+ query("#modalId")
302
+ ], PdPopupDialog.prototype, "_modal");
260
303
 
261
304
  export { PdPopupDialog };
@@ -1,21 +1,55 @@
1
- import { StoryObj } from '@storybook/web-components';
2
- declare const meta: {
1
+ import { Meta, StoryObj } from '@storybook/web-components-vite';
2
+ import { PdDialogButton } from '../types.js';
3
+ /**
4
+ * Story arguments interface for pd-popup-dialog component.
5
+ * Maps to the component's public API.
6
+ */
7
+ interface PdPopupDialogArgs {
8
+ /** Dialog title text */
3
9
  title: string;
4
- render: ({ title, type, buttons }: import('@storybook/web-components').Args) => import('lit').TemplateResult<1>;
5
- argTypes: {
6
- title: {
7
- control: "text";
8
- };
9
- type: {
10
- control: "select";
11
- options: string[];
12
- };
13
- };
14
- };
10
+ /** Dialog type: info, warn, error, help */
11
+ type: "info" | "warn" | "error" | "help";
12
+ /** Footer button configurations */
13
+ buttons: PdDialogButton[];
14
+ /** Enable closing with Escape key */
15
+ closeByEscape: boolean;
16
+ /** Enable closing by clicking the backdrop overlay */
17
+ closeByBackdrop: boolean;
18
+ }
19
+ /**
20
+ * ## pd-popup-dialog
21
+ *
22
+ * A structured modal dialog with colored header, content slot, and configurable footer buttons.
23
+ *
24
+ * ### Features
25
+ * - Dialog types: info, warn, error, help (each with corresponding icon)
26
+ * - Colored header with icon and title text
27
+ * - Content area via `content` slot
28
+ * - Configurable footer buttons via `buttons` array property
29
+ * - Optional close on Escape key (`closeByEscape`)
30
+ * - Optional close on backdrop click (`closeByBackdrop`)
31
+ * - Programmatic control via `showPopup()` / `hidePopup()` methods
32
+ * - Mobile-responsive: buttons stack vertically on small screens
33
+ *
34
+ * ### Accessibility
35
+ * - Uses `role="dialog"` and `aria-modal="true"`
36
+ * - Title linked via `aria-labelledby` for screen readers
37
+ * - Footer buttons use native `<pd-button>` with keyboard support
38
+ * - Escape key close support
39
+ */
40
+ declare const meta: Meta<PdPopupDialogArgs>;
15
41
  export default meta;
16
- type Story = StoryObj;
17
- export declare const Info: Story;
18
- export declare const InfoLongTitle: Story;
19
- export declare const Error: Story;
20
- export declare const Warn: Story;
42
+ type Story = StoryObj<PdPopupDialogArgs>;
43
+ /** Default info dialog with OK and Cancel buttons. Interactive via Controls panel. */
44
+ export declare const Default: Story;
45
+ /** All four dialog types with their corresponding icons side by side. */
46
+ export declare const AllTypes: Story;
47
+ /** Different footer button configurations: single, two, and three buttons. */
48
+ export declare const ButtonConfigurations: Story;
49
+ /** Demonstrates opening/closing the dialog programmatically via `showPopup()` / `hidePopup()`. */
50
+ export declare const ProgrammaticControl: Story;
51
+ /** Dialog with a long title that wraps to multiple lines. */
52
+ export declare const LongTitle: Story;
53
+ /** CSS Custom Properties -- Branded and Redesigned variants. */
54
+ export declare const CustomStyling: Story;
21
55
  //# sourceMappingURL=pd-popup-dialog.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pd-popup-dialog.stories.d.ts","sourceRoot":"","sources":["../../src/pd-popup-dialog/pd-popup-dialog.stories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAIhE,OAAO,sBAAsB,CAAC;AAE9B,QAAA,MAAM,IAAI;;;;;;;;;;;;CAcM,CA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,KAyDjC,CAAC;AAMF,6DAA6D;AAC7D,eAAO,MAAM,SAAS,EAAE,KAevB,CAAC;AAMF,gEAAgE;AAChE,eAAO,MAAM,aAAa,EAAE,KA4H3B,CAAC"}
@@ -1,11 +1,13 @@
1
1
  import { LitElement, PropertyValues } from 'lit';
2
2
  /**
3
+ * Submit dialog with progress, success, and failure states.
4
+ *
3
5
  * @tagname pd-submit-dialog
6
+ * @summary Progress dialog with loading spinner, success, and error states.
4
7
  *
5
- * A submit dialog that shows progress, success or failure state.
8
+ * @event submit-button-clicked - Fired when a footer button is clicked. Detail: `{ button: key }`.
6
9
  *
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
10
+ * @slot submit-content - Content shown above the progress area.
9
11
  */
10
12
  export declare class PdSubmitDialog extends LitElement {
11
13
  static styles: import('lit').CSSResult[];
@@ -21,7 +23,9 @@ export declare class PdSubmitDialog extends LitElement {
21
23
  confirmMail: string;
22
24
  /** Optional map with custom progress texts */
23
25
  progressTxtMap: Map<number, string>;
24
- /** Internal list of buttons shown in the popup dialog */
26
+ /**
27
+ * Internal list of buttons shown in the popup dialog
28
+ * @ignore */
25
29
  private _buttons;
26
30
  updated(changedProps: PropertyValues<this>): void;
27
31
  private _updateButtonsBasedOnStatus;
@@ -1 +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;AAIlD,OAAO,uCAAuC,CAAC;AAE/C;;;;;;;GAOG;AACH,qBAAa,cAAe,SAAQ,UAAU;IAC5C,OAAgB,MAAM,4BAsDpB;IAEF,mBAAmB;IAEnB,KAAK,SAAwB;IAE7B,yDAAyD;IAEzD,IAAI,EAAE,MAAM,GAAG,UA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- import { StoryObj } from '@storybook/web-components';
1
+ import { Meta, StoryObj } from '@storybook/web-components-vite';
2
2
  import { PdSubmitDialogStatus } from '../types.js';
3
- declare const meta: {
3
+ /**
4
+ * Story arguments interface for pd-submit-dialog component.
5
+ * Maps to the component's public API.
6
+ */
7
+ interface PdSubmitDialogArgs {
8
+ /** Dialog title text */
4
9
  title: string;
5
- component: string;
6
- render: ({ title, status, statusMsg, confirmMail }: import('@storybook/web-components').Args) => import('lit').TemplateResult<1>;
7
- argTypes: {
8
- title: {
9
- control: "text";
10
- };
11
- status: {
12
- control: "select";
13
- options: PdSubmitDialogStatus[];
14
- mapping: {
15
- SEND: PdSubmitDialogStatus;
16
- SUCCESS: PdSubmitDialogStatus;
17
- FAILED: PdSubmitDialogStatus;
18
- };
19
- };
20
- statusMsg: {
21
- control: "text";
22
- };
23
- confirmMail: {
24
- control: "text";
25
- };
26
- };
27
- };
10
+ /** Current status: SEND (1), SUCCESS (2), or FAILED (3) */
11
+ status: PdSubmitDialogStatus;
12
+ /** Optional status message text */
13
+ statusMsg: string;
14
+ /** Confirmation email address */
15
+ confirmMail: string;
16
+ /** Custom progress text map */
17
+ progressTxtMap: Map<number, string>;
18
+ }
19
+ /**
20
+ * ## pd-submit-dialog
21
+ *
22
+ * A progress dialog that shows loading, success, and failure states during async operations.
23
+ *
24
+ * ### Features
25
+ * - Three progress states: SEND (loading spinner), SUCCESS (check icon), FAILED (error icon)
26
+ * - Custom progress text per state via `progressTxtMap`
27
+ * - Optional status message below the progress indicator
28
+ * - Dynamic footer buttons based on current status (no buttons while loading)
29
+ * - Content slot for additional information above the progress area
30
+ * - Built on top of `pd-popup-dialog`
31
+ *
32
+ * ### Status Flow
33
+ * 1. `PdSubmitDialogStatus.SEND` (1) -- Loading spinner, no buttons
34
+ * 2. `PdSubmitDialogStatus.SUCCESS` (2) -- Success icon, "Close" button
35
+ * 3. `PdSubmitDialogStatus.FAILED` (3) -- Error icon, action buttons
36
+ */
37
+ declare const meta: Meta<PdSubmitDialogArgs>;
28
38
  export default meta;
29
- type Story = StoryObj;
30
- export declare const Send: Story;
31
- export declare const Success: Story;
32
- export declare const Failed: Story;
39
+ type Story = StoryObj<PdSubmitDialogArgs>;
40
+ /** Default submit dialog in sending state with loading spinner. Interactive via Controls panel. */
41
+ export declare const Default: Story;
42
+ /** All three progress states side by side: Sending, Success, and Failed. */
43
+ export declare const AllStates: Story;
44
+ /** Dialog in success state with check icon and Close button. */
45
+ export declare const SuccessState: Story;
46
+ /** Dialog in failed state with error icon, status message, and action buttons. */
47
+ export declare const FailedState: Story;
48
+ /** Demonstrates the `submit-content` slot with rich HTML content above the progress area. */
49
+ export declare const WithSlotContent: Story;
33
50
  //# sourceMappingURL=pd-submit-dialog.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pd-submit-dialog.stories.d.ts","sourceRoot":"","sources":["../../src/pd-submit-dialog/pd-submit-dialog.stories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,uBAAuB,CAAC;AAa/B,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;CAmCM,CAAC;AAEjB,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC;AAEtB,eAAO,MAAM,IAAI,EAAE,KAOlB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAOrB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAOpB,CAAC"}
1
+ {"version":3,"file":"pd-submit-dialog.stories.d.ts","sourceRoot":"","sources":["../../src/pd-submit-dialog/pd-submit-dialog.stories.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAGrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,uBAAuB,CAAC;AAM/B;;;GAGG;AACH,UAAU,kBAAkB;IAC1B,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,MAAM,EAAE,oBAAoB,CAAC;IAC7B,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAsBD;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,kBAAkB,CA0FlC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AAM1C,mGAAmG;AACnG,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAMjC,4EAA4E;AAC5E,eAAO,MAAM,SAAS,EAAE,KA0DvB,CAAC;AAMF,gEAAgE;AAChE,eAAO,MAAM,YAAY,EAAE,KA2B1B,CAAC;AAMF,kFAAkF;AAClF,eAAO,MAAM,WAAW,EAAE,KA2BzB,CAAC;AAMF,6FAA6F;AAC7F,eAAO,MAAM,eAAe,EAAE,KAoC7B,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@progressive-development/pd-dialog",
3
- "version": "0.9.2",
3
+ "version": "1.0.1",
4
4
  "description": "Progressive Development dialog components.",
5
5
  "author": "PD Progressive Development",
6
- "license": "SEE LICENSE IN LICENSE",
6
+ "license": "MIT",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
7
10
  "main": "./dist/index.js",
8
11
  "module": "./dist/index.js",
9
12
  "type": "module",
@@ -27,10 +30,10 @@
27
30
  "lit": "^3.3.1",
28
31
  "@lit/localize": "^0.12.2",
29
32
  "tslib": "^2.8.1",
30
- "@progressive-development/pd-icon": "0.9.2",
31
- "@progressive-development/pd-forms": "0.9.2",
32
- "@progressive-development/pd-price": "0.9.2",
33
- "@progressive-development/pd-shared-styles": "0.3.0"
33
+ "@progressive-development/pd-shared-styles": "0.3.2",
34
+ "@progressive-development/pd-icon": "1.0.1",
35
+ "@progressive-development/pd-forms": "1.0.1",
36
+ "@progressive-development/pd-price": "1.0.1"
34
37
  },
35
38
  "customElements": "custom-elements.json",
36
39
  "keywords": [