@mhmo91/schmancy 0.4.47 → 0.4.51

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 (42) hide show
  1. package/ai/dialog.md +163 -124
  2. package/dist/ai/dialog.md +163 -124
  3. package/dist/{avatar-BL7WB4iO.js → avatar-DUhxMuv0.js} +5 -5
  4. package/dist/{avatar-BL7WB4iO.js.map → avatar-DUhxMuv0.js.map} +1 -1
  5. package/dist/{avatar-BiT2LzbV.cjs → avatar-QK4twwTM.cjs} +2 -2
  6. package/dist/{avatar-BiT2LzbV.cjs.map → avatar-QK4twwTM.cjs.map} +1 -1
  7. package/dist/badge.cjs +1 -1
  8. package/dist/badge.js +1 -1
  9. package/dist/button.cjs +1 -1
  10. package/dist/button.js +1 -1
  11. package/dist/content-drawer.cjs +1 -1
  12. package/dist/content-drawer.js +1 -1
  13. package/dist/{date-range-DPZXGoEA.js → date-range-8o_f5N7V.js} +2 -2
  14. package/dist/{date-range-DPZXGoEA.js.map → date-range-8o_f5N7V.js.map} +1 -1
  15. package/dist/{date-range-Cf9ldt-N.cjs → date-range-9NUFmKqd.cjs} +2 -2
  16. package/dist/{date-range-Cf9ldt-N.cjs.map → date-range-9NUFmKqd.cjs.map} +1 -1
  17. package/dist/date-range.cjs +1 -1
  18. package/dist/date-range.js +1 -1
  19. package/dist/{dialog-content-CT6Y3ZLb.js → dialog-content-C_paCOeM.js} +2 -2
  20. package/dist/{dialog-content-CT6Y3ZLb.js.map → dialog-content-C_paCOeM.js.map} +1 -1
  21. package/dist/{dialog-content-tiwbeegi.cjs → dialog-content-tGl9B67L.cjs} +2 -2
  22. package/dist/{dialog-content-tiwbeegi.cjs.map → dialog-content-tGl9B67L.cjs.map} +1 -1
  23. package/dist/{dialog-service-Dm7HJGjx.js → dialog-service-DZv4KB89.js} +5 -2
  24. package/dist/{dialog-service-Dm7HJGjx.js.map → dialog-service-DZv4KB89.js.map} +1 -1
  25. package/dist/{dialog-service-DUDhcx9X.cjs → dialog-service-JNWTLfAy.cjs} +2 -2
  26. package/dist/{dialog-service-DUDhcx9X.cjs.map → dialog-service-JNWTLfAy.cjs.map} +1 -1
  27. package/dist/dialog.cjs +1 -1
  28. package/dist/dialog.js +2 -2
  29. package/dist/{icon-button-BW5ofOL5.js → icon-button-BGvSPuE-.js} +1 -2
  30. package/dist/icon-button-BGvSPuE-.js.map +1 -0
  31. package/dist/{icon-button-9V68mzcL.cjs → icon-button-DbvjV5zJ.cjs} +1 -2
  32. package/dist/icon-button-DbvjV5zJ.cjs.map +1 -0
  33. package/dist/index.cjs +1 -1
  34. package/dist/index.js +5 -5
  35. package/dist/nav-drawer.cjs +1 -1
  36. package/dist/nav-drawer.js +1 -1
  37. package/dist/teleport.cjs +1 -1
  38. package/dist/teleport.js +1 -1
  39. package/package.json +1 -1
  40. package/types/src/dialog/dialog-service.d.ts +10 -0
  41. package/dist/icon-button-9V68mzcL.cjs.map +0 -1
  42. package/dist/icon-button-BW5ofOL5.js.map +0 -1
package/ai/dialog.md CHANGED
@@ -1,138 +1,177 @@
1
1
  # Schmancy Dialog - AI Reference
2
2
 
