sprintify-ui 0.0.110 → 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;
@@ -169,6 +169,7 @@ export interface SelectConfigurationOption {
169
169
  [key: string]: any;
170
170
  }
171
171
  export interface SelectConfiguration {
172
+ option?: SelectConfigurationOption;
172
173
  options: SelectConfigurationOption[];
173
- onChange: (option: SelectConfigurationOption | null) => void;
174
+ onChange?: (option: SelectConfigurationOption | null) => void;
174
175
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.0.110",
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",
@@ -425,8 +425,14 @@ const selection = ref(null) as Ref<OptionValue>;
425
425
  watch(
426
426
  () => props.select,
427
427
  (select) => {
428
- if (select && select.options.length > 0) {
429
- selection.value = select.options[0].value;
428
+ if (select) {
429
+ if (select.option) {
430
+ selection.value = select.option.value;
431
+ } else if (select.options.length) {
432
+ selection.value = select.options[0].value;
433
+ }
434
+ } else {
435
+ selection.value = null;
430
436
  }
431
437
  },
432
438
  { immediate: true }
@@ -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;
@@ -205,6 +205,7 @@ export interface SelectConfigurationOption {
205
205
  }
206
206
 
207
207
  export interface SelectConfiguration {
208
+ option?: SelectConfigurationOption;
208
209
  options: SelectConfigurationOption[];
209
- onChange: (option: SelectConfigurationOption | null) => void;
210
+ onChange?: (option: SelectConfigurationOption | null) => void;
210
211
  }