@websline/system-components 1.3.27 → 1.3.28
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/components/molecules/comboBox/ComboBox.svelte +4 -1
- package/dist/components/molecules/comboBox/Value.svelte +0 -2
- package/dist/components/molecules/comboBox/Value.svelte.d.ts +1 -3
- package/dist/components/molecules/selectorCard/SelectorCard.svelte +20 -4
- package/dist/components/molecules/tagSelector/TagSelector.svelte +4 -1
- package/dist/components/molecules/tagSelector/ValueList.svelte +0 -2
- package/dist/components/molecules/tagSelector/ValueList.svelte.d.ts +1 -3
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/lifecycle.d.ts +1 -0
- package/dist/utils/lifecycle.js +8 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { getContext } from "svelte";
|
|
3
|
+
import { utils } from "../../../index.js";
|
|
3
4
|
import Dropdown from "./Dropdown.svelte";
|
|
4
5
|
import Value from "./Value.svelte";
|
|
5
6
|
import { comboBoxVariants } from "./comboBox.variants.js";
|
|
@@ -98,6 +99,8 @@
|
|
|
98
99
|
value = valueLabel;
|
|
99
100
|
});
|
|
100
101
|
|
|
102
|
+
const bindInputRef = (v) => (inputRef = v);
|
|
103
|
+
|
|
101
104
|
const openDropdown = () => {
|
|
102
105
|
open = true;
|
|
103
106
|
isEditing = true;
|
|
@@ -189,7 +192,7 @@
|
|
|
189
192
|
}
|
|
190
193
|
: {}}>
|
|
191
194
|
<Value
|
|
192
|
-
|
|
195
|
+
{@attach utils.attachNode(bindInputRef)}
|
|
193
196
|
{localValues}
|
|
194
197
|
{name}
|
|
195
198
|
onKeydown={handleKey}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { comboBoxVariants } from "./comboBox.variants.js";
|
|
3
3
|
|
|
4
4
|
let {
|
|
5
|
-
inputRef = $bindable(),
|
|
6
5
|
localValues,
|
|
7
6
|
name,
|
|
8
7
|
onKeydown,
|
|
@@ -26,7 +25,6 @@
|
|
|
26
25
|
|
|
27
26
|
<div class={styles.value({ disabled: localValues.disabled })}>
|
|
28
27
|
<input
|
|
29
|
-
bind:this={inputRef}
|
|
30
28
|
bind:value
|
|
31
29
|
autocomplete="off"
|
|
32
30
|
class={styles.searchInput()}
|
|
@@ -4,16 +4,14 @@ type Value = {
|
|
|
4
4
|
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
5
|
};
|
|
6
6
|
declare const Value: import("svelte").Component<{
|
|
7
|
-
inputRef?: any;
|
|
8
7
|
localValues: any;
|
|
9
8
|
name: any;
|
|
10
9
|
onKeydown: any;
|
|
11
10
|
onOpenDropdown: any;
|
|
12
11
|
placeholder: any;
|
|
13
12
|
value?: any;
|
|
14
|
-
} & Record<string, any>, {}, "value"
|
|
13
|
+
} & Record<string, any>, {}, "value">;
|
|
15
14
|
type $$ComponentProps = {
|
|
16
|
-
inputRef?: any;
|
|
17
15
|
localValues: any;
|
|
18
16
|
name: any;
|
|
19
17
|
onKeydown: any;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import { settled } from "svelte";
|
|
2
3
|
import { selectorCardVariants } from "./selectorCard.variants.js";
|
|
3
4
|
import { Switch, Radio, Label, utils } from "../../../index.js";
|
|
4
5
|
|
|
@@ -35,6 +36,8 @@
|
|
|
35
36
|
...rest
|
|
36
37
|
} = $props();
|
|
37
38
|
|
|
39
|
+
let inputRef = $state();
|
|
40
|
+
|
|
38
41
|
let inputProps = $derived({
|
|
39
42
|
disabled,
|
|
40
43
|
id,
|
|
@@ -44,7 +47,6 @@
|
|
|
44
47
|
// prevent input click from colliding with card clicks
|
|
45
48
|
onclick: (e) => e.stopPropagation(),
|
|
46
49
|
});
|
|
47
|
-
let styles = $derived(selectorCardVariants({ disabled, error, type }));
|
|
48
50
|
|
|
49
51
|
let localHelperText = $derived.by(() => {
|
|
50
52
|
if (error && errorText) {
|
|
@@ -54,9 +56,15 @@
|
|
|
54
56
|
return helperText;
|
|
55
57
|
});
|
|
56
58
|
|
|
57
|
-
let
|
|
59
|
+
let styles = $derived(selectorCardVariants({ disabled, error, type }));
|
|
60
|
+
|
|
61
|
+
const bindInputRef = (v) => (inputRef = v);
|
|
62
|
+
|
|
63
|
+
const handleClick = async () => {
|
|
58
64
|
if (type === "radio" && checked) return;
|
|
59
65
|
checked = !checked;
|
|
66
|
+
await settled();
|
|
67
|
+
inputRef?.dispatchEvent(new Event("change", { bubbles: true }));
|
|
60
68
|
};
|
|
61
69
|
</script>
|
|
62
70
|
|
|
@@ -66,7 +74,11 @@
|
|
|
66
74
|
inert={disabled}
|
|
67
75
|
{...rest}>
|
|
68
76
|
{#if type === "radio"}
|
|
69
|
-
<Radio
|
|
77
|
+
<Radio
|
|
78
|
+
{@attach utils.attachNode(bindInputRef)}
|
|
79
|
+
bind:checked
|
|
80
|
+
class={styles.input()}
|
|
81
|
+
{...inputProps} />
|
|
70
82
|
{/if}
|
|
71
83
|
<div class={styles.content()}>
|
|
72
84
|
{#if label}
|
|
@@ -77,6 +89,10 @@
|
|
|
77
89
|
{/if}
|
|
78
90
|
</div>
|
|
79
91
|
{#if type === "switch"}
|
|
80
|
-
<Switch
|
|
92
|
+
<Switch
|
|
93
|
+
{@attach utils.attachNode(bindInputRef)}
|
|
94
|
+
bind:checked
|
|
95
|
+
class={styles.input()}
|
|
96
|
+
{...inputProps} />
|
|
81
97
|
{/if}
|
|
82
98
|
</div>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { getContext } from "svelte";
|
|
3
|
+
import { utils } from "../../../index.js";
|
|
3
4
|
import Dropdown from "./Dropdown.svelte";
|
|
4
5
|
import ValueList from "./ValueList.svelte";
|
|
5
6
|
import { tagSelectorVariants } from "./tagSelector.variants.js";
|
|
@@ -68,6 +69,8 @@
|
|
|
68
69
|
if (autofocus && inputRef) inputRef.focus();
|
|
69
70
|
});
|
|
70
71
|
|
|
72
|
+
const bindInputRef = (v) => (inputRef = v);
|
|
73
|
+
|
|
71
74
|
const openDropdown = () => {
|
|
72
75
|
open = true;
|
|
73
76
|
highlighted = -1;
|
|
@@ -219,7 +222,7 @@
|
|
|
219
222
|
{/each}
|
|
220
223
|
{/if}
|
|
221
224
|
<ValueList
|
|
222
|
-
|
|
225
|
+
{@attach utils.attachNode(bindInputRef)}
|
|
223
226
|
{localValues}
|
|
224
227
|
onKeydown={handleKey}
|
|
225
228
|
onOpenDropdown={openDropdown}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { tagSelectorVariants } from "./tagSelector.variants.js";
|
|
4
4
|
|
|
5
5
|
let {
|
|
6
|
-
inputRef = $bindable(),
|
|
7
6
|
localValues,
|
|
8
7
|
onKeydown,
|
|
9
8
|
onOpenDropdown,
|
|
@@ -30,7 +29,6 @@
|
|
|
30
29
|
{#if !localValues.disabled}
|
|
31
30
|
<Tag class={styles.searchField()} icon="add" variant="outline">
|
|
32
31
|
<input
|
|
33
|
-
bind:this={inputRef}
|
|
34
32
|
bind:value={query}
|
|
35
33
|
autocomplete="off"
|
|
36
34
|
class={styles.searchInput()}
|
|
@@ -4,7 +4,6 @@ type ValueList = {
|
|
|
4
4
|
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
5
|
};
|
|
6
6
|
declare const ValueList: import("svelte").Component<{
|
|
7
|
-
inputRef?: any;
|
|
8
7
|
localValues: any;
|
|
9
8
|
onKeydown: any;
|
|
10
9
|
onOpenDropdown: any;
|
|
@@ -14,9 +13,8 @@ declare const ValueList: import("svelte").Component<{
|
|
|
14
13
|
placeholder: any;
|
|
15
14
|
query?: any;
|
|
16
15
|
value?: any[];
|
|
17
|
-
} & Record<string, any>, {}, "
|
|
16
|
+
} & Record<string, any>, {}, "query">;
|
|
18
17
|
type $$ComponentProps = {
|
|
19
|
-
inputRef?: any;
|
|
20
18
|
localValues: any;
|
|
21
19
|
onKeydown: any;
|
|
22
20
|
onOpenDropdown: any;
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function attachNode(setter: any): (node: any) => () => any;
|