3
+ ## Quick Start
4
+
5
+ ### Service API (Recommended)
3
6
  ```js
4
- // Basic Dialog Component
5
- <schmancy-dialog
6
- uid?="string"> // Unique identifier for dialog instance
7
- <!-- Dialog content goes here -->
8
- <div>Dialog content</div>
9
- </schmancy-dialog>
10
-
11
- // Dialog Component Methods
12
- dialog.show(position?) -> Promise<boolean> // Show dialog, optionally at a specific position
13
- dialog.hide(result?) -> void // Hide dialog with optional result (true/false)
14
-
15
- // Position can be:
16
- // - Undefined: Centers dialog in viewport
17
- // - Coordinates: { x: number, y: number }
18
- // - MouseEvent: Uses click coordinates
19
- // - TouchEvent: Uses touch coordinates
20
-
21
- // Dialog Events
22
- @close // Fires when dialog is closed
23
-
24
- // CSS Variables
25
- --dialog-width: 360px // Controls dialog width
26
-
27
- // Confirm Dialog Component (used internally by service)
28
- <confirm-dialog
29
- title?="string" // Dialog title
30
- subtitle?="string" // Dialog subtitle
31
- message?="string" // Dialog message
32
- confirm-text?="string" // Confirm button text (default: "Confirm")
33
- cancel-text?="string" // Cancel button text (default: "Cancel")
34
- variant?="default|danger" // Dialog variant (default: "default")
35
- confirm-color?="primary|error|warning|success"> // Confirm button color
36
- <div slot="content">Custom content</div>
37
- </confirm-dialog>
38
-
39
- // Service API (higher-level abstraction)
40
- $dialog.confirm({
41
- title?,
42
- subtitle?,
43
- message?,
44
- confirmText?,
45
- cancelText?,
46
- variant?: "default"|"danger",
47
- confirmColor?: "primary"|"error"|"warning"|"success", // Button color for confirm action
48
- position?: {x,y}|MouseEvent|TouchEvent,
49
- width?: string,
50
- content?: TemplateResult|HTMLElement|Function,
51
- onConfirm?: Function,
52
- onCancel?: Function,
53
- targetContainer?: HTMLElement // Container to append dialog to (uses theme discovery pattern)
54
- }) -> Promise<boolean>
55
-
56
- $dialog.ask(message, event?) -> Promise<boolean>
57
- $dialog.danger({...options}) -> Promise<boolean>
58
- $dialog.component(content, options?) -> Promise<boolean>
59
- $dialog.dismiss() -> boolean // Dismiss most recently opened dialog
60
-
61
- // Examples
62
- // Basic dialog usage
63
- const dialog = document.querySelector('schmancy-dialog');
64
- // Show dialog centered
65
- const result = await dialog.show();
66
- // Show dialog at specific coordinates
67
- const result = await dialog.show({ x: 100, y: 200 });
68
- // Show dialog at click position
69
- button.addEventListener('click', async (e) => {
70
- const result = await dialog.show(e);
71
- console.log('Dialog result:', result);
72
- });
73
-
74
- // Manually hiding dialog
75
- dialog.hide(true); // Hide with positive result
76
- dialog.hide(false); // Hide with negative result
77
-
78
- // Dialog with confirm/cancel buttons
79
- <schmancy-dialog id="confirmDialog">
80
- <div style="padding: 16px;">
81
- <h3>Confirm Action</h3>
82
- <p>Are you sure you want to proceed?</p>
83
- <div style="display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px;">
84
- <schmancy-button variant="text" @click=${() => dialog.hide(false)}>
85
- Cancel
86
- </schmancy-button>
87
- <schmancy-button variant="filled" @click=${() => dialog.hide(true)}>
88
- Confirm
89
- </schmancy-button>
90
- </div>
91
- </div>
92
- </schmancy-dialog>
7
+ import { $dialog } from '@mhmo91/schmancy'
93
8
 
94
- // Using the dialog service
95
9
  // Simple confirmation
96
- const confirmed = await $dialog.ask("Save changes?", event);
10
+ const confirmed = await $dialog.ask("Save changes?")
97
11
 
98
- // Confirmation with custom options
12
+ // Confirmation with options
99
13
  const confirmed = await $dialog.confirm({
100
- title: "Confirm Deletion",
101
- message: "Are you sure you want to delete this item? This action cannot be undone.",
14
+ title: "Delete Item",
15
+ message: "This action cannot be undone.",
102
16
  confirmText: "Delete",
103
- cancelText: "Cancel",
104
- variant: "danger",
105
- position: event
106
- });
17
+ confirmColor: "error" // Makes button red
18
+ })
19
+
20
+ // Custom component dialog
21
+ const result = await $dialog.component(html`
22
+ <div class="p-4">
23
+ <schmancy-input label="Name"></schmancy-input>
24
+ </div>
25
+ `)
26
+
27
+ // Dismiss/close active dialog
28
+ $dialog.dismiss() // or $dialog.close()
29
+ ```
30
+
31
+ ### Component API (Low-level)
32
+ ```js
33
+ // In Lit component template
34
+ html`<schmancy-dialog id="myDialog">
35
+ <div class="p-4">Content here</div>
36
+ </schmancy-dialog>`
37
+
38
+ // In Lit component class
39
+ @query('#myDialog') dialog!: SchmancyDialog
40
+
41
+ // Show dialog (returns promise)
42
+ const result = await this.dialog.show() // Centered
43
+ const result = await this.dialog.show(event) // At click position
44
+ const result = await this.dialog.show({x, y}) // At coordinates
45
+
46
+ // Hide dialog
47
+ this.dialog.hide(true) // Resolve with true
48
+ this.dialog.hide(false) // Resolve with false
49
+ ```
50
+
51
+ ## Service Methods
107
52
 
