@schukai/monster 4.23.0 → 4.23.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
 
4
4
 
5
+ ## [4.23.2] - 2025-06-22
6
+
7
+ ### Bug Fixes
8
+
9
+ - Enhance SaveButton with state and message handling
10
+
11
+
12
+
13
+ ## [4.23.1] - 2025-06-22
14
+
15
+ ### Bug Fixes
16
+
17
+ - Clean up imports and formatting in select component
18
+
19
+
20
+
5
21
  ## [4.23.0] - 2025-06-22
6
22
 
7
23
  ### Add Features
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.1","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.23.0"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.1","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.23.2"}
@@ -287,6 +287,72 @@ class SaveButton extends CustomElement {
287
287
  );
288
288
  }
289
289
 
290
+ /**
291
+ * Sets the state of the button which affects its visual appearance
292
+ *
293
+ * @param {string} state - The state to set (e.g. 'success', 'error', 'loading')
294
+ * @param {number} timeout - Optional timeout in milliseconds after which state is removed
295
+ * @return {SaveButton} Returns the button instance for chaining
296
+ * @throws {TypeError} When state is not a string or timeout is not a number
297
+ */
298
+ setState(state, timeout) {
299
+ return this[stateButtonElementSymbol].setState(state, timeout);
300
+ }
301
+
302
+ /**
303
+ *
304
+ * @return {SaveButton}
305
+ */
306
+ removeState() {
307
+ return this[stateButtonElementSymbol].removeState();
308
+ }
309
+
310
+ /**
311
+ * @return {string}
312
+ */
313
+ getState() {
314
+ return this[stateButtonElementSymbol].getState();
315
+ }
316
+
317
+ /**
318
+ * Sets the message content to be displayed in the popup overlay
319
+ *
320
+ * @param {string|HTMLElement} message - The message content as string or HTML element
321
+ * @param {string} title - Optional title to show above the message
322
+ * @param {string} icon - Optional icon HTML to display next to the title
323
+ * @return {SaveButton} Returns the button instance for chaining
324
+ * @throws {TypeError} When message is empty or invalid type
325
+ */
326
+ setMessage(message, title, icon) {
327
+ return this[stateButtonElementSymbol].setMessage(message, title, icon);
328
+ }
329
+
330
+ /**
331
+ * Clears the message content displayed in the popup overlay.
332
+ * @returns {*|SaveButton}
333
+ */
334
+ clearMessage() {
335
+ return this[stateButtonElementSymbol].clearMessage();
336
+ }
337
+
338
+ /**
339
+ * Displays a message on the button element for a specified duration.
340
+ *
341
+ * @param {number} timeout - The time, in milliseconds, for which the message should be displayed.
342
+ * @return {Promise<void>} A promise that resolves when the message display action is completed.
343
+ */
344
+ showMessage(timeout) {
345
+ return this[stateButtonElementSymbol].showMessage(timeout);
346
+ }
347
+
348
+ /**
349
+ * Hides the message displayed on the button element.
350
+ * @returns {*|MessageStateButton}
351
+ */
352
+ hideMessage() {
353
+ return this[stateButtonElementSymbol].hideMessage();
354
+ }
355
+
290
356
  /**
291
357
  *
292
358
  * @return [CSSStyleSheet]
@@ -434,7 +500,7 @@ function getTemplate() {
434
500
  return `
435
501
  <div data-monster-role="control" part="control"
436
502
  data-monster-attributes="disabled path:disabled | if:true">
437
- <monster-state-button data-monster-role="state-button">save</monster-state-button>
503
+ <monster-message-state-button data-monster-role="state-button">save</monster-message-state-button>
438
504
  <div data-monster-attributes="disabled path:disabled | if:true, class path:classes.badge"
439
505
  data-monster-role="badge"
440
506
  data-monster-replace="path:changes"></div>