@nuxt/ui 2.9.0 → 2.10.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.
Files changed (71) hide show
  1. package/dist/module.d.mts +270 -2
  2. package/dist/module.d.ts +270 -2
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +21 -2
  5. package/dist/runtime/components/data/Table.vue +8 -6
  6. package/dist/runtime/components/data/Table.vue.d.ts +2 -1
  7. package/dist/runtime/components/elements/Accordion.vue +15 -13
  8. package/dist/runtime/components/elements/Accordion.vue.d.ts +5 -2
  9. package/dist/runtime/components/elements/Button.vue.d.ts +2 -2
  10. package/dist/runtime/components/elements/Dropdown.vue +31 -25
  11. package/dist/runtime/components/elements/Dropdown.vue.d.ts +2 -0
  12. package/dist/runtime/components/elements/Meter.vue +166 -0
  13. package/dist/runtime/components/elements/Meter.vue.d.ts +123 -0
  14. package/dist/runtime/components/elements/MeterGroup.d.ts +78 -0
  15. package/dist/runtime/components/elements/MeterGroup.mjs +172 -0
  16. package/dist/runtime/components/elements/Progress.vue +284 -0
  17. package/dist/runtime/components/elements/Progress.vue.d.ts +2 -0
  18. package/dist/runtime/components/forms/Checkbox.vue.d.ts +2 -2
  19. package/dist/runtime/components/forms/Form.vue +32 -7
  20. package/dist/runtime/components/forms/Form.vue.d.ts +2 -1
  21. package/dist/runtime/components/forms/Input.vue +5 -1
  22. package/dist/runtime/components/forms/Input.vue.d.ts +12 -3
  23. package/dist/runtime/components/forms/Radio.vue +10 -9
  24. package/dist/runtime/components/forms/Radio.vue.d.ts +3 -3
  25. package/dist/runtime/components/forms/RadioGroup.vue +136 -0
  26. package/dist/runtime/components/forms/RadioGroup.vue.d.ts +118 -0
  27. package/dist/runtime/components/forms/Range.vue.d.ts +3 -3
  28. package/dist/runtime/components/forms/Select.vue.d.ts +2 -2
  29. package/dist/runtime/components/forms/SelectMenu.vue +62 -57
  30. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +6 -5
  31. package/dist/runtime/components/forms/Textarea.vue +5 -1
  32. package/dist/runtime/components/forms/Textarea.vue.d.ts +11 -2
  33. package/dist/runtime/components/forms/Toggle.vue.d.ts +2 -2
  34. package/dist/runtime/components/layout/Divider.vue +107 -0
  35. package/dist/runtime/components/layout/Divider.vue.d.ts +82 -0
  36. package/dist/runtime/components/navigation/CommandPalette.vue +10 -3
  37. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +1 -1
  38. package/dist/runtime/components/navigation/Pagination.vue +65 -9
  39. package/dist/runtime/components/navigation/Pagination.vue.d.ts +41 -3
  40. package/dist/runtime/components/navigation/Tabs.vue +1 -1
  41. package/dist/runtime/components/overlays/ContextMenu.vue +7 -2
  42. package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +2 -1
  43. package/dist/runtime/components/overlays/Modal.vue +1 -1
  44. package/dist/runtime/components/overlays/Modal.vue.d.ts +1 -1
  45. package/dist/runtime/components/overlays/Notification.vue +7 -1
  46. package/dist/runtime/components/overlays/Notifications.vue +1 -1
  47. package/dist/runtime/components/overlays/Popover.vue +22 -7
  48. package/dist/runtime/components/overlays/Popover.vue.d.ts +14 -0
  49. package/dist/runtime/components/overlays/Slideover.vue.d.ts +1 -1
  50. package/dist/runtime/components/overlays/Tooltip.vue +16 -10
  51. package/dist/runtime/components/overlays/Tooltip.vue.d.ts +1 -0
  52. package/dist/runtime/composables/useFormGroup.d.ts +3 -3
  53. package/dist/runtime/composables/useFormGroup.mjs +17 -6
  54. package/dist/runtime/composables/usePopper.d.ts +3 -3
  55. package/dist/runtime/composables/usePopper.mjs +7 -1
  56. package/dist/runtime/composables/useUI.d.ts +2 -2
  57. package/dist/runtime/composables/useUI.mjs +2 -2
  58. package/dist/runtime/types/command-palette.d.ts +1 -0
  59. package/dist/runtime/types/form.d.ts +13 -6
  60. package/dist/runtime/types/index.d.ts +2 -0
  61. package/dist/runtime/types/meter.d.ts +5 -0
  62. package/dist/runtime/types/popper.d.ts +1 -0
  63. package/dist/runtime/types/progress.d.ts +4 -0
  64. package/dist/runtime/types/utils.d.ts +1 -1
  65. package/dist/runtime/ui.config.d.ts +263 -0
  66. package/dist/runtime/ui.config.mjs +263 -19
  67. package/dist/types.d.mts +1 -1
  68. package/dist/types.d.ts +1 -1
  69. package/package.json +19 -19
  70. package/dist/runtime/utils/StateEmitter.d.ts +0 -17
  71. package/dist/runtime/utils/StateEmitter.mjs +0 -21