108
- // Confirmation with colored button
53
+ ### $dialog.confirm(options)
54
+ Shows a confirmation dialog with title, message, and buttons.
55
+
56
+ ```js
57
+ options = {
58
+ title?: string, // Dialog title
59
+ subtitle?: string, // Subtitle below title
60
+ message?: string, // Main message
61
+ confirmText?: string, // Confirm button text (default: "Confirm")
62
+ cancelText?: string, // Cancel button text (default: "Cancel")
63
+ variant?: "default"|"danger",// Style variant
64
+ confirmColor?: "primary"|"error"|"warning"|"success", // Button color
65
+ position?: {x,y}|Event, // Position (default: centered)
66
+ width?: string, // Dialog width (default: "360px")
67
+ content?: TemplateResult, // Custom content (replaces message)
68
+ onConfirm?: Function, // Confirm callback
69
+ onCancel?: Function, // Cancel callback
70
+ targetContainer?: HTMLElement // Where to append dialog
71
+ }
72
+ ```
73
+
74
+ ### $dialog.ask(message, event?)
75
+ Simple confirmation with just a message.
76
+
77
+ ### $dialog.danger(options)
78
+ Confirmation dialog with danger styling (same options as confirm, variant forced to "danger").
79
+
80
+ ### $dialog.component(content, options?)
81
+ Shows dialog with custom content, no built-in buttons or title.
82
+
83
+ ```js
84
+ content = TemplateResult | HTMLElement | (() => TemplateResult|HTMLElement)
85
+ options = {
86
+ position?: {x,y}|Event,
87
+ width?: string,
88
+ targetContainer?: HTMLElement
89
+ }
90
+ ```
91
+
92
+ ### $dialog.dismiss()
93
+ Dismisses the most recently opened dialog. Returns true if a dialog was dismissed.
94
+
95
+ ### $dialog.close()
96
+ Alias for `$dialog.dismiss()`. Closes the most recently opened dialog. Returns true if a dialog was closed.
97
+
98
+ ## Component Structure
99
+
100
+ ### schmancy-dialog
101
+ Basic dialog container without built-in UI.
102
+ - Shows overlay and positioned container
103
+ - Handles positioning (centered or at coordinates)
104
+ - Emits `close` event
105
+ - CSS variable: `--dialog-width`
106
+
107
+ ### confirm-dialog
108
+ Extended dialog with title, message, and action buttons.
109
+ - All features of schmancy-dialog
110
+ - Built-in form with confirm/cancel buttons
111
+ - Supports custom content via slot
112
+ - Button colors based on `confirmColor` property
113
+
114
+ ## Positioning
115
+
116
+ Dialogs can be positioned:
117
+ 1. **Centered** (default) - Centers in viewport with slight upward shift
118
+ 2. **At event** - Opens at click/touch position
119
+ 3. **At coordinates** - Opens at specific {x, y}
120
+
121
+ Positioning automatically adjusts to stay within viewport using Floating UI.
122
+
123
+ ## Examples
124
+
125
+ ### Delete confirmation with red button
126
+ ```js
109
127
  const confirmed = await $dialog.confirm({
110
128
  title: "Delete Transaction",
111
- message: `Are you sure you want to delete this transaction of ${amount} units?`,
129
+ message: "Are you sure you want to delete this transaction?",
112
130
  confirmText: "Delete",
113
- cancelText: "Cancel",
114
- confirmColor: "error", // Makes confirm button red
115
- });
131
+ confirmColor: "error"
132
+ })
133
+ ```
116
134
 
