@marianmeres/stuic 2.27.0 → 2.29.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/actions/popover/popover.svelte.d.ts +7 -0
- package/dist/actions/popover/popover.svelte.js +18 -0
- package/dist/actions/tooltip/tooltip.svelte.js +1 -1
- package/dist/components/CommandMenu/CommandMenu.svelte +1 -1
- package/dist/components/Input/FieldFile.svelte +1 -1
- package/dist/components/Input/FieldOptions.svelte +6 -6
- package/dist/components/Input/FieldRadios.svelte +1 -1
- package/dist/components/Input/index.css +1 -0
- package/package.json +1 -1
|
@@ -26,6 +26,13 @@ export declare function closePopover(id: string): void;
|
|
|
26
26
|
* @param id - The popover ID to toggle
|
|
27
27
|
*/
|
|
28
28
|
export declare function togglePopover(id: string): void;
|
|
29
|
+
/**
|
|
30
|
+
* Check if a popover is currently open by its registered ID.
|
|
31
|
+
*
|
|
32
|
+
* @param id - The popover ID to check
|
|
33
|
+
* @returns true if the popover is open, false otherwise
|
|
34
|
+
*/
|
|
35
|
+
export declare function isPopoverOpen(id: string): boolean;
|
|
29
36
|
/**
|
|
30
37
|
* Checks if the browser supports CSS Anchor Positioning for popovers.
|
|
31
38
|
*
|
|
@@ -6,6 +6,8 @@ import PopoverContent from "./PopoverContent.svelte";
|
|
|
6
6
|
import "./index.css";
|
|
7
7
|
// Registry of open popover hide functions for closeOthers feature
|
|
8
8
|
const openPopovers = new Set();
|
|
9
|
+
// Reactive state tracking which popovers are open by ID
|
|
10
|
+
const popoverOpenStates = $state({});
|
|
9
11
|
// Registry of popovers by ID for programmatic control
|
|
10
12
|
const popoverRegistry = new Map();
|
|
11
13
|
// Track if an open was just requested (to prevent same-click outside close)
|
|
@@ -54,6 +56,15 @@ export function closePopover(id) {
|
|
|
54
56
|
export function togglePopover(id) {
|
|
55
57
|
popoverRegistry.get(id)?.toggle();
|
|
56
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Check if a popover is currently open by its registered ID.
|
|
61
|
+
*
|
|
62
|
+
* @param id - The popover ID to check
|
|
63
|
+
* @returns true if the popover is open, false otherwise
|
|
64
|
+
*/
|
|
65
|
+
export function isPopoverOpen(id) {
|
|
66
|
+
return popoverOpenStates[id] ?? false;
|
|
67
|
+
}
|
|
57
68
|
const SHOW_DELAY = 100;
|
|
58
69
|
const HIDE_DELAY = 200;
|
|
59
70
|
const TRANSITION = 200;
|
|
@@ -310,6 +321,9 @@ export function popover(anchorEl, fn) {
|
|
|
310
321
|
// Register this popover
|
|
311
322
|
openPopovers.add(hide);
|
|
312
323
|
isVisible = true;
|
|
324
|
+
if (currentOptions.id) {
|
|
325
|
+
popoverOpenStates[currentOptions.id] = true;
|
|
326
|
+
}
|
|
313
327
|
anchorEl.setAttribute("aria-expanded", "true");
|
|
314
328
|
const offsetValue = currentOptions.offset || "0.25rem";
|
|
315
329
|
const useAnchorPositioning = isSupported && !currentOptions.forceFallback;
|
|
@@ -409,6 +423,9 @@ export function popover(anchorEl, fn) {
|
|
|
409
423
|
if (!isVisible)
|
|
410
424
|
return;
|
|
411
425
|
isVisible = false;
|
|
426
|
+
if (currentOptions.id) {
|
|
427
|
+
popoverOpenStates[currentOptions.id] = false;
|
|
428
|
+
}
|
|
412
429
|
// Unregister from open popovers
|
|
413
430
|
openPopovers.delete(hide);
|
|
414
431
|
anchorEl.setAttribute("aria-expanded", "false");
|
|
@@ -547,6 +564,7 @@ export function popover(anchorEl, fn) {
|
|
|
547
564
|
// Unregister from popover registry
|
|
548
565
|
if (currentOptions.id) {
|
|
549
566
|
popoverRegistry.delete(currentOptions.id);
|
|
567
|
+
delete popoverOpenStates[currentOptions.id];
|
|
550
568
|
}
|
|
551
569
|
document.removeEventListener("keydown", onEscape);
|
|
552
570
|
document.removeEventListener("click", onClickOutside);
|
|
@@ -29,7 +29,7 @@ export function isTooltipSupported() {
|
|
|
29
29
|
}
|
|
30
30
|
const _classTooltip = `
|
|
31
31
|
bg-tooltip-bg dark:bg-tooltip-bg-dark text-tooltip-text dark:text-tooltip-text-dark
|
|
32
|
-
text-
|
|
32
|
+
text-sm tracking-tight rounded my-1
|
|
33
33
|
px-2.5 py-1.5
|
|
34
34
|
max-w-64
|
|
35
35
|
z-50
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"form-input",
|
|
130
130
|
"block border-0 w-full text-sm!",
|
|
131
131
|
"file:rounded file:border-0 file:mr-4 file:bg-neutral-200",
|
|
132
|
-
"file:px-2 file:py-
|
|
132
|
+
"file:px-2 file:py-1 file:cursor-pointer file:text-sm",
|
|
133
133
|
"focus-visible:ring-0 focus:ring-0 focus:leading-0",
|
|
134
134
|
renderSize,
|
|
135
135
|
classInput
|
|
@@ -617,7 +617,7 @@
|
|
|
617
617
|
type="button"
|
|
618
618
|
onclick={() => _selectedColl.addMany(options.items)}
|
|
619
619
|
class={twMerge(
|
|
620
|
-
"control flex items-center p-1 m-1 text-
|
|
620
|
+
"control flex items-center p-1 m-1 text-sm opacity-75 underline rounded",
|
|
621
621
|
"hover:opacity-100 focus-visible:outline-neutral-400 focus-visible:opacity-100"
|
|
622
622
|
)}
|
|
623
623
|
tabindex={4}
|
|
@@ -633,7 +633,7 @@
|
|
|
633
633
|
input?.focus();
|
|
634
634
|
}}
|
|
635
635
|
class={twMerge(
|
|
636
|
-
"control flex items-center p-1 m-1 text-
|
|
636
|
+
"control flex items-center p-1 m-1 text-sm opacity-75 underline rounded",
|
|
637
637
|
"hover:opacity-100 focus-visible:outline-neutral-400 focus-visible:opacity-100"
|
|
638
638
|
)}
|
|
639
639
|
class:opacity-20={!selected.items.length}
|
|
@@ -643,8 +643,8 @@
|
|
|
643
643
|
{@html t(cardinality === 1 ? "clear" : "clear_all")}
|
|
644
644
|
</button>
|
|
645
645
|
|
|
646
|
-
<span class="p-1 m-1 text-
|
|
647
|
-
<span class="flex-1 block justify-end opacity-50 text-right text-
|
|
646
|
+
<span class="p-1 m-1 text-sm"> </span>
|
|
647
|
+
<span class="flex-1 block justify-end opacity-50 text-right text-sm p-1 pr-2">
|
|
648
648
|
{selected.items.length}
|
|
649
649
|
{#if cardinality > 0 && cardinality < Infinity}
|
|
650
650
|
{@html t("cardinality_of")} {cardinality}
|
|
@@ -694,7 +694,7 @@
|
|
|
694
694
|
{#if _optgroup}
|
|
695
695
|
<div
|
|
696
696
|
class={twMerge(
|
|
697
|
-
"text-
|
|
697
|
+
"text-sm capitalize opacity-50 border-b border-black/10 mb-0.5 p-1 mx-1",
|
|
698
698
|
classOptgroup
|
|
699
699
|
)}
|
|
700
700
|
>
|
|
@@ -767,7 +767,7 @@
|
|
|
767
767
|
</div>
|
|
768
768
|
<!-- {/if} -->
|
|
769
769
|
<div class="p-2 px-3 flex items-end justify-between">
|
|
770
|
-
<div class="text-
|
|
770
|
+
<div class="text-sm opacity-50">
|
|
771
771
|
<!-- Use arrows to navigate. Spacebar and Enter to select and/or submit. -->
|
|
772
772
|
{#if allowUnknown}
|
|
773
773
|
{@html t("unknown_allowed")}
|