mtrl 0.3.1 → 0.3.2

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 (159) hide show
  1. package/.env +15 -0
  2. package/CONTRIBUTING.md +8 -8
  3. package/DOCS.md +3 -3
  4. package/README.md +43 -20
  5. package/TESTING.md +128 -18
  6. package/dist/index.js +14865 -0
  7. package/git-user-stats.js +545 -0
  8. package/index.ts +9 -67
  9. package/package.json +8 -3
  10. package/src/components/badge/api.ts +15 -1
  11. package/src/components/badge/badge.ts +43 -4
  12. package/src/components/badge/config.ts +40 -8
  13. package/src/components/badge/index.ts +64 -3
  14. package/src/components/badge/types.ts +175 -33
  15. package/src/components/button/api.ts +63 -1
  16. package/src/components/button/button.ts +39 -3
  17. package/src/components/button/config.ts +21 -4
  18. package/src/components/button/index.ts +26 -1
  19. package/src/components/button/types.ts +7 -1
  20. package/src/components/card/api.ts +78 -9
  21. package/src/components/card/card.ts +58 -3
  22. package/src/components/card/config.ts +41 -11
  23. package/src/components/card/features.ts +39 -12
  24. package/src/components/card/index.ts +84 -19
  25. package/src/components/card/types.ts +218 -29
  26. package/src/components/carousel/carousel.ts +92 -28
  27. package/src/components/carousel/constants.ts +107 -21
  28. package/src/components/carousel/index.ts +31 -13
  29. package/src/components/checkbox/checkbox.ts +83 -16
  30. package/src/components/checkbox/index.ts +43 -1
  31. package/src/components/checkbox/types.ts +219 -32
  32. package/src/components/chips/api.ts +194 -0
  33. package/src/components/{chip → chips/chip}/api.ts +42 -2
  34. package/src/components/chips/chip/chip.ts +131 -0
  35. package/src/components/{chip → chips/chip}/config.ts +3 -3
  36. package/src/components/chips/chip/index.ts +3 -0
  37. package/src/components/chips/chips.md +481 -0
  38. package/src/components/chips/chips.ts +75 -0
  39. package/src/components/chips/config.ts +109 -0
  40. package/src/components/chips/constants.ts +61 -0
  41. package/src/components/chips/features/chip-items.ts +33 -0
  42. package/src/components/chips/features/container.ts +77 -0
  43. package/src/components/chips/features/controller.ts +448 -0
  44. package/src/components/chips/features/index.ts +5 -0
  45. package/src/components/chips/features/label.ts +108 -0
  46. package/src/components/chips/index.ts +11 -0
  47. package/src/components/chips/schema.ts +61 -0
  48. package/src/components/{chip → chips}/types.ts +203 -92
  49. package/src/components/dialog/dialog.ts +99 -16
  50. package/src/components/dialog/index.ts +97 -1
  51. package/src/components/dialog/types.ts +375 -69
  52. package/src/components/divider/config.ts +90 -6
  53. package/src/components/divider/divider.ts +32 -2
  54. package/src/components/divider/features.ts +26 -0
  55. package/src/components/divider/index.ts +30 -0
  56. package/src/components/divider/types.ts +86 -9
  57. package/src/components/extended-fab/api.ts +53 -1
  58. package/src/components/extended-fab/config.ts +29 -1
  59. package/src/components/extended-fab/extended-fab.ts +28 -0
  60. package/src/components/extended-fab/index.ts +36 -0
  61. package/src/components/extended-fab/types.ts +458 -13
  62. package/src/components/fab/api.ts +42 -2
  63. package/src/components/fab/config.ts +29 -1
  64. package/src/components/fab/fab.ts +16 -2
  65. package/src/components/fab/index.ts +35 -0
  66. package/src/components/fab/types.ts +374 -10
  67. package/src/components/list/api.ts +12 -2
  68. package/src/components/list/config.ts +21 -0
  69. package/src/components/list/features.ts +6 -0
  70. package/src/components/list/index.ts +56 -1
  71. package/src/components/list/list-item.ts +46 -2
  72. package/src/components/list/list.ts +73 -2
  73. package/src/components/list/types.ts +172 -0
  74. package/src/components/list/utils.ts +26 -2
  75. package/src/components/menu/api.ts +217 -20
  76. package/src/components/menu/config.ts +27 -0
  77. package/src/components/menu/features/visibility.ts +55 -6
  78. package/src/components/menu/index.ts +64 -0
  79. package/src/components/menu/menu-item.ts +46 -3
  80. package/src/components/menu/menu.ts +77 -1
  81. package/src/components/menu/types.ts +404 -39
  82. package/src/components/sheet/config.ts +1 -2
  83. package/src/components/sheet/features/gestures.ts +1 -1
  84. package/src/components/sheet/features/position.ts +1 -2
  85. package/src/components/sheet/features/state.ts +1 -1
  86. package/src/components/sheet/index.ts +10 -2
  87. package/src/components/sheet/sheet.ts +1 -2
  88. package/src/components/sheet/types.ts +29 -1
  89. package/src/components/slider/api.ts +1 -1
  90. package/src/components/slider/config.ts +1 -1
  91. package/src/components/slider/features/controller.ts +1 -1
  92. package/src/components/slider/features/handlers.ts +1 -1
  93. package/src/components/slider/features/states.ts +1 -1
  94. package/src/components/slider/index.ts +12 -5
  95. package/src/components/slider/schema.ts +1 -1
  96. package/src/components/slider/types.ts +31 -0
  97. package/src/components/tabs/tab-api.ts +1 -1
  98. package/src/components/tabs/types.ts +1 -1
  99. package/src/components/tooltip/api.ts +6 -2
  100. package/src/components/tooltip/config.ts +9 -28
  101. package/src/components/tooltip/index.ts +10 -1
  102. package/src/components/tooltip/types.ts +38 -3
  103. package/src/index.ts +129 -31
  104. package/src/styles/abstract/_mixins.scss +23 -9
  105. package/src/styles/abstract/_variables.scss +14 -4
  106. package/src/styles/components/_card.scss +1 -1
  107. package/src/styles/components/_chip.scss +323 -113
  108. package/src/styles/components/_tabs.scss +1 -1
  109. package/CLAUDE.md +0 -33
  110. package/src/components/checkbox/constants.ts +0 -37
  111. package/src/components/chip/chip-set.ts +0 -225
  112. package/src/components/chip/chip.ts +0 -118
  113. package/src/components/chip/constants.ts +0 -28
  114. package/src/components/chip/index.ts +0 -12
  115. package/src/components/list/constants.ts +0 -116
  116. package/src/components/sheet/constants.ts +0 -20
  117. package/src/components/slider/constants.ts +0 -32
  118. package/src/components/tooltip/constants.ts +0 -27
  119. package/test/components/badge.test.ts +0 -545
  120. package/test/components/bottom-app-bar.test.ts +0 -303
  121. package/test/components/button.test.ts +0 -233
  122. package/test/components/card.test.ts +0 -560
  123. package/test/components/carousel.test.ts +0 -951
  124. package/test/components/checkbox.test.ts +0 -462
  125. package/test/components/chip.test.ts +0 -692
  126. package/test/components/datepicker.test.ts +0 -1124
  127. package/test/components/dialog.test.ts +0 -990
  128. package/test/components/divider.test.ts +0 -412
  129. package/test/components/extended-fab.test.ts +0 -672
  130. package/test/components/fab.test.ts +0 -561
  131. package/test/components/list.test.ts +0 -365
  132. package/test/components/menu.test.ts +0 -718
  133. package/test/components/navigation.test.ts +0 -186
  134. package/test/components/progress.test.ts +0 -567
  135. package/test/components/radios.test.ts +0 -699
  136. package/test/components/search.test.ts +0 -1135
  137. package/test/components/segmented-button.test.ts +0 -732
  138. package/test/components/sheet.test.ts +0 -641
  139. package/test/components/slider.test.ts +0 -1220
  140. package/test/components/snackbar.test.ts +0 -461
  141. package/test/components/switch.test.ts +0 -452
  142. package/test/components/tabs.test.ts +0 -1369
  143. package/test/components/textfield.test.ts +0 -400
  144. package/test/components/timepicker.test.ts +0 -592
  145. package/test/components/tooltip.test.ts +0 -630
  146. package/test/components/top-app-bar.test.ts +0 -566
  147. package/test/core/dom.attributes.test.ts +0 -148
  148. package/test/core/dom.classes.test.ts +0 -152
  149. package/test/core/dom.events.test.ts +0 -243
  150. package/test/core/emitter.test.ts +0 -141
  151. package/test/core/ripple.test.ts +0 -99
  152. package/test/core/state.store.test.ts +0 -189
  153. package/test/core/utils.normalize.test.ts +0 -61
  154. package/test/core/utils.object.test.ts +0 -120
  155. package/test/setup.js +0 -371
  156. package/test/setup.ts +0 -451
  157. package/tsconfig.json +0 -22
  158. package/typedoc.json +0 -28
  159. package/typedoc.simple.json +0 -14