117
- // Dialog with custom content
135
+ ### Form in dialog
136
+ ```js
118
137
  const result = await $dialog.component(html`
119
- <div>
120
- <schmancy-input id="nameInput" label="Your Name"></schmancy-input>
121
- </div>
122
- `, {
123
- title: "Enter Name",
124
- confirmText: "Submit",
125
- onConfirm: () => {
126
- const value = document.getElementById("nameInput").value;
127
- return value ? true : false;
128
- }
129
- });
130
-
131
- // Dialog for dangerous actions
132
- const confirmed = await $dialog.danger({
133
- title: "Warning",
134
- message: "You are about to delete your account. This action is permanent.",
135
- confirmText: "Delete Account",
136
- position: event
137
- });
138
- ```
138
+ <schmancy-form class="p-4">
139
+ <schmancy-input label="Email" type="email" required></schmancy-input>
140
+ <schmancy-input label="Password" type="password" required></schmancy-input>
141
+ <div class="flex gap-2 mt-4">
142
+ <schmancy-button @click=${() => $dialog.close()}>Cancel</schmancy-button>
143
+ <schmancy-button type="submit">Login</schmancy-button>
144
+ </div>
145
+ </schmancy-form>
146
+ `)
147
+ ```
148
+
149
+ ### Context menu at click position
150
+ ```js
151
+ // In Lit component
152
+ async handleContextMenu(e: MouseEvent) {
153
+ const action = await $dialog.component(html`
154
+ <schmancy-list>
155
+ <schmancy-list-item @click=${() => $dialog.dismiss()}>Edit</schmancy-list-item>
156
+ <schmancy-list-item @click=${() => $dialog.dismiss()}>Delete</schmancy-list-item>
157
+ </schmancy-list>
158
+ `, { position: e, width: '200px' })
159
+
160
+ console.log('Selected:', action)
161
+ }
162
+
163
+ render() {
164
+ return html`
165
+ <schmancy-button @click=${this.handleContextMenu}>Options</schmancy-button>
166
+ `
167
+ }
168
+ ```
169
+
170
+ ## Important Notes
171
+
172
+ 1. **Service is singleton** - All dialogs managed centrally
173
+ 2. **Auto-cleanup** - Dialogs removed from DOM after closing
174
+ 3. **Theme-aware** - Dialogs attach to nearest `<schmancy-theme>` element
175
+ 4. **Stacking** - Multiple dialogs stack with proper z-index
176
+ 5. **Responsive** - Dialogs resize and reposition on viewport changes
177
+ 6. **Keyboard** - ESC key triggers cancel (via overlay click)
package/dist/ai/dialog.md CHANGED
@@ -1,138 +1,177 @@
1
1
  # Schmancy Dialog - AI Reference
2
2
 
