@swr-data-lab/components 2.9.0 → 2.11.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>;
@@ -4,7 +4,7 @@ import { createMapContext, MapContext } from '../context.svelte.js';
4
4
  import {} from '../types';
5
5
  import FallbackStyle from './FallbackStyle';
6
6
  import { de } from './locale';
7
- let { children, options, style = FallbackStyle, minZoom = 0, maxZoom = 14.99, zoom = $bindable(), center = $bindable(), pitch = $bindable(0), bearing = $bindable(0), loading = $bindable(true), projection = { type: 'mercator' }, allowRotation = false, allowZoom = true, showDebug = false, initialLocation: receivedInitialLocation,
7
+ let { children, options, style = FallbackStyle, minZoom = 0, maxZoom = 14.99, zoom = $bindable(), center = $bindable(), pitch = $bindable(0), bearing = $bindable(0), loading = $bindable(true), projection = { type: 'mercator' }, allowRotation = false, allowZoom = true, showDebug = false, cursor, initialLocation: receivedInitialLocation,
8
8
  // Future: This should become bindable.readonly when that becomes
9
9
  // available, see: https://github.com/sveltejs/svelte/issues/7712
10
10
  mapContext = $bindable(), cooperativeGestures = false, onmoveend, onmovestart } = $props();
@@ -64,6 +64,11 @@ $effect(() => {
64
64
  if (mapContext.map)
65
65
  mapContext.map.setStyle(style);
66
66
  });
67
+ $effect(() => {
68
+ if (mapContext.map) {
69
+ mapContext.map.getCanvas().style.cursor = cursor ?? '';
70
+ }
71
+ });
67
72
  $effect(() => {
68
73
  if (mapContext.styleLoaded) {
69
74
  mapContext.map?.setProjection(projection);
@@ -17,9 +17,13 @@ interface MapProps {
17
17
  projection?: ProjectionSpecification;
18
18
  showDebug?: boolean;
19
19
  options?: any;
20
+ /**
21
+ * Set the mouse cursor. `""` (empty string) restores Maplibre's default behaviour. See VectorLayer/Default for a common usage example
22
+ */
23
+ cursor?: string;
20
24
  mapContext?: MapContext;
21
25
  /**
22
- * "Use Ctrl + scroll to zoom"
26
+ * Show "Use Ctrl + scroll to zoom" overlay
23
27
  */
24
28
  cooperativeGestures?: boolean;
25
29
  onmovestart?: (e: MapLibreEvent) => null;
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.11.0",
5
5
  "author": "SWR Data Lab",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",