y200subcontrols 0.0.390 → 0.0.392
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.
|
@@ -6,16 +6,11 @@ export let menuButtonStyle = `space-x-1 px-2 text-slate-600 hover:bg-slate-500/2
|
|
|
6
6
|
`;
|
|
7
7
|
export let menuStyle = "";
|
|
8
8
|
export let menuWidth = 200;
|
|
9
|
+
export let maxMenuHeight = 350;
|
|
9
10
|
export let disabled = false;
|
|
10
11
|
let menuItemContainer;
|
|
11
12
|
let menuOpen = false;
|
|
12
13
|
function openMenu(event) {
|
|
13
|
-
menuOpen = true;
|
|
14
|
-
}
|
|
15
|
-
function closeMenu() {
|
|
16
|
-
menuOpen = false;
|
|
17
|
-
}
|
|
18
|
-
onMount(() => {
|
|
19
14
|
const buttons = menuItemContainer.querySelectorAll('[data-menu-item="true"]');
|
|
20
15
|
for (const button of buttons) {
|
|
21
16
|
button.addEventListener("click", () => closeMenu());
|
|
@@ -23,6 +18,12 @@ onMount(() => {
|
|
|
23
18
|
button.className = menuButtonStyle;
|
|
24
19
|
}
|
|
25
20
|
}
|
|
21
|
+
menuOpen = true;
|
|
22
|
+
}
|
|
23
|
+
function closeMenu() {
|
|
24
|
+
menuOpen = false;
|
|
25
|
+
}
|
|
26
|
+
onMount(() => {
|
|
26
27
|
});
|
|
27
28
|
</script>
|
|
28
29
|
|
|
@@ -47,7 +48,11 @@ onMount(() => {
|
|
|
47
48
|
: '0fr'}; width:{menuWidth}px;"
|
|
48
49
|
>
|
|
49
50
|
<div class="overflow-hidden">
|
|
50
|
-
<ul
|
|
51
|
+
<ul
|
|
52
|
+
class="py-2 overflow-y-auto"
|
|
53
|
+
bind:this={menuItemContainer}
|
|
54
|
+
style="max-height: {maxMenuHeight}px; scrollbar-width: thin;"
|
|
55
|
+
>
|
|
51
56
|
<slot />
|
|
52
57
|
</ul>
|
|
53
58
|
</div>
|
|
@@ -16,10 +16,10 @@ function filterElements() {
|
|
|
16
16
|
elementsFilterd = elements;
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
const _searchQuery = searchQuery.toLowerCase();
|
|
20
20
|
let _elements = [];
|
|
21
21
|
for (const element of elements) {
|
|
22
|
-
if (element.content.toLowerCase().includes(
|
|
22
|
+
if (element.content.toLowerCase().includes(_searchQuery)) {
|
|
23
23
|
_elements.push(element);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -7,6 +7,7 @@ export let busy = false;
|
|
|
7
7
|
export let dialogSize = "md";
|
|
8
8
|
export let showCloseButton = true;
|
|
9
9
|
let dialog;
|
|
10
|
+
let isClickInside = false;
|
|
10
11
|
export function openDialog() {
|
|
11
12
|
setTimeout(() => {
|
|
12
13
|
dialog.classList.add("scale-0");
|
|
@@ -26,9 +27,19 @@ function fireCancelDialog() {
|
|
|
26
27
|
}
|
|
27
28
|
function dialogClicked(event) {
|
|
28
29
|
if (event.target === dialog) {
|
|
30
|
+
if (isClickInside) {
|
|
31
|
+
isClickInside = false;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
29
34
|
fireCancelDialog();
|
|
30
35
|
}
|
|
31
36
|
}
|
|
37
|
+
function handleMouseDown(event) {
|
|
38
|
+
isClickInside = true;
|
|
39
|
+
}
|
|
40
|
+
function handeMouseUp(event) {
|
|
41
|
+
isClickInside = false;
|
|
42
|
+
}
|
|
32
43
|
</script>
|
|
33
44
|
|
|
34
45
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
@@ -79,9 +90,12 @@ function dialogClicked(event) {
|
|
|
79
90
|
</button>
|
|
80
91
|
</div>
|
|
81
92
|
{/if}
|
|
82
|
-
</div>
|
|
83
|
-
<slot />
|
|
93
|
+
</div>
|
|
84
94
|
|
|
95
|
+
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
96
|
+
<div on:mousedown={handleMouseDown} on:mouseup={handeMouseUp}>
|
|
97
|
+
<slot />
|
|
98
|
+
</div>
|
|
85
99
|
<div slot="buttons" class="grid {allowSubmit ? 'grid-cols-2' : 'grid-cols-1'} gap-2 my-2">
|
|
86
100
|
<slot name="buttons">
|
|
87
101
|
{#if allowSubmit}
|
|
@@ -6,7 +6,7 @@ export let isLight = false;
|
|
|
6
6
|
{#if !isLight}
|
|
7
7
|
<span
|
|
8
8
|
class="inline-block text-center
|
|
9
|
-
{size === 'sm' ? 'text-sm rounded-3xl px-3 py-1
|
|
9
|
+
{size === 'sm' ? 'text-sm rounded-3xl px-3 py-1' : ''}
|
|
10
10
|
{size === 'md' ? 'text-base rounded-3xl px-4 py-2' : ''}
|
|
11
11
|
{size === 'lg' ? 'text-lg rounded-3xl px-6 py-3' : ''}
|
|
12
12
|
{theme === 'teal' ? 'bg-teal-500 text-teal-50' : ''}
|