3
+ ## Quick Start
4
+
5
+ ### Service API (Recommended)
3
6
  ```js
4
- // Basic Dialog Component
5
- <schmancy-dialog
6
- uid?="string"> // Unique identifier for dialog instance
7
- <!-- Dialog content goes here -->
8
- <div>Dialog content</div>
9
- </schmancy-dialog>
10
-
11
- // Dialog Component Methods
12
- dialog.show(position?) -> Promise<boolean> // Show dialog, optionally at a specific position
13
- dialog.hide(result?) -> void // Hide dialog with optional result (true/false)
14
-
15
- // Position can be:
16
- // - Undefined: Centers dialog in viewport
17
- // - Coordinates: { x: number, y: number }
18
- // - MouseEvent: Uses click coordinates
19
- // - TouchEvent: Uses touch coordinates
20
-
21
- // Dialog Events
22
- @close // Fires when dialog is closed
23
-
24
- // CSS Variables
25
- --dialog-width: 360px // Controls dialog width
26
-
27
- // Confirm Dialog Component (used internally by service)
28
- <confirm-dialog
29
- title?="string" // Dialog title
30
- subtitle?="string" // Dialog subtitle
31
- message?="string" // Dialog message
32
- confirm-text?="string" // Confirm button text (default: "Confirm")
33
- cancel-text?="string" // Cancel button text (default: "Cancel")
34
- variant?="default|danger" // Dialog variant (default: "default")
35
- confirm-color?="primary|error|warning|success"> // Confirm button color
36
- <div slot="content">Custom content</div>
37
- </confirm-dialog>
38
-
39
- // Service API (higher-level abstraction)
40
- $dialog.confirm({
41
- title?,
42
- subtitle?,
43
- message?,
44
- confirmText?,
45
- cancelText?,
46
- variant?: "default"|"danger",
47
- confirmColor?: "primary"|"error"|"warning"|"success", // Button color for confirm action
48
- position?: {x,y}|MouseEvent|TouchEvent,
49
- width?: string,
50
- content?: TemplateResult|HTMLElement|Function,
51
- onConfirm?: Function,
52
- onCancel?: Function,
53
- targetContainer?: HTMLElement // Container to append dialog to (uses theme discovery pattern)
54
- }) -> Promise<boolean>
55
-
56
- $dialog.ask(message, event?) -> Promise<boolean>
57
- $dialog.danger({...options}) -> Promise<boolean>
58
- $dialog.component(content, options?) -> Promise<boolean>
59
- $dialog.dismiss() -> boolean // Dismiss most recently opened dialog
60
-
61
- // Examples
62
- // Basic dialog usage
63
- const dialog = document.querySelector('schmancy-dialog');
64
- // Show dialog centered
65
- const result = await dialog.show();
66
- // Show dialog at specific coordinates
67
- const result = await dialog.show({ x: 100, y: 200 });
68
- // Show dialog at click position
69
- button.addEventListener('click', async (e) => {
70
- const result = await dialog.show(e);
71
- console.log('Dialog result:', result);
72
- });
73
-
74
- // Manually hiding dialog
75
- dialog.hide(true); // Hide with positive result
76
- dialog.hide(false); // Hide with negative result
77
-
78
- // Dialog with confirm/cancel buttons
79
- <schmancy-dialog id="confirmDialog">
80
- <div style="padding: 16px;">
81
- <h3>Confirm Action</h3>
82
- <p>Are you sure you want to proceed?</p>
83
- <div style="display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px;">
84
- <schmancy-button variant="text" @click=${() => dialog.hide(false)}>
85
- Cancel
86
- </schmancy-button>
87
- <schmancy-button variant="filled" @click=${() => dialog.hide(true)}>
88
- Confirm
89
- </schmancy-button>
90
- </div>
91
- </div>
92
- </schmancy-dialog>
7
+ import { $dialog } from '@mhmo91/schmancy'
93
8
 
94
- // Using the dialog service
95
9
  // Simple confirmation
96
- const confirmed = await $dialog.ask("Save changes?", event);
10
+ const confirmed = await $dialog.ask("Save changes?")
97
11
 
98
- // Confirmation with custom options
12
+ // Confirmation with options
99
13
  const confirmed = await $dialog.confirm({
100
- title: "Confirm Deletion",
101
- message: "Are you sure you want to delete this item? This action cannot be undone.",
14
+ title: "Delete Item",
15
+ message: "This action cannot be undone.",
102
16
  confirmText: "Delete",
103
- cancelText: "Cancel",
104
- variant: "danger",
105
- position: event
106
- });
17
+ confirmColor: "error" // Makes button red
18
+ })
19
+
20
+ // Custom component dialog
21
+ const result = await $dialog.component(html`
22
+ <div class="p-4">
23
+ <schmancy-input label="Name"></schmancy-input>
24
+ </div>
25
+ `)
26
+
27
+ // Dismiss/close active dialog
28
+ $dialog.dismiss() // or $dialog.close()
29
+ ```
30
+
31
+ ### Component API (Low-level)
32
+ ```js
33
+ // In Lit component template
34
+ html`<schmancy-dialog id="myDialog">
35
+ <div class="p-4">Content here</div>
36
+ </schmancy-dialog>`
37
+
38
+ // In Lit component class
39
+ @query('#myDialog') dialog!: SchmancyDialog
40
+
41
+ // Show dialog (returns promise)
42
+ const result = await this.dialog.show() // Centered
43
+ const result = await this.dialog.show(event) // At click position
44
+ const result = await this.dialog.show({x, y}) // At coordinates
45
+
46
+ // Hide dialog
47
+ this.dialog.hide(true) // Resolve with true
48
+ this.dialog.hide(false) // Resolve with false
49
+ ```
50
+
51
+ ## Service Methods
107
52
 
