native-document 1.0.91 → 1.0.93

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 (68) hide show
  1. package/dist/native-document.components.min.js +1168 -138
  2. package/dist/native-document.dev.js +792 -217
  3. package/dist/native-document.dev.js.map +1 -1
  4. package/dist/native-document.devtools.min.js +1 -1
  5. package/dist/native-document.min.js +1 -1
  6. package/docs/advanced-components.md +814 -0
  7. package/docs/anchor.md +71 -11
  8. package/docs/cache.md +888 -0
  9. package/docs/conditional-rendering.md +91 -1
  10. package/docs/core-concepts.md +9 -2
  11. package/docs/elements.md +127 -2
  12. package/docs/extending-native-document-element.md +7 -1
  13. package/docs/filters.md +1216 -0
  14. package/docs/getting-started.md +12 -3
  15. package/docs/lifecycle-events.md +10 -2
  16. package/docs/list-rendering.md +453 -54
  17. package/docs/memory-management.md +9 -7
  18. package/docs/native-document-element.md +30 -9
  19. package/docs/native-fetch.md +744 -0
  20. package/docs/observables.md +135 -6
  21. package/docs/routing.md +7 -1
  22. package/docs/state-management.md +7 -1
  23. package/docs/validation.md +8 -1
  24. package/eslint.config.js +3 -3
  25. package/package.json +3 -2
  26. package/readme.md +53 -14
  27. package/src/components/$traits/HasItems.js +42 -1
  28. package/src/components/BaseComponent.js +4 -1
  29. package/src/components/accordion/Accordion.js +112 -8
  30. package/src/components/accordion/AccordionItem.js +93 -4
  31. package/src/components/alert/Alert.js +164 -4
  32. package/src/components/avatar/Avatar.js +236 -22
  33. package/src/components/menu/index.js +1 -2
  34. package/src/core/data/ObservableArray.js +120 -2
  35. package/src/core/data/ObservableChecker.js +50 -0
  36. package/src/core/data/ObservableItem.js +223 -80
  37. package/src/core/data/ObservableWhen.js +36 -6
  38. package/src/core/data/observable-helpers/array.js +12 -3
  39. package/src/core/data/observable-helpers/computed.js +17 -4
  40. package/src/core/data/observable-helpers/object.js +19 -3
  41. package/src/core/elements/control/for-each-array.js +21 -3
  42. package/src/core/elements/control/for-each.js +17 -5
  43. package/src/core/elements/control/show-if.js +31 -15
  44. package/src/core/elements/control/show-when.js +23 -0
  45. package/src/core/elements/control/switch.js +40 -10
  46. package/src/core/utils/cache.js +5 -0
  47. package/src/core/utils/memoize.js +25 -16
  48. package/src/core/utils/prototypes.js +3 -2
  49. package/src/core/wrappers/AttributesWrapper.js +1 -1
  50. package/src/core/wrappers/NDElement.js +41 -1
  51. package/src/core/wrappers/NdPrototype.js +4 -0
  52. package/src/core/wrappers/TemplateCloner.js +13 -10
  53. package/src/core/wrappers/prototypes/bind-class-extensions.js +1 -1
  54. package/src/core/wrappers/prototypes/nd-element-extensions.js +3 -0
  55. package/src/router/Route.js +9 -4
  56. package/src/router/Router.js +28 -9
  57. package/src/router/errors/RouterError.js +0 -1
  58. package/types/control-flow.d.ts +9 -6
  59. package/types/elements.d.ts +6 -3
  60. package/types/filters/index.d.ts +4 -0
  61. package/types/nd-element.d.ts +5 -238
  62. package/types/observable.d.ts +9 -3
  63. package/types/router.d.ts +5 -1
  64. package/types/template-cloner.ts +1 -0
  65. package/types/validator.ts +11 -1
  66. package/utils.d.ts +2 -1
  67. package/utils.js +4 -4
  68. package/src/core/utils/service.js +0 -6
@@ -1,13 +1,19 @@
1
1
  import BaseComponent from "../BaseComponent";
2
2
  import EventEmitter from "../../../src/core/utils/EventEmitter";