@@ -0,0 +1,118 @@
1
+ import type { PropType } from 'vue';
2
+ declare const _default: import("vue").DefineComponent<{
3
+ modelValue: {
4
+ type: (ObjectConstructor | NumberConstructor | StringConstructor)[];
5
+ default: string;
6
+ };
7
+ name: {
8
+ type: StringConstructor;
9
+ default: null;
10
+ };
11
+ legend: {
12
+ type: StringConstructor;
13
+ default: null;
14
+ };
15
+ options: {
16
+ type: ArrayConstructor;
17
+ default: () => never[];
18
+ };
19
+ optionAttribute: {
20
+ type: StringConstructor;
21
+ default: string;
22
+ };
23
+ valueAttribute: {
24
+ type: StringConstructor;
25
+ default: string;
26
+ };
27
+ disabled: {
28
+ type: BooleanConstructor;
29
+ default: boolean;
30
+ };
31
+ color: {
32
+ type: PropType<any>;
33
+ default: () => any;
34
+ validator(value: string): any;
35
+ };
36
+ class: {
37
+ type: PropType<any>;
38
+ default: undefined;
39
+ };
40
+ ui: {
41
+ type: PropType<Partial<any>>;
42
+ default: undefined;
43
+ };
44
+ uiRadio: {
45
+ type: PropType<Partial<any>>;
46
+ default: undefined;
47
+ };
48
+ }, {
49
+ ui: import("vue").ComputedRef<any>;
50
+ uiRadio: import("vue").ComputedRef<any>;
51
+ attrs: import("vue").ComputedRef<Pick<{
52
+ [x: string]: unknown;
53
+ }, string>>;
54
+ normalizedOptions: import("vue").ComputedRef<any[]>;
55
+ onUpdate: (value: any) => void;
56
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:modelValue")[], "change" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
57
+ modelValue: {
58
+ type: (ObjectConstructor | NumberConstructor | StringConstructor)[];
59
+ default: string;
60
+ };
61
+ name: {
62
+ type: StringConstructor;
63
+ default: null;
64
+ };
65
+ legend: {
66
+ type: StringConstructor;
67
+ default: null;
68
+ };
69
+ options: {
70
+ type: ArrayConstructor;
71
+ default: () => never[];
72
+ };
73
+ optionAttribute: {
74
+ type: StringConstructor;
75
+ default: string;
76
+ };
77
+ valueAttribute: {
78
+ type: StringConstructor;
79
+ default: string;
80
+ };
81
+ disabled: {
82
+ type: BooleanConstructor;
83
+ default: boolean;
84
+ };
85
+ color: {
86
+ type: PropType<any>;
87
+ default: () => any;
88
+ validator(value: string): any;
89
+ };
90
+ class: {
91
+ type: PropType<any>;
92
+ default: undefined;
93
+ };
94
+ ui: {
95
+ type: PropType<Partial<any>>;
96
+ default: undefined;
97
+ };
98
+ uiRadio: {
99
+ type: PropType<Partial<any>>;
100
+ default: undefined;
101
+ };
102
+ }>> & {
103
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
104
+ onChange?: ((...args: any[]) => any) | undefined;
105
+ }, {
106
+ color: any;
107
+ ui: Partial<any>;
108
+ options: unknown[];
109
+ name: string;
110
+ class: any;
111
+ legend: string;
112
+ modelValue: string | number | Record<string, any>;
113
+ disabled: boolean;
114
+ optionAttribute: string;
115
+ valueAttribute: string;
116
+ uiRadio: Partial<any>;
117
+ }, {}>;
118
+ export default _default;
@@ -55,8 +55,8 @@ declare const _default: import("vue").DefineComponent<{
55
55
  attrs: import("vue").ComputedRef<Pick<{
56
56
  [x: string]: unknown;
57
57
  }, string>>;
58
- name: import("vue").ComputedRef<any>;
59
- inputId: import("vue").ComputedRef<any>;
58
+ name: import("vue").ComputedRef<string | undefined>;
59
+ inputId: import("vue").Ref<string | undefined>;
60
60
  value: import("vue").WritableComputedRef<number>;
61
61
  wrapperClass: import("vue").ComputedRef<string>;
62
62
  inputClass: import("vue").ComputedRef<string>;
@@ -131,8 +131,8 @@ declare const _default: import("vue").DefineComponent<{
131
131
  disabled: boolean;
132
132
  size: string | number | symbol;
133
133
  max: number;
134
- inputClass: string;
135
134
  min: number;
135
+ inputClass: string;
136
136
  step: number;
137
137
  }, {}>;
138
138
  export default _default;
@@ -100,8 +100,8 @@ declare const _default: import("vue").DefineComponent<{
100
100
  attrs: ComputedRef<Pick<{
101
101
  [x: string]: unknown;
102
102
  }, string>>;
103
- name: ComputedRef<any>;
104
- inputId: ComputedRef<any>;
103
+ name: ComputedRef<string | undefined>;
104
+ inputId: import("vue").Ref<string | undefined>;
105
105
  normalizedOptionsWithPlaceholder: ComputedRef<{
106
106
  disabled?: boolean | undefined;
107
107
  children: {
@@ -52,64 +52,67 @@
52
52
 
53
53
  <div v-if="open" ref="container" :class="[uiMenu.container, uiMenu.width]">
54
54
  <Transition appear v-bind="uiMenu.transition">
55
- <component :is="searchable ? 'HComboboxOptions' : 'HListboxOptions'" static :class="[uiMenu.base, uiMenu.divide, uiMenu.ring, uiMenu.rounded, uiMenu.shadow, uiMenu.background, uiMenu.padding, uiMenu.height]">
56
- <HComboboxInput
57
- v-if="searchable"
58
- ref="searchInput"
59
- :display-value="() => query"
60
- name="q"
61
- :placeholder="searchablePlaceholder"
62
- autofocus
63
- autocomplete="off"
64
- :class="uiMenu.input"
65
- @change="query = $event.target.value"
66
- />
67
- <component
68
- :is="searchable ? 'HComboboxOption' : 'HListboxOption'"
69
- v-for="(option, index) in filteredOptions"
70
- v-slot="{ active, selected, disabled: optionDisabled }"
71
- :key="index"
72
- as="template"
73
- :value="valueAttribute ? option[valueAttribute] : option"
74
- :disabled="option.disabled"
75
- >
76
- <li :class="[uiMenu.option.base, uiMenu.option.rounded, uiMenu.option.padding, uiMenu.option.size, uiMenu.option.color, active ? uiMenu.option.active : uiMenu.option.inactive, selected && uiMenu.option.selected, optionDisabled && uiMenu.option.disabled]">
77
- <div :class="uiMenu.option.container">
78
- <slot name="option" :option="option" :active="active" :selected="selected">
79
- <UIcon v-if="option.icon" :name="option.icon" :class="[uiMenu.option.icon.base, active ? uiMenu.option.icon.active : uiMenu.option.icon.inactive, option.iconClass]" aria-hidden="true" />
80
- <UAvatar
81
- v-else-if="option.avatar"
82
- v-bind="{ size: uiMenu.option.avatar.size, ...option.avatar }"
83
- :class="uiMenu.option.avatar.base"
84
- aria-hidden="true"
85
- />
86
- <span v-else-if="option.chip" :class="uiMenu.option.chip.base" :style="{ background: `#${option.chip}` }" />
87
-
88
- <span class="truncate">{{ ['string', 'number'].includes(typeof option) ? option : option[optionAttribute] }}</span>
89
- </slot>
90
- </div>
91
-
92
- <span v-if="selected" :class="[uiMenu.option.selectedIcon.wrapper, uiMenu.option.selectedIcon.padding]">
93
- <UIcon :name="selectedIcon" :class="uiMenu.option.selectedIcon.base" aria-hidden="true" />
94
- </span>
95
- </li>
96
- </component>
97
-
98
- <component :is="searchable ? 'HComboboxOption' : 'HListboxOption'" v-if="creatable && queryOption && !filteredOptions.length" v-slot="{ active, selected }" :value="queryOption" as="template">
99
- <li :class="[uiMenu.option.base, uiMenu.option.rounded, uiMenu.option.padding, uiMenu.option.size, uiMenu.option.color, active ? uiMenu.option.active : uiMenu.option.inactive]">
100
- <div :class="uiMenu.option.container">
101
- <slot name="option-create" :option="queryOption" :active="active" :selected="selected">
102
- <span class="block truncate">Create "{{ queryOption[optionAttribute] }}"</span>
103
- </slot>
104
- </div>
105
- </li>
55
+ <div>
56
+ <div v-if="popper.arrow" data-popper-arrow :class="['invisible before:visible before:block before:rotate-45 before:z-[-1]', Object.values(uiMenu.arrow)]" />
57
+ <component :is="searchable ? 'HComboboxOptions' : 'HListboxOptions'" static :class="[uiMenu.base, uiMenu.divide, uiMenu.ring, uiMenu.rounded, uiMenu.shadow, uiMenu.background, uiMenu.padding, uiMenu.height]">
58
+ <HComboboxInput
59
+ v-if="searchable"
60
+ ref="searchInput"
61
+ :display-value="() => query"
62
+ name="q"
63
+ :placeholder="searchablePlaceholder"
64
+ autofocus
65
+ autocomplete="off"
66
+ :class="uiMenu.input"
67
+ @change="query = $event.target.value"
68
+ />
69
+ <component
70
+ :is="searchable ? 'HComboboxOption' : 'HListboxOption'"
71
+ v-for="(option, index) in filteredOptions"
72
+ v-slot="{ active, selected, disabled: optionDisabled }"
73
+ :key="index"
74
+ as="template"
75
+ :value="valueAttribute ? option[valueAttribute] : option"
76
+ :disabled="option.disabled"
77
+ >
78
+ <li :class="[uiMenu.option.base, uiMenu.option.rounded, uiMenu.option.padding, uiMenu.option.size, uiMenu.option.color, active ? uiMenu.option.active : uiMenu.option.inactive, selected && uiMenu.option.selected, optionDisabled && uiMenu.option.disabled]">
79
+ <div :class="uiMenu.option.container">
80
+ <slot name="option" :option="option" :active="active" :selected="selected">
81
+ <UIcon v-if="option.icon" :name="option.icon" :class="[uiMenu.option.icon.base, active ? uiMenu.option.icon.active : uiMenu.option.icon.inactive, option.iconClass]" aria-hidden="true" />
82
+ <UAvatar
83
+ v-else-if="option.avatar"
84
+ v-bind="{ size: uiMenu.option.avatar.size, ...option.avatar }"
85
+ :class="uiMenu.option.avatar.base"
86
+ aria-hidden="true"
87
+ />
88
+ <span v-else-if="option.chip" :class="uiMenu.option.chip.base" :style="{ background: `#${option.chip}` }" />
89
+
90
+ <span class="truncate">{{ ['string', 'number'].includes(typeof option) ? option : option[optionAttribute] }}</span>
91
+ </slot>
92
+ </div>
93
+
94
+ <span v-if="selected" :class="[uiMenu.option.selectedIcon.wrapper, uiMenu.option.selectedIcon.padding]">
95
+ <UIcon :name="selectedIcon" :class="uiMenu.option.selectedIcon.base" aria-hidden="true" />
96
+ </span>
97
+ </li>
98
+ </component>
99
+
100
+ <component :is="searchable ? 'HComboboxOption' : 'HListboxOption'" v-if="creatable && queryOption && !filteredOptions.length" v-slot="{ active, selected }" :value="queryOption" as="template">
101
+ <li :class="[uiMenu.option.base, uiMenu.option.rounded, uiMenu.option.padding, uiMenu.option.size, uiMenu.option.color, active ? uiMenu.option.active : uiMenu.option.inactive]">
102
+ <div :class="uiMenu.option.container">
103
+ <slot name="option-create" :option="queryOption" :active="active" :selected="selected">
104
+ <span class="block truncate">Create "{{ queryOption[optionAttribute] }}"</span>
105
+ </slot>
106
+ </div>
107
+ </li>
108
+ </component>
109
+ <p v-else-if="searchable && query && !filteredOptions.length" :class="uiMenu.option.empty">
110
+ <slot name="option-empty" :query="query">
111
+ No results for "{{ query }}".
112
+ </slot>
113
+ </p>
106
114
  </component>
107
- <p v-else-if="searchable && query && !filteredOptions.length" :class="uiMenu.option.empty">
108
- <slot name="option-empty" :query="query">
109
- No results for "{{ query }}".
110
- </slot>
111
- </p>
112
- </component>
115
+ </div>
113
116
  </Transition>
114
117
  </div>
115
118
  </component>
@@ -417,6 +420,8 @@ export default defineComponent({
417
420
  // eslint-disable-next-line vue/no-dupe-keys
418
421
  name,
419
422
  inputId,
423
+ // eslint-disable-next-line vue/no-dupe-keys
424
+ popper,
420
425
  trigger,
421
426
  container,
422
427
  isLeading,
@@ -145,8 +145,9 @@ declare const _default: import("vue").DefineComponent<{
145
145
  attrs: import("vue").ComputedRef<Pick<{
146
146
  [x: string]: unknown;
147
147
  }, string>>;
148
- name: import("vue").ComputedRef<any>;
149
- inputId: import("vue").ComputedRef<any>;
148
+ name: import("vue").ComputedRef<string | undefined>;
149
+ inputId: import("vue").Ref<string | undefined>;
150
+ popper: import("vue").ComputedRef<PopperOptions>;
150
151
  trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
151
152
  container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
152
153
  isLeading: import("vue").ComputedRef<string | true>;
@@ -164,7 +165,7 @@ declare const _default: import("vue").DefineComponent<{
164
165
  } | null>;
165
166
  query: import("vue").Ref<string>;
166
167
  onUpdate: (event: any) => void;
167
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close" | "open" | "update:modelValue")[], "change" | "close" | "open" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
168
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close" | "update:modelValue" | "open")[], "change" | "close" | "update:modelValue" | "open", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
168
169
  modelValue: {
169
170
  type: (ObjectConstructor | NumberConstructor | ArrayConstructor | StringConstructor)[];
170
171
  default: string;
@@ -304,10 +305,10 @@ declare const _default: import("vue").DefineComponent<{
304
305
  default: undefined;
305
306
  };
306
307
  }>> & {
307
- onClose?: ((...args: any[]) => any) | undefined;
308
- onOpen?: ((...args: any[]) => any) | undefined;
309
308
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
310
309
  onChange?: ((...args: any[]) => any) | undefined;
310
+ onClose?: ((...args: any[]) => any) | undefined;
311
+ onOpen?: ((...args: any[]) => any) | undefined;
311
312
  }, {
312
313
  id: string;
313
314
  icon: string;
@@ -66,6 +66,10 @@ export default defineComponent({
66
66
  type: Boolean,
67
67
  default: false
68
68
  },
69
+ autofocusDelay: {
70
+ type: Number,
71
+ default: 100
72
+ },
69
73
  resize: {
70
74
  type: Boolean,
71
75
  default: false
@@ -151,7 +155,7 @@ export default defineComponent({
151
155
  onMounted(() => {
152
156
  setTimeout(() => {
153
157
  autoFocus();
154
- }, 100);
158
+ }, props.autofocusDelay);
155
159
  });
156
160
  watch(() => props.modelValue, () => {
157
161
  nextTick(autoResize);
@@ -36,6 +36,10 @@ declare const _default: import("vue").DefineComponent<{
36
36
  type: BooleanConstructor;
37
37
  default: boolean;
38
38
  };
39
+ autofocusDelay: {
40
+ type: NumberConstructor;
41
+ default: number;
42
+ };
39
43
  resize: {
40
44
  type: BooleanConstructor;
41
45
  default: boolean;
@@ -76,8 +80,8 @@ declare const _default: import("vue").DefineComponent<{
76
80
  attrs: import("vue").ComputedRef<Pick<{
77
81
  [x: string]: unknown;
78
82
  }, string>>;
79
- name: import("vue").ComputedRef<any>;
80
- inputId: import("vue").ComputedRef<any>;
83
+ name: import("vue").ComputedRef<string | undefined>;
84
+ inputId: import("vue").Ref<string | undefined>;
81
85
  textarea: import("vue").Ref<HTMLTextAreaElement | null>;
82
86
  textareaClass: import("vue").ComputedRef<string>;
83
87
  onInput: (event: InputEvent) => void;
@@ -119,6 +123,10 @@ declare const _default: import("vue").DefineComponent<{
119
123
  type: BooleanConstructor;
120
124
  default: boolean;
121
125
  };
126
+ autofocusDelay: {
127
+ type: NumberConstructor;
128
+ default: number;
129
+ };
122
130
  resize: {
123
131
  type: BooleanConstructor;
124
132
  default: boolean;
@@ -173,6 +181,7 @@ declare const _default: import("vue").DefineComponent<{
173
181
  placeholder: string;
174
182
  padded: boolean;
175
183
  autofocus: boolean;
184
+ autofocusDelay: number;
176
185
  autoresize: boolean;
177
186
  textareaClass: string;
178
187
  }, {}>;
@@ -42,8 +42,8 @@ declare const _default: import("vue").DefineComponent<{
42
42
  attrs: import("vue").ComputedRef<Pick<{
43
43
  [x: string]: unknown;
44
44
  }, string>>;
45
- name: import("vue").ComputedRef<any>;
46
- inputId: import("vue").ComputedRef<any>;
45
+ name: import("vue").ComputedRef<string | undefined>;
46
+ inputId: import("vue").Ref<string | undefined>;
47
47
  active: import("vue").WritableComputedRef<boolean>;
48
48
  switchClass: import("vue").ComputedRef<string>;
49
49
  onIconClass: import("vue").ComputedRef<string>;
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <div :class="wrapperClass" v-bind="attrs">
3
+ <div :class="borderClass" />
4
+
5
+ <template v-if="label || icon || avatar || $slots.default">
6
+ <div :class="containerClass">
7
+ <slot>
8
+ <span v-if="label" :class="ui.label">
9
+ {{ label }}
10
+ </span>
11
+ <UIcon v-else-if="icon" :name="icon" :class="ui.icon.base" />
12
+ <UAvatar v-else-if="avatar" v-bind="{ size: ui.avatar.size, ...avatar }" :class="ui.avatar.base" />
13
+ </slot>
14
+ </div>
15
+
16
+ <div :class="borderClass" />
17
+ </template>
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+ import { toRef, computed, defineComponent } from "vue";
23
+ import { twMerge, twJoin } from "tailwind-merge";
24
+ import UIcon from "../elements/Icon.vue";
25
+ import UAvatar from "../elements/Avatar.vue";
26
+ import { useUI } from "../../composables/useUI";
27
+ import { mergeConfig } from "../../utils";
28
+ import appConfig from "#build/app.config";
29
+ import { divider } from "#ui/ui.config";
30
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.divider, divider);
31
+ export default defineComponent({
32
+ components: {
33
+ UIcon,
34
+ UAvatar
35
+ },
36
+ inheritAttrs: false,
37
+ props: {
38
+ label: {
39
+ type: String,
40
+ default: null
41
+ },
42
+ icon: {
43
+ type: String,
44
+ default: null
45
+ },
46
+ avatar: {
47
+ type: Object,
48
+ default: null
49
+ },
50
+ orientation: {
51
+ type: String,
52
+ default: "horizontal",
53
+ validator: (value) => ["horizontal", "vertical"].includes(value)
54
+ },
55
+ type: {
56
+ type: String,
57
+ default: "solid",
58
+ validator: (value) => ["solid", "dotted", "dashed"].includes(value)
59
+ },
60
+ class: {
61
+ type: [String, Object, Array],
62
+ default: void 0
63
+ },
64
+ ui: {
65
+ type: Object,
66
+ default: void 0
67
+ }
68
+ },
69
+ setup(props) {
70
+ const { ui, attrs } = useUI("divider", toRef(props, "ui"), config);
71
+ const isHorizontal = computed(() => props.orientation === "horizontal");
72
+ const wrapperClass = computed(() => {
73
+ return twMerge(twJoin(
74
+ ui.value.wrapper.base,
75
+ isHorizontal.value ? ui.value.wrapper.horizontal : ui.value.wrapper.vertical
76
+ ), props.class);
77
+ });
78
+ const containerClass = computed(() => {
79
+ return twJoin(
80
+ ui.value.container.base,
81
+ isHorizontal.value ? ui.value.container.horizontal : ui.value.container.vertical
82
+ );
83
+ });
84
+ const borderClass = computed(() => {
85
+ const typeClass = {
86
+ solid: "border-solid",
87
+ dotted: "border-dotted",
88
+ dashed: "border-dashed"
89
+ }[props.type];
90
+ return twJoin(
91
+ ui.value.border.base,
92
+ isHorizontal.value ? ui.value.border.horizontal : ui.value.border.vertical,
93
+ isHorizontal.value ? ui.value.border.size.horizontal : ui.value.border.size.vertical,
94
+ typeClass
95
+ );
96
+ });
97
+ return {
98
+ // eslint-disable-next-line vue/no-dupe-keys
99
+ ui,
100
+ attrs,
101
+ wrapperClass,
102
+ containerClass,
103
+ borderClass
104
+ };
105
+ }
106
+ });
107
+ </script>
@@ -0,0 +1,82 @@
1
+ import type { PropType } from 'vue';
2
+ import type { Avatar } from '../../types';
3
+ declare const _default: import("vue").DefineComponent<{
4
+ label: {
5
+ type: StringConstructor;
6
+ default: null;
7
+ };
8
+ icon: {
9
+ type: StringConstructor;
10
+ default: null;
11
+ };
12
+ avatar: {
13
+ type: PropType<Avatar>;
14
+ default: null;
15
+ };
16
+ orientation: {
17
+ type: PropType<"horizontal" | "vertical">;
18
+ default: string;
19
+ validator: (value: string) => boolean;
20
+ };
21
+ type: {
22
+ type: PropType<"solid" | "dotted" | "dashed">;
23
+ default: string;
24
+ validator: (value: string) => boolean;
25
+ };
26
+ class: {
27
+ type: PropType<any>;
28
+ default: undefined;
29
+ };
30
+ ui: {
31
+ type: PropType<Partial<any>>;
32
+ default: undefined;
33
+ };
34
+ }, {
35
+ ui: import("vue").ComputedRef<any>;
36
+ attrs: import("vue").ComputedRef<Pick<{
37
+ [x: string]: unknown;
38
+ }, string>>;
39
+ wrapperClass: import("vue").ComputedRef<string>;
40
+ containerClass: import("vue").ComputedRef<string>;
41
+ borderClass: import("vue").ComputedRef<string>;
42
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
43
+ label: {
44
+ type: StringConstructor;
45
+ default: null;
46
+ };
47
+ icon: {
48
+ type: StringConstructor;
49
+ default: null;
50
+ };
51
+ avatar: {
52
+ type: PropType<Avatar>;
53
+ default: null;
54
+ };
55
+ orientation: {
56
+ type: PropType<"horizontal" | "vertical">;
57
+ default: string;
58
+ validator: (value: string) => boolean;
59
+ };
60
+ type: {
61
+ type: PropType<"solid" | "dotted" | "dashed">;
62
+ default: string;
63
+ validator: (value: string) => boolean;
64
+ };
65
+ class: {
66
+ type: PropType<any>;
67
+ default: undefined;
68
+ };
69
+ ui: {
70
+ type: PropType<Partial<any>>;
71
+ default: undefined;
72
+ };
73
+ }>>, {
74
+ icon: string;
75
+ avatar: Avatar;
76
+ ui: Partial<any>;
77
+ class: any;
78
+ label: string;
79
+ type: "solid" | "dotted" | "dashed";
80
+ orientation: "horizontal" | "vertical";
81
+ }, {}>;
82
+ export default _default;
@@ -221,18 +221,25 @@ export default defineComponent({
221
221
  }
222
222
  for (const key in groupedCommands) {
223
223
  const group = props.groups.find((group2) => group2.key === key);
224
- const commands2 = groupedCommands[key].slice(0, options.value.resultLimit).map((result) => {
224
+ let commands2 = groupedCommands[key].map((result) => {
225
225
  const { item, ...data } = result;
226
226
  return {
227
227
  ...item,
228
228
  ...data
229
229
  };
230
230
  });
231
- groups2.push({ ...group, commands: commands2 });
231
+ if (group.filter && typeof group.filter === "function") {
232
+ commands2 = group.filter(query.value, commands2);
233
+ }
234
+ groups2.push({ ...group, commands: commands2.slice(0, options.value.resultLimit) });
232
235
  }
233
236
  for (const group of props.groups) {
234
237
  if (group.search && searchResults.value[group.key]?.length) {
235
- groups2.push({ ...group, commands: (searchResults.value[group.key] || []).slice(0, options.value.resultLimit) });
238
+ let commands2 = searchResults.value[group.key] || [];
239
+ if (group.filter && typeof group.filter === "function") {
240
+ commands2 = group.filter(query.value, commands2);
241
+ }
242
+ groups2.push({ ...group, commands: commands2.slice(0, options.value.resultLimit) });
236
243
  }
237
244
  }
238
245
  return groups2;
@@ -193,8 +193,8 @@ declare const _default: import("vue").DefineComponent<{
193
193
  default: undefined;
194
194
  };
195
195
  }>> & {
196
- onClose?: ((...args: any[]) => any) | undefined;
197
196
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
197
+ onClose?: ((...args: any[]) => any) | undefined;
198
198
  }, {
199
199
  icon: string;
200
200
  closeButton: Button;