@kws3/ui 1.6.1 → 1.6.2

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.
@@ -28,6 +28,10 @@ Instead of listing all the selected items inside the input., Default: `false`
28
28
  @param {string} [no_options_msg="No matching options"] - Message to display when no matching options are found, Default: `"No matching options"`
29
29
  @param {string} [remove_btn_tip="Remove"] - Tooltip text for Remove Item button. This `string` will precede the selected Item Name in the tooltip., Default: `"Remove"`
30
30
  @param {string} [remove_all_tip="Remove all"] - Tooltip text for the Clear All button, Default: `"Remove all"`
31
+ @param {HTMLElement|string} [dropdown_portal=undefined] - Where to render the dropdown list.
32
+ Can be a DOM element or a `string` with the CSS selector of the element.
33
+
34
+ By default it renders in a custom container appended to `document.body`., Default: `undefined`
31
35
  @param {string} [class=""] - CSS classes for input container, Default: `""`
32
36
 
33
37
  ### Events
@@ -106,7 +110,7 @@ Default value: `<span>{option[search_key] || option}</span>`
106
110
  style={shouldShowClearAll ? "" : "display: none;"} />
107
111
  {/if}
108
112
  {#if rootContainer}
109
- <div class="kws-searchableselect" use:portal={"#" + rootContainerId}>
113
+ <div class="kws-searchableselect" use:portal={dropdown_portal}>
110
114
  <ul
111
115
  bind:this={dropdown}
112
116
  class="options {single ? 'is-single' : 'is-multi'}"
@@ -159,6 +163,8 @@ Default value: `<span>{option[search_key] || option}</span>`
159
163
  },
160
164
  };
161
165
 
166
+ const rootContainerId = "kws-overlay-root";
167
+
162
168
  /**
163
169
  * Value of the Input
164
170
  *
@@ -237,6 +243,16 @@ Default value: `<span>{option[search_key] || option}</span>`
237
243
  */
238
244
  export let remove_all_tip = "Remove all";
239
245
 
246
+ /**
247
+ * Where to render the dropdown list.
248
+ * Can be a DOM element or a `string` with the CSS selector of the element.
249
+ *
250
+ * By default it renders in a custom container appended to `document.body`.
251
+ *
252
+ * @type { HTMLElement|string}
253
+ */
254
+ export let dropdown_portal = "#" + rootContainerId;
255
+
240
256
  /**
241
257
  * CSS classes for input container
242
258
  */
@@ -250,7 +266,7 @@ Default value: `<span>{option[search_key] || option}</span>`
250
266
  }
251
267
 
252
268
  //ensure we have a root container for all our hoisitng related stuff
253
- const rootContainerId = "kws-overlay-root";
269
+
254
270
  let rootContainer = document.getElementById(rootContainerId);
255
271
  if (!rootContainer) {
256
272
  rootContainer = document.createElement("div");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kws3/ui",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "UI components for use with Svelte v3 applications.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -29,5 +29,5 @@
29
29
  "text-mask-core": "^5.1.2",
30
30
  "tippy.js": "^6.3.1"
31
31
  },
32
- "gitHead": "ea18e1e71037d787675491be9c0260b901bf9e7a"
32
+ "gitHead": "7f64ac8547337d2835c5c6fb493f7d05c5451e1c"
33
33
  }