@progressive-development/pd-dialog 0.9.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) 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 -29
  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 -50
  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/PdSubmitDialog.js +0 -2
  33. package/dist/pd-submit-dialog/pd-submit-dialog.stories.d.ts +46 -29
  34. package/dist/pd-submit-dialog/pd-submit-dialog.stories.d.ts.map +1 -1
  35. package/package.json +10 -7
@@ -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":"AA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AAS;IAEjC,6CAA6C;IAE7C,WAAW,EAAE,OAAO,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,8 +1,7 @@
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
- import { PdColorStyles, PdFontStyles } from '@progressive-development/pd-shared-styles';
6
5
 
7
6
  var __defProp = Object.defineProperty;
8
7
  var __decorateClass = (decorators, target, key, kind) => {
@@ -20,24 +19,27 @@ class PdPopupDialog extends LitElement {
20
19
  this.title = "Popup Title";
21
20
  this.buttons = [];
22
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;
23
26
  this._handleKeyDown = (e) => {
24
27
  if (e.key === "Escape") this.hidePopup();
25
28
  };
26
29
  }
27
30
  static {
28
31
  this.styles = [
29
- PdColorStyles,
30
- PdFontStyles,
31
32
  css`
32
33
  :host {
33
34
  display: block;
35
+ --_dialog-radius: var(--pd-popup-border-radius, var(--pd-radius-lg));
34
36
  }
35
37
 
36
38
  .modal {
37
39
  position: fixed;
38
40
  box-sizing: border-box;
39
41
 
40
- z-index: 100;
42
+ z-index: var(--pd-popup-z-index, 100);
41
43
  left: 0;
42
44
  top: 0;
43
45
  width: 100%;
@@ -45,45 +47,53 @@ class PdPopupDialog extends LitElement {
45
47
  overflow: auto;
46
48
  background-color: var(
47
49
  --pd-popup-modal-bg-rgba,
48
- rgba(175, 193, 210, 0.8)
50
+ var(--pd-modal-overlay-col)
49
51
  );
50
- display: block;
51
- padding: 1rem;
52
+ display: flex;
53
+ justify-content: center;
54
+ align-items: center;
55
+ padding: var(--pd-popup-modal-padding, var(--pd-spacing-md));
52
56
 
53
57
  max-width: 100vw;
54
58
  overflow-x: hidden;
55
59
  }
56
60
 
57
61
  .modal-content {
58
- position: relative;
59
- top: 50%;
60
- transform: translateY(-50%);
61
- margin: 0 auto;
62
+ margin: auto;
62
63
  padding: 0;
63
64
  width: 100%;
64
65
  max-width: var(--pd-popup-max-width, 700px);
65
- border-radius: var(--pd-border-radius, 8px);
66
- border: 1px solid var(--pd-default-light-col);
67
- box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
68
- 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
+ }
69
77
  }
70
78
 
71
79
  .header {
72
80
  display: flex;
73
- gap: 0.5em;
81
+ gap: var(--pd-popup-header-gap, var(--pd-spacing-sm));
74
82
  align-items: center;
75
83
  background-color: var(--pd-popup-header-col, var(--pd-default-col));
76
- height: var(--pd-popup-header-height, 45px);
77
- padding: 0.5rem;
84
+ min-height: var(--pd-popup-header-height, 45px);
85
+ padding: var(--pd-spacing-sm);
78
86
 
79
- border-top-left-radius: var(--pd-border-radius, 8px);
80
- 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);
81
89
  }
82
90
 
83
91
  .header-txt {
84
92
  font-family: var(--pd-default-font-title-family);
85
93
  font-size: var(--pd-popup-header-font-size, 1.3em);
86
94
  color: var(--pd-popup-header-font-col, var(--pd-default-bg-col));
95
+ overflow-wrap: break-word;
96
+ word-break: break-word;
87
97
  }
88
98
 
89
99
  .info-logo {
@@ -96,15 +106,15 @@ class PdPopupDialog extends LitElement {
96
106
 
97
107
  .info,
98
108
  .help {
99
- --pd-icon-col: #6b86ff;
109
+ --pd-icon-col: var(--pd-default-info-col);
100
110
  }
101
111
 
102
112
  .warn {
103
- --pd-icon-col: #ffbf00;
113
+ --pd-icon-col: var(--pd-default-warning-col);
104
114
  }
105
115
 
106
116
  .content {
107
- padding: 1em;
117
+ padding: var(--pd-popup-content-padding, var(--pd-spacing-md));
108
118
  background-color: var(
109
119
  --pd-popup-header-font-col,
110
120
  var(--pd-default-bg-col)
@@ -122,32 +132,26 @@ class PdPopupDialog extends LitElement {
122
132
  align-items: center;
123
133
  justify-content: space-around;
124
134
 
125
- padding: 1em;
135
+ padding: var(--pd-popup-footer-padding, var(--pd-spacing-md));
126
136
 
127
- border-bottom-left-radius: var(--pd-border-radius, 8px);
128
- 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);
129
139
 
130
- --pd-icon-button-width: 100%;
140
+ --pd-button-width: 100%;
131
141
  }
132
142
 
133
- .footer pd-panel-button {
134
- width: 38%;
143
+ .footer pd-button {
144
+ width: var(--pd-popup-footer-button-width, 38%);
135
145
  }
136
146
 
137
- @media (max-width: 640px) {
138
- .footer {
139
- --pd-icon-button-font-size: 100%;
140
- }
141
- }
142
-
143
- @media (max-width: 500px) {
147
+ /* Mobile: stack buttons vertically */
148
+ @media (max-width: 767px) {
144
149
  .footer {
145
150
  flex-direction: column;
146
- gap: 0.5rem;
147
- padding: 1rem;
151
+ gap: var(--pd-spacing-sm);
148
152
  }
149
153
 
150
- .footer pd-panel-button {
154
+ .footer pd-button {
151
155
  width: 90%;
152
156
  }
153
157
  }
@@ -159,20 +163,36 @@ class PdPopupDialog extends LitElement {
159
163
  if (this.closeByEscape) {
160
164
  document.addEventListener("keydown", this._handleKeyDown);
161
165
  }
166
+ if (this.blockScroll) {
167
+ document.body.style.overflow = "hidden";
168
+ this._scrollBlocked = true;
169
+ }
162
170
  }
163
171
  disconnectedCallback() {
164
172
  super.disconnectedCallback();
165
173
  if (this.closeByEscape) {
166
174
  document.removeEventListener("keydown", this._handleKeyDown);
167
175
  }
176
+ if (this._scrollBlocked) {
177
+ document.body.style.overflow = "";
178
+ this._scrollBlocked = false;
179
+ }
168
180
  }
169
181
  render() {
182
+ const titleId = `${this.id || "popup"}-title`;
170
183
  return html`
171
- <div id="modalId" class="modal">
172
- <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}>
173
193
  <div class="header">
174
194
  ${this._renderIcon()}
175
- <span class="header-txt">${this.title}</span>
195
+ <span id="${titleId}" class="header-txt">${this.title}</span>
176
196
  </div>
177
197
  <div class="content">
178
198
  <slot name="content"></slot>
@@ -180,13 +200,13 @@ class PdPopupDialog extends LitElement {
180
200
  <div class="footer">
181
201
  ${this.buttons.map(
182
202
  (bt) => html`
183
- <pd-panel-button
203
+ <pd-button
184
204
  data-key=${bt.key}
185
- buttonText=${bt.name}
205
+ text=${bt.name}
186
206
  ?disabled=${bt.disabled}
187
207
  ?primary=${bt.primary}
188
208
  @button-clicked=${this._onButtonClick}
189
- ></pd-panel-button>
209
+ ></pd-button>
190
210
  `
191
211
  )}
192
212
  </div>
@@ -239,14 +259,25 @@ class PdPopupDialog extends LitElement {
239
259
  * Schließt das Popup-Dialog manuell
240
260
  */
241
261
  hidePopup() {
262
+ if (this._scrollBlocked) {
263
+ document.body.style.overflow = "";
264
+ this._scrollBlocked = false;
265
+ }
242
266
  this._setModalDisplay(false);
243
267
  }
244
268
  _setModalDisplay(visible) {
245
- const modal = this.shadowRoot?.getElementById("modalId");
246
- if (modal) {
247
- modal.style.display = visible ? "block" : "none";
269
+ if (this._modal) {
270
+ this._modal.style.display = visible ? "block" : "none";
248
271
  }
249
272
  }
273
+ _onBackdropClick() {
274
+ if (this.closeByBackdrop) {
275
+ this.hidePopup();
276
+ }
277
+ }
278
+ _stopPropagation(e) {
279
+ e.stopPropagation();
280
+ }
250
281
  }
251
282
  __decorateClass([
252
283
  property({ type: String })
@@ -260,5 +291,14 @@ __decorateClass([
260
291
  __decorateClass([
261
292
  property({ type: Boolean })
262
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");
263
303
 
264
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"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AAO,MAAM,QAAQ,EAAE,KA0DtB,CAAC;AAMF,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,EAAE,KA+DlC,CAAC;AAMF,kGAAkG;AAClG,eAAO,MAAM,mBAAmB,EAAE,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;AAKlD,OAAO,uCAAuC,CAAC;AAE/C;;;;;;;GAOG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,CAAC,IAAI,CAAC;IAMnD,OAAO,CAAC,2BAA2B;IAuB1B,MAAM;IAmBf,OAAO,CAAC,kBAAkB;IAiC1B,OAAO,CAAC,cAAc;CAUvB"}
@@ -2,7 +2,6 @@ import { LitElement, css, html } from 'lit';
2
2
  import { property, state } from 'lit/decorators.js';
3
3
  import { msg } from '@lit/localize';
4
4
  import '@progressive-development/pd-icon/pd-icon';
5
- import { PdColorStyles } from '@progressive-development/pd-shared-styles';
6
5
  import { PdSubmitDialogStatus } from '../types.js';
7
6
  import '../pd-popup-dialog.js';
8
7
 
@@ -28,7 +27,6 @@ class PdSubmitDialog extends LitElement {
28
27
  }
29
28
  static {
30
29
  this.styles = [
31
- PdColorStyles,
32
30
  css`
33
31
  :host {
34
32
  display: block;
@@ -1,33 +1,50 @@
1
- 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,QAA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AC;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.1",
3
+ "version": "1.0.0",
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-shared-styles": "0.3.0",
31
- "@progressive-development/pd-icon": "0.9.1",
32
- "@progressive-development/pd-forms": "0.9.1",
33
- "@progressive-development/pd-price": "0.9.1"
33
+ "@progressive-development/pd-shared-styles": "0.3.1",
34
+ "@progressive-development/pd-icon": "1.0.0",
35
+ "@progressive-development/pd-forms": "1.0.0",
36
+ "@progressive-development/pd-price": "1.0.0"
34
37
  },
35
38
  "customElements": "custom-elements.json",
36
39
  "keywords": [
@@ -45,7 +48,7 @@
45
48
  "scripts": {
46
49
  "analyze": "cem analyze --litelement --exclude dist,demo",
47
50
  "start": "vite",
48
- "build": "vite build",
51
+ "build": "pnpm run analyze && vite build",
49
52
  "preview": "vite preview",
50
53
  "clean": "rm -rf dist",
51
54
  "clean:all": "rm -rf dist node_modules pnpm-lock.yaml",