@@ -1,91 +1,195 @@
1
1
  // src/components/dialog/types.ts
2
2
 
3
3
  /**
4
- * Dialog size types
4
+ * Dialog size types - determines the width and height of the dialog
5
+ *
5
6
  * @category Components
7
+ * @remarks
8
+ * - small: 320px width, for simple messages or choices
9
+ * - medium: 560px width, for standard forms or content (default)
10
+ * - large: 800px width, for complex forms or rich content
11
+ * - fullwidth: Spans the full width of the viewport with margins
12
+ * - fullscreen: Takes up the entire viewport (similar to a new page)
6
13
  */
7
14
  export type DialogSize = 'small' | 'medium' | 'large' | 'fullwidth' | 'fullscreen';
8
15
 
9
16
  /**
10
- * Dialog animation types
17
+ * Dialog animation types - controls how the dialog appears and disappears
18
+ *
11
19
  * @category Components
20
+ * @remarks
21
+ * - scale: Scale up/down animation from center (default)
22
+ * - slide-up: Slide in from bottom, slide out to bottom
23
+ * - slide-down: Slide in from top, slide out to top
24
+ * - fade: Simple fade in/out animation
12
25
  */
13
26
  export type DialogAnimation = 'scale' | 'slide-up' | 'slide-down' | 'fade';
