@rettangoli/ui 1.4.2 → 1.6.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.
- package/dist/rettangoli-iife-layout.min.js +1 -1
- package/dist/rettangoli-iife-ui.min.js +39 -39
- package/package.json +1 -1
- package/src/components/dropdownMenu/dropdownMenu.handlers.js +13 -1
- package/src/components/dropdownMenu/dropdownMenu.schema.yaml +2 -1
- package/src/components/dropdownMenu/dropdownMenu.store.js +14 -3
- package/src/components/dropdownMenu/dropdownMenu.view.yaml +6 -6
- package/src/components/globalUi/globalUi.handlers.js +92 -1
- package/src/components/globalUi/globalUi.store.js +66 -0
- package/src/components/globalUi/globalUi.view.yaml +37 -0
- package/src/components/select/select.handlers.js +17 -2
- package/src/components/select/select.schema.yaml +12 -0
- package/src/components/select/select.store.js +93 -9
- package/src/components/select/select.view.yaml +31 -6
- package/src/deps/createGlobalUI.js +21 -2
- package/src/primitives/popover.js +3 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Creates a GlobalUI manager instance for controlling global UI components.
|
|
3
3
|
* Provides methods for showing alerts, confirm dialogs, form dialogs,
|
|
4
|
-
* dropdown menus, and closing all UI components.
|
|
4
|
+
* dropdown menus, toasts, and closing all UI components.
|
|
5
5
|
*
|
|
6
6
|
* @param {HTMLElement} globalUIElement - The globalUI component element
|
|
7
7
|
* @returns {Object} GlobalUI manager instance
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* @returns {Function} returns.showFormDialog - Show a form dialog
|
|
13
13
|
* @returns {Function} returns.showComponentDialog - Show a component dialog
|
|
14
14
|
* @returns {Function} returns.showDropdownMenu - Show a dropdown menu
|
|
15
|
+
* @returns {Function} returns.showToast - Show a temporary toast message
|
|
15
16
|
* @returns {Function} returns.closeAll - General-purpose function to close all currently open UI components
|
|
16
17
|
*/
|
|
17
18
|
const createGlobalUI = (globalUIElement) => {
|
|
@@ -161,9 +162,27 @@ const createGlobalUI = (globalUIElement) => {
|
|
|
161
162
|
return globalUIElement.transformedHandlers.handleShowDropdownMenu(options);
|
|
162
163
|
},
|
|
163
164
|
|
|
165
|
+
/**
|
|
166
|
+
* Shows a top-centered toast message that auto-dismisses after 3 seconds.
|
|
167
|
+
*
|
|
168
|
+
* @param {Object} options - Toast configuration options
|
|
169
|
+
* @param {string} options.message - The toast message (required)
|
|
170
|
+
* @param {('sm'|'md'|'lg')} [options.size] - Toast width preset matching dialog sizing (default: "sm")
|
|
171
|
+
* @returns {void}
|
|
172
|
+
* @throws {Error} If globalUIElement is not initialized
|
|
173
|
+
*/
|
|
174
|
+
showToast: (options) => {
|
|
175
|
+
if(!globalUIElement)
|
|
176
|
+
{
|
|
177
|
+
throw new Error("globalUIElement is not set. Make sure to initialize the global UI component and pass it to createGlobalUIManager.");
|
|
178
|
+
}
|
|
179
|
+
globalUIElement.transformedHandlers.handleShowToast(options);
|
|
180
|
+
},
|
|
181
|
+
|
|
164
182
|
/**
|
|
165
183
|
* General-purpose function to close all currently open UI components.
|
|
166
|
-
* This includes dialogs,
|
|
184
|
+
* This includes dialogs, dropdown menus, toasts, and any other floating UI elements
|
|
185
|
+
* managed by rtgl-global-ui.
|
|
167
186
|
* Useful for programmatically cleaning up the entire UI surface.
|
|
168
187
|
*
|
|
169
188
|
* @returns {Promise<void>} Promise that resolves when all UI components are closed
|
|
@@ -255,7 +255,9 @@ class RettangoliPopoverElement extends HTMLElement {
|
|
|
255
255
|
|
|
256
256
|
const hasContent = Array.from(wrapper.childNodes).some((node) => !this._isIgnorableTextNode(node));
|
|
257
257
|
|
|
258
|
-
|
|
258
|
+
// Keep the content wrapper slotted while open so callers can intentionally
|
|
259
|
+
// show an empty popover shell, such as an empty select menu.
|
|
260
|
+
if (hasContent || this.hasAttribute("open")) {
|
|
259
261
|
wrapper.setAttribute("slot", "content");
|
|
260
262
|
} else {
|
|
261
263
|
wrapper.removeAttribute("slot");
|