@swr-data-lab/components 2.9.0 → 2.10.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.
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">import FormLabel from '../FormLabel/FormLabel.svelte';
2
- let { label, options, size = 'default', value = $bindable(null) } = $props();
2
+ let { label, options, size = 'default', value = $bindable(null), onchange } = $props();
3
3
  const groupId = $props.id();
4
4
  const groupName = 'select-' + groupId;
5
5
  function optionToID(o) {
@@ -15,7 +15,14 @@ function optionToID(o) {
15
15
  <label for={optionToID(o)}>
16
16
  {o}
17
17
  </label>
18
- <input id={optionToID(o)} name={groupName} value={o} type="radio" bind:group={value} />
18
+ <input
19
+ id={optionToID(o)}
20
+ name={groupName}
21
+ value={o}
22
+ type="radio"
23
+ bind:group={value}
24
+ {onchange}
25
+ />
19
26
  </li>
20
27
  {/each}
21
28
  </ul>
@@ -12,9 +12,13 @@ interface SwitcherProps {
12
12
  */
13
13
  size?: 'default' | 'small';
14
14
  /**
15
- * The currently-selected option
15
+ * The currently-selected option (bindable)
16
16
  */
17
17
  value: string | null;
18
+ /**
19
+ * Fired when the selected value changes (Prefer `value` if possible)
20
+ */
21
+ onchange?: (e: Event) => void;
18
22
  }
19
23
  declare const Switcher: import("svelte").Component<SwitcherProps, {}, "value">;
20
24
  type Switcher = ReturnType<typeof Switcher>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@swr-data-lab/components",
3
3
  "description": "SWR Data Lab component library",
4
- "version": "2.9.0",
4
+ "version": "2.10.0",
5
5
  "author": "SWR Data Lab",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",