pukaad-ui-lib 1.160.0 → 1.161.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/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
3
  "configKey": "pukaadUI",
4
- "version": "1.160.0",
4
+ "version": "1.161.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -36,9 +36,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
36
36
  id: string;
37
37
  name: string;
38
38
  description: string;
39
- limit: number;
40
39
  options: AutocompleteOption[] | string[] | number[];
41
40
  placeholder: string;
41
+ limit: number;
42
42
  disabledErrorMessage: boolean;
43
43
  disabledBorder: boolean;
44
44
  showCounter: boolean;
@@ -36,9 +36,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
36
36
  id: string;
37
37
  name: string;
38
38
  description: string;
39
- limit: number;
40
39
  options: AutocompleteOption[] | string[] | number[];
41
40
  placeholder: string;
41
+ limit: number;
42
42
  disabledErrorMessage: boolean;
43
43
  disabledBorder: boolean;
44
44
  showCounter: boolean;
@@ -219,7 +219,12 @@ watch(popoverOpen, (isOpen) => {
219
219
  const updateDisplayText = () => {
220
220
  const allOptions = resolvedOptions.value;
221
221
  if (!allOptions || allOptions.length === 0) {
222
- displayText.value = props.multiple ? modelValue.value.join(", ") : modelValue.value || "";
222
+ if (props.multiple) {
223
+ const val = modelValue.value;
224
+ displayText.value = Array.isArray(val) ? val.join(", ") : "";
225
+ } else {
226
+ displayText.value = modelValue.value || "";
227
+ }
223
228
  return;
224
229
  }
225
230
  if (props.multiple) {
@@ -259,6 +264,10 @@ onMounted(() => {
259
264
  if (props.multiple && modelValue.value === "") {
260
265
  modelValue.value = [];
261
266
  }
267
+ const hasPresetValue = props.multiple ? Array.isArray(modelValue.value) && modelValue.value.length > 0 : !!modelValue.value;
268
+ if (props.fetchFn && hasPresetValue) {
269
+ fetchData();
270
+ }
262
271
  });
263
272
  const isLimitReached = computed(() => {
264
273
  if (!props.multiple || props.limit <= 0) return false;
@@ -26,8 +26,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
26
26
  }>, {
27
27
  name: string;
28
28
  state: "user" | "admin";
29
- limit: number;
30
29
  placeholder: string;
30
+ limit: number;
31
31
  ignore: string[];
32
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
33
  declare const _default: typeof __VLS_export;
@@ -26,8 +26,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
26
26
  }>, {
27
27
  name: string;
28
28
  state: "user" | "admin";
29
- limit: number;
30
29
  placeholder: string;
30
+ limit: number;
31
31
  ignore: string[];
32
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
33
  declare const _default: typeof __VLS_export;
@@ -2,6 +2,7 @@ import type { ListboxRootProps } from "reka-ui";
2
2
  import type { HTMLAttributes } from "vue";
3
3
  type __VLS_Props = ListboxRootProps & {
4
4
  class?: HTMLAttributes["class"];
5
+ shouldFilter?: boolean;
5
6
  };
6
7
  declare var __VLS_8: {};
7
8
  type __VLS_Slots = {} & {
@@ -25,6 +26,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
25
26
  onLeave?: ((event: Event) => any) | undefined;
26
27
  }>, {
27
28
  modelValue: import("reka-ui").AcceptableValue | import("reka-ui").AcceptableValue[];
29
+ shouldFilter: boolean;
28
30
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
31
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
30
32
  declare const _default: typeof __VLS_export;
@@ -1,7 +1,7 @@
1
1
  <script setup>
2
2
  import { reactiveOmit } from "@vueuse/core";
3
3
  import { ListboxRoot, useFilter, useForwardPropsEmits } from "reka-ui";
4
- import { reactive, ref, watch } from "vue";
4
+ import { reactive, ref, toRef, watch } from "vue";
5
5
  import { cn } from "@/runtime/plugins/shadcn";
6
6
  import { provideCommandContext } from ".";
7
7
  const props = defineProps({
@@ -18,7 +18,8 @@ const props = defineProps({
18
18
  as: { type: null, required: false },
19
19
  name: { type: String, required: false },
20
20
  required: { type: Boolean, required: false },
21
- class: { type: null, required: false }
21
+ class: { type: null, required: false },
22
+ shouldFilter: { type: Boolean, required: false, default: true }
22
23
  });
23
24
  const emits = defineEmits(["update:modelValue", "highlight", "entryFocus", "leave"]);
24
25
  const delegatedProps = reactiveOmit(props, "class");
@@ -62,12 +63,15 @@ function filterItems() {
62
63
  watch(
63
64
  () => filterState.search,
64
65
  () => {
65
- filterItems();
66
+ if (props.shouldFilter) {
67
+ filterItems();
68
+ }
66
69
  }
67
70
  );
68
71
  provideCommandContext({
69
72
  allItems,
70
73
  allGroups,
74
+ shouldFilter: toRef(props, "shouldFilter"),
71
75
  filterState
72
76
  });
73
77
  </script>
@@ -2,6 +2,7 @@ import type { ListboxRootProps } from "reka-ui";
2
2
  import type { HTMLAttributes } from "vue";
3
3
  type __VLS_Props = ListboxRootProps & {
4
4
  class?: HTMLAttributes["class"];
5
+ shouldFilter?: boolean;
5
6
  };
6
7
  declare var __VLS_8: {};
7
8
  type __VLS_Slots = {} & {
@@ -25,6 +26,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
25
26
  onLeave?: ((event: Event) => any) | undefined;
26
27
  }>, {
27
28
  modelValue: import("reka-ui").AcceptableValue | import("reka-ui").AcceptableValue[];
29
+ shouldFilter: boolean;
28
30
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
31
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
30
32
  declare const _default: typeof __VLS_export;
@@ -11,9 +11,12 @@ const props = defineProps({
11
11
  as: { type: null, required: false }
12
12
  });
13
13
  const delegatedProps = reactiveOmit(props, "class", "forceShow");
14
- const { filterState } = useCommand();
14
+ const { filterState, shouldFilter, allItems } = useCommand();
15
15
  const isRender = computed(() => {
16
16
  if (props.forceShow) return true;
17
+ if (!shouldFilter.value) {
18
+ return allItems.value.size === 0;
19
+ }
17
20
  return !!filterState.search && filterState.filtered.count === 0;
18
21
  });
19
22
  </script>
@@ -11,11 +11,12 @@ const props = defineProps({
11
11
  heading: { type: String, required: false }
12
12
  });
13
13
  const delegatedProps = reactiveOmit(props, "class");
14
- const { allGroups, filterState } = useCommand();
14
+ const { allGroups, filterState, shouldFilter } = useCommand();
15
15
  const id = useId();
16
- const isRender = computed(
17
- () => !filterState.search ? true : filterState.filtered.groups.has(id)
18
- );
16
+ const isRender = computed(() => {
17
+ if (!shouldFilter.value) return true;
18
+ return !filterState.search ? true : filterState.filtered.groups.has(id);
19
+ });
19
20
  provideCommandGroupContext({ id });
20
21
  onMounted(() => {
21
22
  if (!allGroups.value.has(id)) allGroups.value.set(id, /* @__PURE__ */ new Set());
@@ -15,9 +15,12 @@ const emits = defineEmits(["select"]);
15
15
  const delegatedProps = reactiveOmit(props, "class");
16
16
  const forwarded = useForwardPropsEmits(delegatedProps, emits);
17
17
  const id = useId();
18
- const { filterState, allItems, allGroups } = useCommand();
18
+ const { filterState, allItems, allGroups, shouldFilter } = useCommand();
19
19
  const groupContext = useCommandGroup();
20
20
  const isRender = computed(() => {
21
+ if (!shouldFilter.value) {
22
+ return true;
23
+ }
21
24
  if (!filterState.search) {
22
25
  return true;
23
26
  } else {
@@ -11,6 +11,7 @@ export { default as CommandShortcut } from "./CommandShortcut.vue.js";
11
11
  export declare const useCommand: <T extends {
12
12
  allItems: Ref<Map<string, string>>;
13
13
  allGroups: Ref<Map<string, Set<string>>>;
14
+ shouldFilter: Ref<boolean>;
14
15
  filterState: {
15
16
  search: string;
16
17
  filtered: {
@@ -22,6 +23,7 @@ export declare const useCommand: <T extends {
22
23
  } | null | undefined = {
23
24
  allItems: Ref<Map<string, string>>;
24
25
  allGroups: Ref<Map<string, Set<string>>>;
26
+ shouldFilter: Ref<boolean>;
25
27
  filterState: {
26
28
  search: string;
27
29
  filtered: {
@@ -33,6 +35,7 @@ export declare const useCommand: <T extends {
33
35
  }>(fallback?: T | undefined) => T extends null ? {
34
36
  allItems: Ref<Map<string, string>>;
35
37
  allGroups: Ref<Map<string, Set<string>>>;
38
+ shouldFilter: Ref<boolean>;
36
39
  filterState: {
37
40
  search: string;
38
41
  filtered: {
@@ -44,6 +47,7 @@ export declare const useCommand: <T extends {
44
47
  } | null : {
45
48
  allItems: Ref<Map<string, string>>;
46
49
  allGroups: Ref<Map<string, Set<string>>>;
50
+ shouldFilter: Ref<boolean>;
47
51
  filterState: {
48
52
  search: string;
49
53
  filtered: {
@@ -55,6 +59,7 @@ export declare const useCommand: <T extends {
55
59
  }, provideCommandContext: (contextValue: {
56
60
  allItems: Ref<Map<string, string>>;
57
61
  allGroups: Ref<Map<string, Set<string>>>;
62
+ shouldFilter: Ref<boolean>;
58
63
  filterState: {
59
64
  search: string;
60
65
  filtered: {
@@ -66,6 +71,7 @@ export declare const useCommand: <T extends {
66
71
  }) => {
67
72
  allItems: Ref<Map<string, string>>;
68
73
  allGroups: Ref<Map<string, Set<string>>>;
74
+ shouldFilter: Ref<boolean>;
69
75
  filterState: {
70
76
  search: string;
71
77
  filtered: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.160.0",
3
+ "version": "1.161.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",