108
- // Confirmation with colored button
53
+ ### $dialog.confirm(options)
54
+ Shows a confirmation dialog with title, message, and buttons.
55
+
56
+ ```js
57
+ options = {
58
+ title?: string, // Dialog title
59
+ subtitle?: string, // Subtitle below title
60
+ message?: string, // Main message
61
+ confirmText?: string, // Confirm button text (default: "Confirm")
62
+ cancelText?: string, // Cancel button text (default: "Cancel")
63
+ variant?: "default"|"danger",// Style variant
64
+ confirmColor?: "primary"|"error"|"warning"|"success", // Button color
65
+ position?: {x,y}|Event, // Position (default: centered)
66
+ width?: string, // Dialog width (default: "360px")
67
+ content?: TemplateResult, // Custom content (replaces message)
68
+ onConfirm?: Function, // Confirm callback
69
+ onCancel?: Function, // Cancel callback
70
+ targetContainer?: HTMLElement // Where to append dialog
71
+ }
72
+ ```
73
+
74
+ ### $dialog.ask(message, event?)
75
+ Simple confirmation with just a message.
76
+
77
+ ### $dialog.danger(options)
78
+ Confirmation dialog with danger styling (same options as confirm, variant forced to "danger").
79
+
80
+ ### $dialog.component(content, options?)
81
+ Shows dialog with custom content, no built-in buttons or title.
82
+
83
+ ```js
84
+ content = TemplateResult | HTMLElement | (() => TemplateResult|HTMLElement)
85
+ options = {
86
+ position?: {x,y}|Event,
87
+ width?: string,
88
+ targetContainer?: HTMLElement
89
+ }
90
+ ```
91
+
92
+ ### $dialog.dismiss()
93
+ Dismisses the most recently opened dialog. Returns true if a dialog was dismissed.
94
+
95
+ ### $dialog.close()
96
+ Alias for `$dialog.dismiss()`. Closes the most recently opened dialog. Returns true if a dialog was closed.
97
+
98
+ ## Component Structure
99
+
100
+ ### schmancy-dialog
101
+ Basic dialog container without built-in UI.
102
+ - Shows overlay and positioned container
103
+ - Handles positioning (centered or at coordinates)
104
+ - Emits `close` event
105
+ - CSS variable: `--dialog-width`
106
+
107
+ ### confirm-dialog
108
+ Extended dialog with title, message, and action buttons.
109
+ - All features of schmancy-dialog
110
+ - Built-in form with confirm/cancel buttons
111
+ - Supports custom content via slot
112
+ - Button colors based on `confirmColor` property
113
+
114
+ ## Positioning
115
+
116
+ Dialogs can be positioned:
117
+ 1. **Centered** (default) - Centers in viewport with slight upward shift
118
+ 2. **At event** - Opens at click/touch position
119
+ 3. **At coordinates** - Opens at specific {x, y}
120
+
121
+ Positioning automatically adjusts to stay within viewport using Floating UI.
122
+
123
+ ## Examples
124
+
125
+ ### Delete confirmation with red button
126
+ ```js
109
127
  const confirmed = await $dialog.confirm({
110
128
  title: "Delete Transaction",
111
- message: `Are you sure you want to delete this transaction of ${amount} units?`,
129
+ message: "Are you sure you want to delete this transaction?",
112
130
  confirmText: "Delete",
113
- cancelText: "Cancel",
114
- confirmColor: "error", // Makes confirm button red
115
- });
131
+ confirmColor: "error"
132
+ })
133
+ ```
116
134
 
117
- // Dialog with custom content
135
+ ### Form in dialog
136
+ ```js
118
137
  const result = await $dialog.component(html`
