@csedl/hotwire-svelte-helpers 2.2.3 → 2.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csedl/hotwire-svelte-helpers",
3
- "version": "2.2.3",
3
+ "version": "2.3.0",
4
4
  "description": "Hotwire + Svelte helpers for Rails: Stimulus floating dropdowns/toolips + Svelte global panels/modals + RTurbo-friendly utilities. Build together with the rubygem svelte-on-rails and its npm-package.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -3,7 +3,7 @@
3
3
  import { unmount } from 'svelte'
4
4
  import { cleanMount } from "../cleanMount.js";
5
5
 
6
- let { panelContent, panelTitle, panelClass, label, svgIcon } = $props();
6
+ let { panelContent, panelTitle, panelClass, label, svgIcon, panelPlacement } = $props();
7
7
 
8
8
  let buttonElement, panelInstance;
9
9
 
@@ -15,7 +15,7 @@
15
15
  buttonElement.classList.remove('has-open-panel');
16
16
  };
17
17
 
18
- function openEditPanel() {
18
+ function openPanel() {
19
19
 
20
20
  if (buttonElement.classList.contains('has-open-panel')) return;
21
21
 
@@ -28,13 +28,14 @@
28
28
  buttonElement: buttonElement,
29
29
  panelClass: panelClass,
30
30
  content: panelContent,
31
+ placement: panelPlacement
31
32
  }
32
33
  }
33
34
  );
34
35
  }
35
36
  </script>
36
37
 
37
- <span class="dropdown-button" onclick={ openEditPanel } bind:this={ buttonElement } role="button" tabindex="0" onkeyup={()=>{}}>
38
+ <span class="dropdown-button" onclick={ openPanel } bind:this={ buttonElement } role="button" tabindex="0" onkeyup={()=>{}}>
38
39
  {#if svgIcon}
39
40
  {@html svgIcon}
40
41
  {/if}
@@ -1,6 +1,6 @@
1
1
  <script>
2
- import {openDropdownPanel, hotwireSvelteConfig} from "@csedl/hotwire-svelte-helpers";
3
- import {onMount} from "svelte";
2
+ import { openDropdownPanel, hotwireSvelteConfig } from "@csedl/hotwire-svelte-helpers";
3
+ import { onMount } from "svelte";
4
4
 
5
5
  let {
6
6
  title,
@@ -9,10 +9,14 @@
9
9
  closeButtonSvg,
10
10
  buttonElement,
11
11
  content,
12
+ placement,
12
13
  } = $props()
13
14
  let panelElement
14
15
 
15
16
  onMount(() => {
17
+ if (placement) {
18
+ panelElement.setAttribute('data-placement', placement)
19
+ }
16
20
  openDropdownPanel(buttonElement, panelElement);
17
21
  });
18
22