14
27
 
15
28
  /**
16
- * Dialog footer alignment types
29
+ * Dialog footer alignment types - controls how buttons in the footer are aligned
30
+ *
17
31
  * @category Components
32
+ * @remarks
33
+ * - right: Align buttons to the right (default, follows Material Design guidelines)
34
+ * - left: Align buttons to the left
35
+ * - center: Center buttons in footer
36
+ * - space-between: Space buttons evenly, with first button at left, last at right
18
37
  */
19
38
  export type DialogFooterAlignment = 'right' | 'left' | 'center' | 'space-between';
20
39
 
21
40
  /**
22
- * Dialog event types
41
+ * Dialog event types - events that can be listened to with the on() method
42
+ *
23
43
  * @category Components
44
+ * @remarks
45
+ * - open: Fired when the dialog begins opening
46
+ * - close: Fired when the dialog begins closing
47
+ * - beforeopen: Fired before the dialog starts opening (can be prevented)
48
+ * - beforeclose: Fired before the dialog starts closing (can be prevented)
49
+ * - afteropen: Fired after the dialog has fully opened (animation complete)
50
+ * - afterclose: Fired after the dialog has fully closed (animation complete)
24
51
  */
25
52
  export type DialogEventType = 'open' | 'close' | 'beforeopen' | 'beforeclose' | 'afteropen' | 'afterclose';
26
53
 
27
54
  /**
28
55
  * Configuration interface for the Dialog component
56
+ *
57
+ * @category Components
58
+ * @description
59
+ * Defines the appearance and behavior of a dialog component.
60
+ * All properties are optional with sensible defaults.
29
61
  */
