@geoffcox/sterling-svelte 2.0.14 → 2.0.16
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/Radio.svelte +11 -5
- package/dist/Radio.svelte.d.ts +1 -2
- package/dist/Radio.types.d.ts +1 -3
- package/dist/Slider.svelte +2 -2
- package/dist/Slider.types.d.ts +1 -1
- package/package.json +1 -1
package/dist/Radio.svelte
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
<svelte:options runes={true} />
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
|
+
import type { ChangeEventHandler } from 'svelte/elements';
|
|
4
5
|
import { usingKeyboard } from './mediaQueries/usingKeyboard';
|
|
5
6
|
import type { RadioProps } from './Radio.types';
|
|
7
|
+
import { onMount } from 'svelte';
|
|
6
8
|
|
|
7
9
|
const uuid = $props.id();
|
|
8
10
|
|
|
9
11
|
let {
|
|
10
12
|
id,
|
|
11
13
|
children,
|
|
12
|
-
checked,
|
|
13
14
|
class: _class,
|
|
14
15
|
disabled = false,
|
|
15
16
|
group = $bindable(),
|
|
@@ -25,8 +26,6 @@
|
|
|
25
26
|
}
|
|
26
27
|
});
|
|
27
28
|
|
|
28
|
-
// ----- Methods ----- //
|
|
29
|
-
|
|
30
29
|
export const blur = () => {
|
|
31
30
|
inputRef?.blur();
|
|
32
31
|
};
|
|
@@ -38,6 +37,12 @@
|
|
|
38
37
|
export const focus = (options?: FocusOptions) => {
|
|
39
38
|
inputRef?.focus(options);
|
|
40
39
|
};
|
|
40
|
+
|
|
41
|
+
const onChange: ChangeEventHandler<HTMLInputElement> = (e) => {
|
|
42
|
+
if (e.currentTarget.checked) {
|
|
43
|
+
group = value;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
41
46
|
</script>
|
|
42
47
|
|
|
43
48
|
<!--
|
|
@@ -53,13 +58,14 @@
|
|
|
53
58
|
<div class="container">
|
|
54
59
|
<input
|
|
55
60
|
bind:this={inputRef}
|
|
56
|
-
{
|
|
61
|
+
checked={group === value}
|
|
57
62
|
{disabled}
|
|
58
|
-
|
|
63
|
+
{group}
|
|
59
64
|
{id}
|
|
60
65
|
type="radio"
|
|
61
66
|
{value}
|
|
62
67
|
{...rest}
|
|
68
|
+
onchange={onChange}
|
|
63
69
|
/>
|
|
64
70
|
<div class="indicator"></div>
|
|
65
71
|
</div>
|
package/dist/Radio.svelte.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { RadioProps } from './Radio.types';
|
|
2
1
|
/** A styled HTML input type=radio element with optional label. */
|
|
3
|
-
declare const Radio: import("svelte").Component<
|
|
2
|
+
declare const Radio: import("svelte").Component<import("svelte/elements").HTMLInputAttributes, {
|
|
4
3
|
blur: () => void;
|
|
5
4
|
click: () => void;
|
|
6
5
|
focus: (options?: FocusOptions) => void;
|
package/dist/Radio.types.d.ts
CHANGED
package/dist/Slider.svelte
CHANGED
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
|
|
74
74
|
// Raise change event when value changes
|
|
75
75
|
$effect(() => {
|
|
76
|
-
|
|
76
|
+
onChange?.(value);
|
|
77
77
|
});
|
|
78
78
|
|
|
79
79
|
// ----- Size tracking ----- //
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
if (change !== 0) {
|
|
168
|
-
setValue(value + change);
|
|
168
|
+
setValue((value || 0) + change);
|
|
169
169
|
event.preventDefault();
|
|
170
170
|
event.stopPropagation();
|
|
171
171
|
}
|
package/dist/Slider.types.d.ts
CHANGED