sprintify-ui 0.0.111 → 0.0.112

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,6 +1,6 @@
1
1
  import { MaybeElementRef } from '@vueuse/core';
2
2
  interface UseClickOutsideOptions {
3
- includes?: MaybeElementRef[];
3
+ includes?: (MaybeElementRef | string)[];
4
4
  }
5
5
  export declare function useClickOutside(element: MaybeElementRef, callback: () => void, options?: UseClickOutsideOptions): {
6
6
  stop: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.0.111",
3
+ "version": "0.0.112",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -1,7 +1,8 @@
1
1
  import { MaybeElementRef, unrefElement, tryOnScopeDispose } from '@vueuse/core';
2
+ import { isString } from 'lodash';
2
3
 
3
4
  interface UseClickOutsideOptions {
4
- includes?: MaybeElementRef[];
5
+ includes?: (MaybeElementRef | string)[];
5
6
  }
6
7
 
7
8
  export function useClickOutside(
@@ -27,7 +28,18 @@ export function useClickOutside(
27
28
  function onClick(e: Event) {
28
29
  const el = unrefElement(element);
29
30
 
30
- const includeEls = options.includes?.map(unrefElement) ?? [];
31
+ const includeEls = [] as Element[];
32
+
33
+ options.includes?.forEach((include) => {
34
+ if (isString(include)) {
35
+ includeEls.push(...document.querySelectorAll(include));
36
+ return;
37
+ }
38
+ const element = unrefElement(include);
39
+ if (element) {
40
+ includeEls.push(element);
41
+ }
42
+ }) ?? [];
31
43
 
32
44
  if (!el) {
33
45
  return;