@csedl/hotwire-svelte-helpers 3.0.0 → 4.0.1

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.
Files changed (2) hide show
  1. package/README.md +9 -20
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -44,7 +44,7 @@ to your application.js. This will check for detached instances and unmount them.
44
44
  <div data-controller="csedl-dropdown" data-panel-id="dropdown-panel-3h5k7l4">
45
45
  Button
46
46
  </div>
47
- <div id="dropdown-panel-3h5k7l4" class="hide dropdownSvelte-panel-example-class">
47
+ <div id="dropdown-panel-3h5k7l4" class="dropdownSvelte-panel-example-class" style="display: none;">
48
48
  ... any content
49
49
  </div>
50
50
  ```
@@ -52,39 +52,32 @@ to your application.js. This will check for detached instances and unmount them.
52
52
  ## Svelte Dropdowns
53
53
 
54
54
  There are some default components included, which can be used to build Svelte Dropdowns.
55
- The
55
+ Check the online example app for more details.
56
56
 
57
57
  ## What it does
58
58
 
59
- - When the button is clicked, it toggles the `hide` class on the panel and places the panel using floating-ui.
59
+ - When the button is clicked, it toggles the `display` style on the panel and places the panel using floating-ui.
60
60
  - When the panel is open, the `has-open-panel` class is added to the button, otherwise it is removed.
61
61
  - Adds functionality to close all panels when clicking outside a panel.
62
- - When a `data-src` attribute is given to the panel, on opening the panel, it fires a xhr request and replaces the configured content-tags (see: content-selectors on configs) by the response.
62
+ - When a `data-src` attribute is given to the panel, on opening the panel, it fires a xhr request and replaces the content (fetched by selector: `.content` within the panel-element) by the response.
63
63
  - This all works with stacked panels too (panel in panel).
64
64
 
65
65
  ## Close on click outside
66
66
 
67
67
  When a dropdownSvelte is open, it closes when clicking outside a panel.
68
68
 
69
- This behaviour can be stopped on:
69
+ This behaviour can be stopped by:
70
70
 
71
71
  - The clicked element or its parent elements has the `data-dropdownSvelte-persist` (not: `data-dropdownSvelte-persist="false"`) attribute.
72
72
  - the event has the attribute `event.detail.dataDropdownPersist` set to true.
73
73
 
74
- ## Flexibility
74
+ ## Notes
75
75
 
76
- The functions of this package are intended to give flexibility on various ways building a dropdownSvelte.
77
-
78
- **Important:** When creating or initializing the dropdownSvelte,
76
+ **Important:** When creating or initializing the dropdown,
79
77
  always call the initialize function before attaching a listener to the panel's close event.
80
78
  The initialize function adds a `close` event listener to the panel that executes the `onPanelClose` function.
81
79
  If your custom close function destroys the panel, this has to be done after the `onPanelClose` is fired by the `close` event.
82
80
 
83
- ## Requirements
84
-
85
- - The class `dropdownSvelte-panel-example-class` must be set to `position: absolute;`.
86
- - The class `hide` must be set to `display: none;`.
87
-
88
81
  ## Options
89
82
 
90
83
  - If there is an element with ID `arrow` inside the dropdownSvelte panel, it is treated as described on [floating-ui](https://floating-ui.com/docs/arrow).
@@ -147,7 +140,7 @@ What these helpers mainly do is to find all the dropdowns by the `has-open-panel
147
140
  <span data-controller="csedl-tooltip" data-panel-id="tooltip-123" data-delay="0.2">
148
141
  Text-with-tooltip
149
142
  </span>
150
- <div id="tooltip-123" class="hide tooltip-panel">
143
+ <div id="tooltip-123" class="tooltip-panel" style="display: none;">
151
144
  <div id="arrow"></div>
152
145
  ... any content
153
146
  </div>
@@ -159,11 +152,7 @@ It adds the class `tooltip-is-visible` to the tooltip label while the tooltip is
159
152
 
160
153
  `data-src` attribute is working similar to dropdownSvelte
161
154
 
162
- ## Rails Helpers
163
-
164
- There is a corresponding rails gem, on [GitLab](https://gitlab.com/sedl/csedl-stimulus-dropdown)
165
-
166
- ## Stimulus Usage in stimulus-dropdownSvelte
155
+ ## Stimulus Usage
167
156
 
168
157
  This package uses Stimulus unconventionally to initialize and toggle external dropdownSvelte or tooltip panels
169
158
  (via data-panel-id) rather than managing child elements within the controller’s scope,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csedl/hotwire-svelte-helpers",
3
- "version": "3.0.0",
3
+ "version": "4.0.1",
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": {