30
62
  export interface DialogConfig {
31
- /** Dialog title text */
63
+ /**
64
+ * Dialog title text - appears in the header
65
+ * @example "Settings"
66
+ */
32
67
  title?: string;
33
68
 
34
- /** Dialog subtitle text */
69
+ /**
70
+ * Dialog subtitle text - appears below title in smaller text
71
+ * @example "Configure your preferences"
72
+ */
35
73
  subtitle?: string;
36
74
 
37
- /** Dialog content (text or HTML) */
75
+ /**
76
+ * Dialog content (text or HTML)
77
+ * Can include rich content like forms, images, etc.
78
+ * @example "This action cannot be undone."
79
+ */
38
80
  content?: string;
39
81
 
40
- /** Whether to show close button in header */
82
+ /**
83
+ * Whether to show close button (X) in the header
84
+ * @default true
85
+ */
41
86
  closeButton?: boolean;
42
87
 
43
- /** CSS class to add to dialog */
88
+ /**
89
+ * Additional CSS classes to apply to the dialog
90
+ * @example "settings-dialog important-dialog"
91
+ */
44
92
  class?: string;
45
93
 
46
- /** Dialog size variant */
94
+ /**
95
+ * Dialog size variant
96
+ * Controls the width and height of the dialog
97
+ * @default "medium"
98
+ */
47
99
  size?: DialogSize | string;
48
100
 
49
- /** Dialog animation variant */
101
+ /**
102
+ * Dialog animation variant
103
+ * Controls how the dialog appears and disappears
104
+ * @default "scale"
105
+ */
50
106
  animation?: DialogAnimation | string;
51
107
 
52
- /** Footer buttons alignment */
108
+ /**
109
+ * Footer buttons alignment
110
+ * Controls how buttons in the footer are positioned
111
+ * @default "right"
112
+ */
53
113
  footerAlignment?: DialogFooterAlignment | string;
54
114
 
55
- /** Whether dialog is initially open */
115
+ /**
116
+ * Whether dialog is initially open
117
+ * @default false
118
+ */
56
119
  open?: boolean;
57
120
 
58
- /** Whether to close when clicking overlay */
121
+ /**
122
+ * Whether to close when clicking overlay background
123
+ * When true, allows users to dismiss by clicking outside
124
+ * @default true
125
+ */
59
126
  closeOnOverlayClick?: boolean;
60
127
 
61
- /** Whether to close when Escape key is pressed */
128
+ /**
129
+ * Whether to close when Escape key is pressed
130
+ * @default true
131
+ */
62
132
  closeOnEscape?: boolean;
63
133
 
64
- /** Whether dialog should be modal (prevent interaction with background) */
134
+ /**
135
+ * Whether dialog should be modal
136
+ * When true, prevents interaction with background content
137
+ * @default true
138
+ */
65
139
  modal?: boolean;
66
140
 
67
- /** Whether to focus the first focusable element when opened */
141
+ /**
142
+ * Whether to focus the first focusable element when opened
143
+ * Important for accessibility and keyboard navigation
144
+ * @default true
145
+ */
68
146
  autofocus?: boolean;
69
147
 
70
- /** Whether to trap focus within dialog when opened */
148
+ /**
149
+ * Whether to trap focus within dialog when opened
150
+ * Prevents tabbing outside the dialog, improving accessibility
151
+ * @default true
152
+ */
71
153
  trapFocus?: boolean;
72
154
 
73
- /** Parent element to append dialog to (defaults to document.body) */
155
+ /**
156
+ * Parent element to append dialog to
157
+ * @default document.body
158
+ */
74
159
  container?: HTMLElement;
75
160
 
76
- /** Footer buttons configuration */
161
+ /**
162
+ * Footer buttons configuration
163
+ * Array of button objects to display in the footer
164
+ */
77
165
  buttons?: DialogButton[];
78
166
 
79
- /** Whether to show a divider between header and content */
167
+ /**
168
+ * Whether to show a divider between header and content
169
+ * @default false
170
+ */
80
171
  divider?: boolean;
81
172
 
82
- /** Dialog z-index (defaults to 1000) */
173
+ /**
174
+ * Dialog z-index - controls stacking order
175
+ * @default 1000
176
+ */
83
177
  zIndex?: number;
84
178
 
85
- /** Duration of open/close animations in ms */
179
+ /**
180
+ * Duration of open/close animations in milliseconds
181
+ * @default 300
182
+ */
86
183
  animationDuration?: number;
87
184
 
88
- /** Event handlers for dialog events */
185
+ /**
186
+ * Event handlers for dialog events
187
+ * Register event handlers during initialization
188
+ * @example
189
+ * {
190
+ * afteropen: (event) => { console.log('Dialog opened'); }
191
+ * }
192
+ */
89
193
  on?: {
90
194
  [key in DialogEventType]?: (event: DialogEvent) => void;
91
195
  };
@@ -93,155 +197,357 @@ export interface DialogConfig {
93
197
 
94
198
  /**
95
199
  * Dialog button configuration
200
+ *
201
+ * Defines the appearance and behavior of buttons in the dialog footer.
202
+ *
203
+ * @category Components
96
204
  */
97
205
  export interface DialogButton {
98
- /** Button text */
206
+ /**
207
+ * Button text label
208
+ * @example "Save" | "Cancel" | "Delete"
209
+ */
99
210
  text: string;
100
211
 
101
- /** Button variant (uses button component variants) */
212
+ /**
213
+ * Button variant (uses button component variants)
214
+ * @default "text"
215
+ * @example "filled" | "text" | "outlined" | "tonal"
216
+ */
102
217
  variant?: string;
103
218
 
104
- /** Button color */
219
+ /**
220
+ * Button color
221
+ * @example "primary" | "error"
222
+ */
105
223
  color?: string;
106
224
 
107
- /** Button size */
225
+ /**
226
+ * Button size
227
+ * @default "medium"
228
+ * @example "small" | "medium" | "large"
229
+ */
108
230
  size?: string;
109
231
 
110
- /** Button onclick handler */
232
+ /**
233
+ * Button click handler
234
+ * Return false to prevent dialog closing
235
+ * @param event - The click event
236
+ * @param dialog - The dialog component instance
237
+ * @returns Optional boolean, false prevents dialog from closing
238
+ */
111
239
  onClick?: (event: MouseEvent, dialog: DialogComponent) => void | boolean;
112
240
 
113
- /** Close dialog when button is clicked */
241
+ /**
242
+ * Whether to close the dialog when this button is clicked
243
+ * Set to false for validation or multi-step flows
244
+ * @default true
245
+ */
114
246
  closeDialog?: boolean;
115
247
 
116
- /** Autofocus this button when dialog opens */
248
+ /**
249
+ * Whether to autofocus this button when the dialog opens
250
+ * Typically used for primary action buttons
251
+ * @default false
252
+ */
117
253
  autofocus?: boolean;
118
254
 
119
- /** Additional button attributes */
255
+ /**
256
+ * Additional button attributes to pass to the button element
257
+ * @example { 'data-id': 'save-button', 'form': 'profile-form' }
258
+ */
120
259
  attrs?: Record<string, any>;
121
260
  }
122
261
 
123
262
  /**
124
263
  * Dialog event object
264
+ *
265
+ * Passed to event handlers registered with the on() method.
266
+ *
267
+ * @category Components
125
268
  */
126
269
  export interface DialogEvent {
127
- /** Dialog component instance */
270
+ /**
271
+ * Dialog component instance that triggered the event
272
+ */
128
273
  dialog: DialogComponent;
129
274
 
130
- /** Original event if applicable */
275
+ /**
276
+ * Original browser event if applicable
277
+ * May be undefined for programmatic events
278
+ */
131
279
  originalEvent?: Event;
132
280
 
133
- /** Whether to prevent the default action */
281
+ /**
282
+ * Call this method to prevent the default action
283
+ * For example, to prevent a dialog from closing
284
+ */
134
285
  preventDefault: () => void;
135
286
 
136
- /** Whether default action was prevented */
287
+ /**
288
+ * Whether the default action was prevented
289
+ * Will be true if preventDefault() was called
290
+ */
137
291
  defaultPrevented: boolean;
138
292
  }
139
293
 
140
294
  /**
141
295
  * Dialog component interface
296
+ *
297
+ * Provides methods for controlling a Material Design 3 dialog
298
+ *
299
+ * @category Components
142
300
  */
143
301
  export interface DialogComponent {
144
- /** Dialog element */
302
+ /**
303
+ * The dialog's root DOM element
304
+ */
145
305
  element: HTMLElement;
146
306
 
147
- /** Dialog overlay element */
307
+ /**
308
+ * The dialog's overlay/backdrop element
309
+ */
148
310
  overlay: HTMLElement;
149
311
 
150
- /** Opens the dialog */
312
+ /**
313
+ * Opens the dialog
314
+ * Displays the dialog with animation
315
+ * @returns Dialog component for method chaining
316
+ */
151
317
  open: () => DialogComponent;
152
318
 
153
- /** Closes the dialog */
319
+ /**
320
+ * Closes the dialog
321
+ * Hides the dialog with animation
322
+ * @returns Dialog component for method chaining
323
+ */
154
324
  close: () => DialogComponent;
155
325
 
156
- /** Toggles dialog open/closed state */
326
+ /**
327
+ * Toggles dialog open/closed state
328
+ * @param open - Optional boolean to force specific state
329
+ * @returns Dialog component for method chaining
330
+ * @example
331
+ * dialog.toggle(); // Toggle current state
332
+ * dialog.toggle(true); // Force open
333
+ */
157
334
  toggle: (open?: boolean) => DialogComponent;
158
335
 
159
- /** Checks if dialog is open */
336
+ /**
337
+ * Checks if dialog is currently open
338
+ * @returns True if dialog is open, false otherwise
339
+ */
160
340
  isOpen: () => boolean;
161
341
 
162
- /** Sets dialog title */
342
+ /**
343
+ * Sets dialog title text
344
+ * @param title - New title to display in header
345
+ * @returns Dialog component for method chaining
346
+ */
163
347
  setTitle: (title: string) => DialogComponent;
164
348
 
165
- /** Gets dialog title */
349
+ /**
350
+ * Gets dialog current title text
351
+ * @returns Current title text
352
+ */
166
353
  getTitle: () => string;
167
354
 
168
- /** Sets dialog subtitle */
355
+ /**
356
+ * Sets dialog subtitle text
357
+ * @param subtitle - New subtitle to display below title
358
+ * @returns Dialog component for method chaining
359
+ */
169
360
  setSubtitle: (subtitle: string) => DialogComponent;
170
361
 
171
- /** Gets dialog subtitle */
362
+ /**
363
+ * Gets dialog current subtitle text
364
+ * @returns Current subtitle text
365
+ */
172
366
  getSubtitle: () => string;
173
367
 
174
- /** Sets dialog content */
368
+ /**
369
+ * Sets dialog content
370
+ * @param content - New content (text or HTML)
371
+ * @returns Dialog component for method chaining
372
+ */
175
373
  setContent: (content: string) => DialogComponent;
176
374
 
177
- /** Gets dialog content */
375
+ /**
376
+ * Gets dialog content
377
+ * @returns Current content text/HTML
378
+ */
178
379
  getContent: () => string;
179
380
 
180
- /** Adds a button to the dialog footer */
381
+ /**
382
+ * Adds a button to the dialog footer
383
+ * @param button - Button configuration object
384
+ * @returns Dialog component for method chaining
385
+ */
181
386
  addButton: (button: DialogButton) => DialogComponent;
182
387
 
183
- /** Removes a button by index or text */
388
+ /**
389
+ * Removes a button by index or text
390
+ * @param indexOrText - Button index or text content
391
+ * @returns Dialog component for method chaining
392
+ * @example
393
+ * dialog.removeButton(0); // Remove first button
394
+ * dialog.removeButton('Cancel'); // Remove button with text 'Cancel'
395
+ */
184
396
  removeButton: (indexOrText: number | string) => DialogComponent;
185
397
 
186
- /** Gets all footer buttons */
398
+ /**
399
+ * Gets all footer buttons
400
+ * @returns Array of button configuration objects
401
+ */
187
402
  getButtons: () => DialogButton[];
188
403
 
189
- /** Sets footer alignment */
404
+ /**
405
+ * Sets footer button alignment
406
+ * @param alignment - Alignment value
407
+ * @returns Dialog component for method chaining
408
+ */
190
409
  setFooterAlignment: (alignment: DialogFooterAlignment | string) => DialogComponent;
191
410
 
192
- /** Sets dialog size */
411
+ /**
412
+ * Sets dialog size
413
+ * @param size - Size variant
414
+ * @returns Dialog component for method chaining
415
+ */
193
416
  setSize: (size: DialogSize | string) => DialogComponent;
194
417
 
195
- /** Adds event listener */
418
+ /**
419
+ * Adds an event listener to the dialog
420
+ * @param event - Event name
421
+ * @param handler - Event handler function
422
+ * @returns Dialog component for method chaining
423
+ * @example
424
+ * dialog.on('beforeclose', (event) => {
425
+ * // Prevent dialog from closing if form is invalid
426
+ * if (!isFormValid()) {
427
+ * event.preventDefault();
428
+ * }
429
+ * });
430
+ */
196
431
  on: (event: DialogEventType | string, handler: (event: DialogEvent) => void) => DialogComponent;
197
432
 
198
- /** Removes event listener */
433
+ /**
434
+ * Removes an event listener from the dialog
435
+ * @param event - Event name
436
+ * @param handler - Event handler function
437
+ * @returns Dialog component for method chaining
438
+ */
199
439
  off: (event: DialogEventType | string, handler: (event: DialogEvent) => void) => DialogComponent;
200
440
 
201
- /** Gets dialog header element */
441
+ /**
442
+ * Gets dialog header element
443
+ * @returns Header element or null if not present
444
+ */
202
445
  getHeaderElement: () => HTMLElement | null;
203
446
 
204
- /** Gets dialog content element */
447
+ /**
448
+ * Gets dialog content element
449
+ * @returns Content element or null if not present
450
+ */
205
451
  getContentElement: () => HTMLElement | null;
206
452
 
207
- /** Gets dialog footer element */
453
+ /**
454
+ * Gets dialog footer element
455
+ * @returns Footer element or null if not present
456
+ */
208
457
  getFooterElement: () => HTMLElement | null;
209
458
 
210
- /** Shows or hides the divider */
459
+ /**
460
+ * Shows or hides the divider between header and content
461
+ * @param show - Whether to show or hide divider
462
+ * @returns Dialog component for method chaining
463
+ */
211
464
  toggleDivider: (show: boolean) => DialogComponent;
212
465
 
213
- /** Checks if the dialog has a divider */
466
+ /**
467
+ * Checks if the dialog has a divider visible
468
+ * @returns True if divider is visible, false otherwise
469
+ */
214
470
  hasDivider: () => boolean;
215
471
 
216
- /** Creates a confirmation dialog with Yes/No buttons */
472
+ /**
473
+ * Creates a confirmation dialog with Yes/No buttons
474
+ * Returns a promise that resolves to true if confirmed, false otherwise
475
+ *
476
+ * @param options - Confirmation dialog options
477
+ * @returns Promise resolving to boolean result
478
+ * @example
479
+ * const result = await dialog.confirm({
480
+ * title: 'Delete Item',
481
+ * message: 'Are you sure you want to delete this item?'
482
+ * });
483
+ *
484
+ * if (result) {
485
+ * deleteItem();
486
+ * }
487
+ */
217
488
  confirm: (options?: DialogConfirmOptions) => Promise<boolean>;
218
489
 
219
- /** Destroys the dialog and removes it from DOM */
490
+ /**
491
+ * Destroys the dialog and removes it from DOM
492
+ * Cleans up all event listeners and references
493
+ */
220
494
  destroy: () => void;
221
495
  }
222
496
 
223
497
  /**
224
498
  * Options for confirmation dialog
499
+ *
500
+ * Used with the dialog.confirm() method to create a simple
501
+ * confirmation dialog with customizable options.
502
+ *
503
+ * @category Components
225
504
  */
226
505
  export interface DialogConfirmOptions {
227
- /** Confirmation title */
506
+ /**
507
+ * Confirmation dialog title
508
+ * @default "Confirm"
509
+ * @example "Delete Item"
510
+ */
228
511
  title?: string;
229
512
 
230
- /** Confirmation message */
513
+ /**
514
+ * Confirmation message/question to display
515
+ * Required field for the confirmation dialog
516
+ * @example "Are you sure you want to delete this item?"
517
+ */
231
518
  message: string;
232
519
 
233
- /** Confirm button text */
520
+ /**
521
+ * Confirm button text
522
+ * @default "Yes"
523
+ * @example "Delete" | "Confirm" | "Yes, I'm sure"
524
+ */
234
525
  confirmText?: string;
235
526
 
236
- /** Cancel button text */
527
+ /**
528
+ * Cancel button text
529
+ * @default "No"
530
+ * @example "Cancel" | "No, go back"
531
+ */
237
532
  cancelText?: string;
238
533
 
239
- /** Confirm button variant */
534
+ /**
535
+ * Confirm button variant
536
+ * @default "filled"
537
+ * @example "filled" | "tonal"
538
+ */
240
539
  confirmVariant?: string;
241
540
 
242
- /** Cancel button variant */
541
+ /**
542
+ * Cancel button variant
543
+ * @default "text"
544
+ * @example "text" | "outlined"
545
+ */
243
546
  cancelVariant?: string;
244
547
 
245
- /** Dialog size */
548
+ /**
549
+ * Dialog size for the confirmation dialog
550
+ * @default "small"
551
+ */
246
552
  size?: DialogSize | string;
247
553
  }