119
- <div>
120
- <schmancy-input id="nameInput" label="Your Name"></schmancy-input>
121
- </div>
122
- `, {
123
- title: "Enter Name",
124
- confirmText: "Submit",
125
- onConfirm: () => {
126
- const value = document.getElementById("nameInput").value;
127
- return value ? true : false;
128
- }
129
- });
130
-
131
- // Dialog for dangerous actions
132
- const confirmed = await $dialog.danger({
133
- title: "Warning",
134
- message: "You are about to delete your account. This action is permanent.",
135
- confirmText: "Delete Account",
136
- position: event
137
- });
138
- ```
138
+ <schmancy-form class="p-4">
139
+ <schmancy-input label="Email" type="email" required></schmancy-input>
140
+ <schmancy-input label="Password" type="password" required></schmancy-input>
141
+ <div class="flex gap-2 mt-4">
142
+ <schmancy-button @click=${() => $dialog.close()}>Cancel</schmancy-button>
143
+ <schmancy-button type="submit">Login</schmancy-button>
144
+ </div>
145
+ </schmancy-form>
146
+ `)
147
+ ```
148
+
149
+ ### Context menu at click position
150
+ ```js
151
+ // In Lit component
152
+ async handleContextMenu(e: MouseEvent) {
153
+ const action = await $dialog.component(html`
154
+ <schmancy-list>
155
+ <schmancy-list-item @click=${() => $dialog.dismiss()}>Edit</schmancy-list-item>
156
+ <schmancy-list-item @click=${() => $dialog.dismiss()}>Delete</schmancy-list-item>
157
+ </schmancy-list>
158
+ `, { position: e, width: '200px' })
159
+
160
+ console.log('Selected:', action)
161
+ }
162
+
163
+ render() {
164
+ return html`
165
+ <schmancy-button @click=${this.handleContextMenu}>Options</schmancy-button>
166
+ `
167
+ }
168
+ ```
169
+
170
+ ## Important Notes
171
+
172
+ 1. **Service is singleton** - All dialogs managed centrally
173
+ 2. **Auto-cleanup** - Dialogs removed from DOM after closing
174
+ 3. **Theme-aware** - Dialogs attach to nearest `<schmancy-theme>` element
175
+ 4. **Stacking** - Multiple dialogs stack with proper z-index
176
+ 5. **Responsive** - Dialogs resize and reposition on viewport changes
177
+ 6. **Keyboard** - ESC key triggers cancel (via overlay click)
@@ -10,7 +10,7 @@ import { T as ht } from "./tailwind.mixin-CaIkmP6j.js";
10
10
  import { c as U, f as Ot } from "./ripple-BumgqsDT.js";
11
11
  import "./boat-C_BvtlNQ.js";
12
12
  import "./spinner-CbA-FXRK.js";
13
- import "./icon-button-BW5ofOL5.js";
13
+ import "./icon-button-BGvSPuE-.js";
14
14
  import "./media-BO-aZBTp.js";
15
15
  import "./checkbox-BSYgpRsc.js";
16
16
  import "./chips-Dn8RpKCE.js";
@@ -21,11 +21,11 @@ import { SchmancyEvents as m } from "./types.js";
21
21
  import { n as j, e as M } from "./provide-tcktw8xB.js";
22
22
  import { $ as E } from "./litElement.mixin-BH9PTyUD.js";
23
23
  import { c as h } from "./consume-5D1qfVWM.js";
24
- import "./date-range-DPZXGoEA.js";
24
+ import "./date-range-8o_f5N7V.js";
25
25
  import "./date-range-inline-B_K4YPtB.js";
26
26
  import "./delay-D415_oVH.js";
27
- import "./dialog-content-CT6Y3ZLb.js";
28
- import "./dialog-service-Dm7HJGjx.js";
27
+ import "./dialog-content-C_paCOeM.js";
28
+ import "./dialog-service-DZv4KB89.js";
29
29
  import "./divider-Dn26vIou.js";
30
30
  import "./dropdown-content-DOnGrBxV.js";
31
31
  import "./timezone-Cvsd--fr.js";
@@ -631,4 +631,4 @@ export {
631
631
  ss as s,
632
632
  H as t
633
633
  };
634
- //# sourceMappingURL=avatar-BL7WB4iO.js.map
634
+ //# sourceMappingURL=avatar-DUhxMuv0.js.map