3
3
 
4
+ /**
5
+ * Component for displaying alert messages with various styles and variants
6
+ * @param {ValidChildren} message - The alert message content
7
+ * @param {{ title?: ValidChildren, content?: ValidChildren, outline?: boolean, style?: string, variant?: string, closable?: boolean, autoDismiss?: number, icon?: ValidChildren, showIcon?: boolean }} config - Configuration object
8
+ * @class
9
+ */
4
10
  export default function Alert(message, config = {}) {
5
11
  if(!(this instanceof Alert)) {
6
12
  return new Alert(message, config);
7
13
  }
8
14
  this.$description = {
9
15
  title: null,
10
- content: null,
16
+ content: message,
11
17
  outline: null,
12
18
  style: null,
13
19
  variant: 'info',
@@ -24,132 +30,286 @@ Alert.defaultTitleTemplate = null;
24
30
  Alert.defaultButtonsTemplate = null;
25
31
  Alert.defaultContentTemplate = null;
26
32
 
27
- Alert.use = function(template) {};
33
+ /**
34
+ * Sets the default template for all Alert instances
35
+ * @param {{alert: (alert: Alert) => ValidChildren, alertContent: (alert: Alert) => ValidChildren, alertButtons: (alert: Alert) => ValidChildren, alertTitle: (alert: Alert) => ValidChildren}} template - Template object containing alert factory function
36
+ */
37
+ Alert.use = function(template) {
38
+ Alert.defaultTemplate = template.alert;
39
+ Alert.defaultTitleTemplate = template.alertTitle;
40
+ Alert.defaultButtonsTemplate = template.alertButtons;
41
+ Alert.defaultContentTemplate = template.alertContent;
42
+ };
28
43
 
29
44
  BaseComponent.extends(Alert, EventEmitter);
30
45
 
46
+ /**
47
+ * Sets the variant style for the alert
48
+ * @param {string} variant - The variant name (info, success, warning, error, danger)
49
+ * @returns {Alert}
50
+ */
31
51
  Alert.prototype.variant = function(variant) {
32
52
  this.$description.variant = variant;
33
53
  return this;
34
54
  };
35
55
 
56
+ /**
57
+ * Sets the alert variant to 'info'
58
+ * @returns {Alert}
59
+ */
36
60
  Alert.prototype.info = function() {
37
61
  return this.variant('info');
38
62
  };
63
+
64
+ /**
65
+ * Sets the alert variant to 'success'
66
+ * @returns {Alert}
67
+ */
39
68
  Alert.prototype.success = function() {
40
69
  return this.variant('success');
41
70
  };
71
+
72
+ /**
73
+ * Sets the alert variant to 'warning'
74
+ * @returns {Alert}
75
+ */
42
76
  Alert.prototype.warning = function() {
43
77
  return this.variant('warning');
44
78
  };
79
+
80
+ /**
81
+ * Sets the alert variant to 'error'
82
+ * @returns {Alert}
83
+ */
45
84
  Alert.prototype.error = function() {
46
85
  return this.variant('error');
47
86
  };
87
+
88
+ /**
89
+ * Sets the alert variant to 'danger'
90
+ * @returns {Alert}
91
+ */
48
92
  Alert.prototype.danger = function() {
49
93
  return this.variant('danger');
50
94
  };
51
95
 
96
+ /**
97
+ * Sets the style type for the alert
98
+ * @param {string} style - The style name (filled, bordered, outline)
99
+ * @returns {Alert}
100
+ */
52
101
  Alert.prototype.style = function(style) {
53
102
  this.$description.style = style;
54
103
  return this;
55
104
  };
105
+
106
+ /**
107
+ * Sets the alert style to 'filled'
108
+ * @returns {Alert}
109
+ */
56
110
  Alert.prototype.filled = function() {
57
111
  return this.style('filled');
58
112
  };
113
+
114
+ /**
115
+ * Sets the alert style to 'bordered'
116
+ * @returns {Alert}
117
+ */
59
118
  Alert.prototype.bordered = function() {
60
119
  return this.style('bordered');
61
120
  };
121
+
122
+ /**
123
+ * Sets the alert style to 'outline'
124
+ * @param {boolean} [outline=true] - Whether to use outline style
125
+ * @returns {Alert}
126
+ */
62
127
  Alert.prototype.outline = function(outline = true) {
63
128
  return this.style('outline');
64
129
  };
65
130
 
131
+ /**
132
+ * Sets the title of the alert
133
+ * @param {ValidChildren} title - The title content
134
+ * @returns {Alert}
135
+ */
66
136
  Alert.prototype.title = function(title) {
67
137
  this.$description.title = title;
68
138
  return this;
69
139
  };
140
+
141
+ /**
142
+ * Sets the content of the alert
143
+ * @param {ValidChildren} content - The content to display
144
+ * @returns {Alert}
145
+ */
70
146
  Alert.prototype.content = function(content) {
71
147
  this.$description.content = content;
72
148
  return this;
73
149
  };
74
150
 
151
+ /**
152
+ * Sets the title render function
153
+ * @param {Function} callback - Function to render the title
154
+ * @returns {Alert}
155
+ */
75
156
  Alert.prototype.renderTitle = function(callback) {
76
157
  this.$description.renderTitle = callback;
77
158
  return this;
78
159
  };
160
+
161
+ /**
162
+ * Sets the content render function
163
+ * @param {Function} callback - Function to render the content
164
+ * @returns {Alert}
165
+ */
79
166
  Alert.prototype.renderContent = function(callback) {
80
167
  this.$description.renderContent = callback;
81
168
  return this;
82
169
  };
170
+
171
+ /**
172
+ * Clears all actions from the alert
173
+ * @returns {Alert}
174
+ */
83
175
  Alert.prototype.renderFooter = function(callback) {
84
176
  this.$description.renderFooter = callback;
85
177
  return this;
86
178
  };
87
179
 
180
+ /**
181
+ * Adds an action button to the alert
182
+ * @param {string} label - The button label
183
+ * @param {Function} handler - The click handler
184
+ * @returns {Alert}
185
+ */
88
186
  Alert.prototype.clearActions = function(label, handler) {
89
187
  this.$description.actions = [];
90
188
  return this;
91
189
  };
92
190
 
191
+ /**
192
+ * Adds an action button to the alert
193
+ * @param {string} label - The button label
194
+ * @param {Function} handler - The click handler
195
+ * @returns {Alert}
196
+ */
93
197
  Alert.prototype.action = function(label, handler) {
94
198
  this.$description.actions.push({label, handler});
95
199
  return this;
96
200
  };
97
201
 
202
+ /**
203
+ * Sets the layout function for the alert
204
+ * @param {Function} layoutFn - Function to layout the alert
205
+ * @returns {Alert}
206
+ */
98
207
  Alert.prototype.layout = function(layoutFn) {
99
208
  this.$description.layout = layoutFn;
100
209
  return this;
101
210
  };
102
211
 
212
+ /**
213
+ * Sets the icon for the alert
214
+ * @param {ValidChildren} icon - The icon to display
215
+ * @returns {Alert}
216
+ */
103
217
  Alert.prototype.icon = function(icon) {
104
218
  this.$description.icon = icon;
105
219
  return this;
106
220
  };
107
221
 
222
+ /**
223
+ * Shows or hides the icon
224
+ * @param {boolean} [show=true] - Whether to show the icon
225
+ * @returns {Alert}
226
+ */
108
227
  Alert.prototype.showIcon = function(show = true) {
109
228
  this.$description.showIcon = show;
110
229
  };
111
230
 
231
+ /**
232
+ * Sets whether the alert can be closed
233
+ * @param {boolean} [closable=true] - Whether the alert is closable
234
+ * @returns {Alert}
235
+ */
112
236
  Alert.prototype.closable = function(closable = true) {
113
237
  this.$description.closable = closable;
114
238
  return this;
115
239
  };
116
240
 
241
+ /**
242
+ * Sets whether the alert is dismissible (alias for closable)
243
+ * @param {boolean} [dismissible=true] - Whether the alert is dismissible
244
+ * @returns {Alert}
245
+ */
117
246
  Alert.prototype.dismissible = function(dismissible = true) {
118
247
  return this.closable(dismissible);
119
248
  };
249
+
250
+ /**
251
+ * Sets auto-dismiss delay for the alert
252
+ * @param {number} delay - Delay in milliseconds before auto-dismissing
253
+ * @returns {Alert}
254
+ */
120
255
  Alert.prototype.autoDismiss = function(delay) {
121
256
  this.$description.autoDismiss = delay;
122
257
  return this;
123
258
  };
124
259
 
125
-
126
-
260
+ /**
261
+ * Closes the alert
262
+ */
127
263
  Alert.prototype.close = function() {
128
264
 
129
265
  };
130
266
 
267
+ /**
268
+ * Shows the alert
269
+ */
131
270
  Alert.prototype.show = function() {
132
271
 
133
272
  };
134
273
 
274
+ /**
275
+ * Hides the alert
276
+ */
135
277
  Alert.prototype.hide = function() {
136
278
 
137
279
  };
138
280
 
281
+ /**
282
+ * Registers a handler for the close event
283
+ * @param {(element: Alert) => void} handler - The event handler
284
+ * @returns {Alert}
285
+ */
139
286
  Alert.prototype.onClose = function(handler) {
140
287
  this.on('close', handler);
141
288
  return this;
142
289
  };
290
+
291
+ /**
292
+ * Registers a handler for the show event
293
+ * @param {(element: Alert) => void} handler - The event handler
294
+ * @returns {Alert}
295
+ */
143
296
  Alert.prototype.onShow = function(handler) {
144
297
  this.on('show', handler);
145
298
  return this;
146
299
  };
147
300
 
301
+ /**
302
+ * Sets the render function for the entire alert
303
+ * @param {(alert: Alert, sections: {title: ValidChildren, content: ValidChildren, footer: ValidChildren, icon: ValidChildren}) => ValidChildren} renderFn - Function to render the alert
304
+ * @returns {Alert}
305
+ */
148
306
  Alert.prototype.render = function(renderFn) {
149
307
  this.$description.render = renderFn;
150
308
  return this;
151
309
  };
310
+
152
311
  Alert.prototype.$build = function() {
153
312
 
154
313
  };
314
+
155
315
  Alert.prototype.toNdElement = function() {};
@@ -1,9 +1,15 @@
1
1
  import {Validator} from "../../../index";
2
2
  import BaseComponent from "../BaseComponent";
3
3
 
4
+ /**
5
+ * Component for displaying user avatars with images, initials, or icons
6
+ * @param {Observable<string>|string} source - The avatar source (image URL or observable)
7
+ * @param {{ src?: Observable<string>|string, alt?: string, name?: string, initials?: string, icon?: ValidChildren, size?: string|number, shape?: string, variant?: string, color?: string, textColor?: string, status?: string, render?: Function }} config - Configuration object
8
+ * @class
9
+ */
4
10
  export default function Avatar(source, config = {}) {
5
11
  if (!(this instanceof Avatar)) {
6
- return new Avatar(config);
12
+ return new Avatar(source, config);
7
13
  }
8
14
 
9
15
  this.$description = {
@@ -26,153 +32,361 @@ export default function Avatar(source, config = {}) {
26
32
  BaseComponent.extends(Avatar);
27
33
 
28
34
  Avatar.defaultTemplate = null;
29
- Avatar.use = function(template) {};
30
35
 
36
+ /**
37
+ * Sets the default template for all Avatar instances
38
+ * @param {{avatar: (avatar: Avatar) => ValidChildren}} template - Template object containing avatar factory function
39
+ */
40
+ Avatar.use = function(template) {
41
+ Avatar.defaultTemplate = template.avatar;
42
+ };
43
+
44
+ /**
45
+ * Registers a handler for the error event
46
+ * @param {(error: Error, avatar: Avatar) => void} handler - The event handler
47
+ * @returns {Avatar}
48
+ */
31
49
  Avatar.prototype.onError = function(handler) {};
32
50
 
51
+ /**
52
+ * Sets the source URL for the avatar image
53
+ * @param {string} src - The image source URL
54
+ * @returns {Avatar}
55
+ */
33
56
  Avatar.prototype.src = function(src) {
34
57
  this.$description.src.set(src);
35
58
  return this;
36
59
  };
60
+
61
+ /**
62
+ * Sets the alt text for the avatar image
63
+ * @param {string} alt - The alt text
64
+ * @returns {Avatar}
65
+ */
37
66
  Avatar.prototype.alt = function(alt) {
38
67
  this.$description.alt = alt;
39
68
  return this;
40
69
  };
70
+
71
+ /**
72
+ * Sets the name associated with the avatar
73
+ * @param {string} name - The name
74
+ * @returns {Avatar}
75
+ */
41
76
  Avatar.prototype.name = function(name) {
42
77
  this.$description.name = name;
43
78
  return this;
44
79
  };
80
+
81
+ /**
82
+ * Sets the initials to display
83
+ * @param {string} initials - The initials text
84
+ * @returns {Avatar}
85
+ */
45
86
  Avatar.prototype.initials = function(initials) {
46
87
  this.$description.initials = initials;
47
88
  return this;
48
89
  };
90
+
91
+ /**
92
+ * Sets the icon for the avatar
93
+ * @param {ValidChildren} icon - The icon to display
94
+ * @returns {Avatar}
95
+ */
49
96
  Avatar.prototype.icon = function(icon) {
50
97
  this.$description.icon = icon;
51
98
  return this;
52
99
  };
53
100
 
54
101
  /**
55
- * @param {string|int} size
102
+ * Sets the size of the avatar
103
+ * @param {string|number} size - The size value (preset name or custom value)
56
104
  * @returns {Avatar}
57
105
  */
58
106
  Avatar.prototype.size = function(size) {
59
107
  this.$description.size = size;
60
108
  return this;
61
109
  };
110
+
111
+ /**
112
+ * Sets the avatar size to 'extra-small'
113
+ * @returns {Avatar}
114
+ */
62
115
  Avatar.prototype.extraSmall = function() {
63
116
  return this.size('extra-small');
64
117
  };
118
+
119
+ /**
120
+ * Sets the avatar size to 'small'
121
+ * @returns {Avatar}
122
+ */
65
123
  Avatar.prototype.small = function() {
66
124
  return this.size('small');
67
125
  };
126
+
127
+ /**
128
+ * Sets the avatar size to 'medium'
129
+ * @returns {Avatar}
130
+ */
68
131
  Avatar.prototype.medium = function() {
69
132
  return this.size('medium');
70
133
  };
134
+
135
+ /**
136
+ * Sets the avatar size to 'large'
137
+ * @returns {Avatar}
138
+ */
71
139
  Avatar.prototype.large = function() {
72
140
  return this.size('large');
73
141
  };
142
+
143
+ /**
144
+ * Sets the avatar size to 'extra-large'
145
+ * @returns {Avatar}
146
+ */
74
147
  Avatar.prototype.extraLarge = function() {
75
148
  return this.size('extra-large');
76
149
  };
77
150
 
151
+ /**
152
+ * Sets the shape of the avatar
153
+ * @param {string} shape - The shape name (circle, square, rounded)
154
+ * @returns {Avatar}
155
+ */
78
156
  Avatar.prototype.shape = function(shape) {
79
157
  this.$description.shape = shape;
80
158
  return this;
81
159
  };
160
+
161
+ /**
162
+ * Sets the avatar shape to 'circle'
163
+ * @returns {Avatar}
164
+ */
82
165
  Avatar.prototype.circle = function() {
83
166
  return this.shape('circle');
84
167
  };
168
+
169
+ /**
170
+ * Sets the avatar shape to 'square'
171
+ * @returns {Avatar}
172
+ */
85
173
  Avatar.prototype.square = function() {
86
174
  return this.shape('square');
87
175
  };
176
+
177
+ /**
178
+ * Sets the avatar shape to 'rounded'
179
+ * @returns {Avatar}
180
+ */
88
181
  Avatar.prototype.rounded = function() {
89
182
  return this.shape('rounded');
90
183
  };
91
184
 
185
+ /**
186
+ * Sets the variant style for the avatar
187
+ * @param {string} variant - The variant name (primary, secondary, success, danger, warning, info)
188
+ * @returns {Avatar}
189
+ */
92
190
  Avatar.prototype.variant = function(variant) {
93
191
  this.$description.variant = variant;
94
192
  }; // 'primary' | 'secondary' | 'success' | etc.
193
+
194
+ /**
195
+ * Sets the avatar variant to 'primary'
196
+ * @returns {Avatar}
197
+ */
95
198
  Avatar.prototype.primary = function() {
96
199
  return this.variant('primary');
97
200
  };
201
+
202
+ /**
203
+ * Sets the avatar variant to 'secondary'
204
+ * @returns {Avatar}
205
+ */
98
206
  Avatar.prototype.secondary = function() {
99
207
  return this.variant('secondary');
100
208
  };
209
+
210
+ /**
211
+ * Sets the avatar variant to 'success'
212
+ * @returns {Avatar}
213
+ */
101
214
  Avatar.prototype.success = function() {
102
215
  return this.variant('success');
103
216
  };
217
+
218
+ /**
219
+ * Sets the avatar variant to 'danger'
220
+ * @returns {Avatar}
221
+ */
104
222
  Avatar.prototype.danger = function() {
105
223
  return this.variant('danger');
106
224
  };
225
+
226
+ /**
227
+ * Sets the avatar variant to 'warning'
228
+ * @returns {Avatar}
229
+ */
107
230
  Avatar.prototype.warning = function() {
108
231
  return this.variant('warning');
109
232
  };
233
+
234
+ /**
235
+ * Sets the avatar variant to 'info'
236
+ * @returns {Avatar}
237
+ */
110
238
  Avatar.prototype.info = function() {
111
239
  return this.variant('info');
112
240
  }
241
+
242
+ /**
243
+ * Sets the background color of the avatar
244
+ * @param {string} color - The color value
245
+ * @returns {Avatar}
246
+ */
113
247
  Avatar.prototype.color = function(color) {
114
248
  this.$description.color = color;
115
249
  return this;
116
250
  };
251
+
252
+ /**
253
+ * Sets the text color of the avatar
254
+ * @param {string} color - The color value
255
+ * @returns {Avatar}
256
+ */
117
257
  Avatar.prototype.textColor = function(color) {
118
258
  this.$description.textColor = color;
119
259
  return this;
120
260
  };
121
261
 
262
+ /**
263
+ * Sets the status indicator for the avatar
264
+ * @param {string} status - The status value
265
+ * @returns {Avatar}
266
+ */
122
267
  Avatar.prototype.status = function(status) {
123
268
  this.$description.status = status;
124
269
  return this;
125
270
  };
271
+
272
+ /**
273
+ * Sets the position of the status indicator
274
+ * @param {string} position - The position (top-right, bottom-right, top-left, bottom-left)
275
+ * @returns {Avatar}
276
+ */
126
277
  Avatar.prototype.statusPosition = function(position) {
127
278
  this.$description.statusPosition = position;
128
279
  }; // 'top-right' | 'bottom-right' | etc.
129
- Avatar.prototype.statusAtTopEnd = function() {
130
- return this.statusPosition('top-end');
280
+
281
+ /**
282
+ * Positions the status indicator at top-leading
283
+ * @returns {Avatar}
284
+ */
285
+ Avatar.prototype.statusAtTopLeading = function() {
286
+ return this.statusPosition('top-leading');
131
287
  };
132
- Avatar.prototype.statusAtBottomEnd = function() {
133
- return this.statusPosition('bottom-end');
288
+
289
+ /**
290
+ * Positions the status indicator at bottom-leading
291
+ * @returns {Avatar}
292
+ */
293
+ Avatar.prototype.statusAtBottomLeading = function() {
294
+ return this.statusPosition('bottom-leading');
134
295
  };
135
- Avatar.prototype.statusAtTopStart = function() {
136
- return this.statusPosition('top-start');
296
+
297
+ /**
298
+ * Positions the status indicator at top-trailing
299
+ * @returns {Avatar}
300
+ */
301
+ Avatar.prototype.statusAtTopTrailing = function() {
302
+ return this.statusPosition('top-trailing');
137
303
  };
138
- Avatar.prototype.statusAtBottomStart = function() {
139
- return this.statusPosition('bottom-start');
304
+
305
+ /**
306
+ * Positions the status indicator at bottom-trailing
307
+ * @returns {Avatar}
308
+ */
309
+ Avatar.prototype.statusAtBottomTrailing = function() {
310
+ return this.statusPosition('bottom-trailing');
140
311
  };
141
312
 
313
+ /**
314
+ * Shows or hides the status indicator
315
+ * @param {boolean} [show=true] - Whether to show the status
316
+ * @returns {Avatar}
317
+ */
142
318
  Avatar.prototype.showStatus = function(show = true) {
143
319
  this.$description.showStatus = show;
144
320
  return this;
145
321
  };
146
322
 
147
- // Badge
323
+ /**
324
+ * Sets the badge content for the avatar
325
+ * @param {ValidChildren} content - The badge content
326
+ * @returns {Avatar}
327
+ */
148
328
  Avatar.prototype.badge = function(content) {
149
329
  this.$description.badge = content;
150
330
  return this;
151
331
  };
332
+
333
+ /**
334
+ * Sets the position of the badge
335
+ * @param {string} position - The position (top-leading, bottom-leading, top-trailing, bottom-trailing)
336
+ * @returns {Avatar}
337
+ */
152
338
  Avatar.prototype.badgePosition = function(position) {
153
339
  this.$description.badgePosition = position;
154
340
  return this;
155
341
  };
156
- Avatar.prototype.badgeAtTopEnd = function() {
157
- return this.badgePosition('top-end');
158
- };
159
- Avatar.prototype.badgeAtBottomEnd = function() {
160
- return this.badgePosition('bottom-end');
342
+
343
+ /**
344
+ * Positions the badge at top-leading
345
+ * @returns {Avatar}
346
+ */
347
+ Avatar.prototype.badgeAtTopLeading = function() {
348
+ return this.badgePosition('top-leading');
161
349
  };
162
- Avatar.prototype.badgeAtTopStart = function() {
163
- return this.badgePosition('top-start');
350
+
351
+ /**
352
+ * Positions the badge at bottom-leading
353
+ * @returns {Avatar}
354
+ */
355
+ Avatar.prototype.badgeAtBottomLeading = function() {
356
+ return this.badgePosition('bottom-leading');
164
357
  };
165
- Avatar.prototype.badgeAtBottomStart = function() {
166
- return this.badgePosition('bottom-start');
358
+
359
+ /**
360
+ * Positions the badge at top-trailing
361
+ * @returns {Avatar}
362
+ */
363
+ Avatar.prototype.badgeAtTopTrailing = function() {
364
+ return this.badgePosition('top-trailing');
167
365
  };
168
366
 
367
+ /**
368
+ * Positions the badge at bottom-trailing
369
+ * @returns {Avatar}
370
+ */
371
+ Avatar.prototype.badgeAtBottomTrailing = function() {
372
+ return this.badgePosition('bottom-trailing');
373
+ };
169
374
 
375
+ /**
376
+ * Sets the render function for the entire avatar
377
+ * @param {(avatar: Avatar, sections: {image: ValidChildren, initials: ValidChildren, icon: ValidChildren, status: ValidChildren, badge: ValidChildren}) => ValidChildren} renderFn - Function to render the avatar
378
+ * @returns {Avatar}
379
+ */
170
380
  Avatar.prototype.render = function(renderFn) {
171
381
  this.$description.render = renderFn;
172
382
  return this;
173
383
  };
174
384
 
385
+ /**
386
+ * Builds the avatar component
387
+ * @private
388
+ */
175
389
  Avatar.prototype.$build = function() {
176
390
 
177
391
  };
178
- Avatar.prototype.toNdElement = function() {};
392
+
@@ -8,6 +8,5 @@ export {
8
8
  Menu,
9
9
  MenuItem,
10
10
  MenuGroup,
11
- MenuDivider,
12
- MenuInterface
11
+ MenuDivider
13
12
  };