@nuxt/ui 2.11.1 → 2.12.1

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 (74) hide show
  1. package/dist/module.d.mts +100 -28
  2. package/dist/module.d.ts +100 -28
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +2 -2
  5. package/dist/runtime/components/data/Table.vue +26 -18
  6. package/dist/runtime/components/data/Table.vue.d.ts +21 -12
  7. package/dist/runtime/components/elements/Accordion.vue +8 -4
  8. package/dist/runtime/components/elements/Accordion.vue.d.ts +4 -4
  9. package/dist/runtime/components/elements/Alert.vue +8 -2
  10. package/dist/runtime/components/elements/Alert.vue.d.ts +5 -10
  11. package/dist/runtime/components/elements/Button.vue +6 -3
  12. package/dist/runtime/components/elements/Button.vue.d.ts +119 -1
  13. package/dist/runtime/components/elements/Chip.vue.d.ts +2 -2
  14. package/dist/runtime/components/elements/Dropdown.vue +66 -17
  15. package/dist/runtime/components/elements/Dropdown.vue.d.ts +31 -4
  16. package/dist/runtime/components/elements/Link.vue +9 -4
  17. package/dist/runtime/components/elements/Link.vue.d.ts +194 -4
  18. package/dist/runtime/components/forms/Form.vue +16 -7
  19. package/dist/runtime/components/forms/Form.vue.d.ts +1 -1
  20. package/dist/runtime/components/forms/Input.vue +1 -1
  21. package/dist/runtime/components/forms/Input.vue.d.ts +1 -1
  22. package/dist/runtime/components/forms/InputMenu.vue +419 -0
  23. package/dist/runtime/components/forms/InputMenu.vue.d.ts +332 -0
  24. package/dist/runtime/components/forms/RadioGroup.vue +1 -1
  25. package/dist/runtime/components/forms/Select.vue +1 -1
  26. package/dist/runtime/components/forms/Select.vue.d.ts +1 -1
  27. package/dist/runtime/components/forms/SelectMenu.vue +70 -21
  28. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +31 -10
  29. package/dist/runtime/components/forms/Toggle.vue +1 -1
  30. package/dist/runtime/components/forms/Toggle.vue.d.ts +2 -1
  31. package/dist/runtime/components/layout/Divider.vue +4 -5
  32. package/dist/runtime/components/navigation/Breadcrumb.vue +8 -5
  33. package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +4 -2
  34. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +3 -3
  35. package/dist/runtime/components/navigation/Pagination.vue +9 -4
  36. package/dist/runtime/components/navigation/Pagination.vue.d.ts +9 -0
  37. package/dist/runtime/components/navigation/VerticalNavigation.vue +53 -38
  38. package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +8 -5
  39. package/dist/runtime/components/overlays/Modal.vue.d.ts +1 -1
  40. package/dist/runtime/components/overlays/Popover.vue +49 -13
  41. package/dist/runtime/components/overlays/Popover.vue.d.ts +14 -4
  42. package/dist/runtime/components/overlays/Slideover.vue.d.ts +1 -1
  43. package/dist/runtime/components/overlays/Tooltip.vue +1 -1
  44. package/dist/runtime/composables/useShortcuts.mjs +3 -1
  45. package/dist/runtime/types/alert.d.ts +5 -0
  46. package/dist/runtime/types/breadcrumb.d.ts +1 -0
  47. package/dist/runtime/types/chip.d.ts +4 -0
  48. package/dist/runtime/types/dropdown.d.ts +2 -0
  49. package/dist/runtime/types/form.d.ts +1 -0
  50. package/dist/runtime/types/index.d.ts +1 -0
  51. package/dist/runtime/types/link.d.ts +3 -0
  52. package/dist/runtime/types/tooltip.d.ts +7 -0
  53. package/dist/runtime/types/vertical-navigation.d.ts +1 -0
  54. package/dist/runtime/ui.config/forms/input.mjs +12 -12
  55. package/dist/runtime/ui.config/forms/inputMenu.d.ts +64 -0
  56. package/dist/runtime/ui.config/forms/inputMenu.mjs +62 -0
  57. package/dist/runtime/ui.config/forms/selectMenu.d.ts +14 -12
  58. package/dist/runtime/ui.config/forms/selectMenu.mjs +7 -41
  59. package/dist/runtime/ui.config/index.d.ts +1 -0
  60. package/dist/runtime/ui.config/index.mjs +1 -0
  61. package/dist/runtime/ui.config/layout/card.mjs +1 -1
  62. package/dist/runtime/ui.config/navigation/breadcrumb.d.ts +1 -0
  63. package/dist/runtime/ui.config/navigation/breadcrumb.mjs +1 -0
  64. package/dist/runtime/ui.config/navigation/verticalNavigation.d.ts +5 -0
  65. package/dist/runtime/ui.config/navigation/verticalNavigation.mjs +5 -0
  66. package/dist/runtime/ui.config/popper.mjs +2 -1
  67. package/dist/runtime/utils/index.d.ts +1 -0
  68. package/dist/runtime/utils/index.mjs +12 -3
  69. package/dist/runtime/utils/link.d.ts +58 -0
  70. package/dist/runtime/utils/link.mjs +111 -0
  71. package/dist/runtime/utils/uid.mjs +2 -1
  72. package/dist/types.d.mts +2 -2
  73. package/dist/types.d.ts +1 -1
  74. package/package.json +31 -28
@@ -55,7 +55,7 @@ declare const _default: import("vue").DefineComponent<{
55
55
  containerClass: import("vue").ComputedRef<string>;
56
56
  onIconClass: import("vue").ComputedRef<string>;
57
57
  offIconClass: import("vue").ComputedRef<string>;
58
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
58
+ }, 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<{
59
59
  id: {
60
60
  type: StringConstructor;
61
61
  default: null;
@@ -100,6 +100,7 @@ declare const _default: import("vue").DefineComponent<{
100
100
  };
101
101
  }>> & {
102
102
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
103
+ onChange?: ((...args: any[]) => any) | undefined;
103
104
  }, {
104
105
  size: ToggleSize;
105
106
  ui: any;
@@ -68,24 +68,23 @@ export default defineComponent({
68
68
  },
69
69
  setup(props) {
70
70
  const { ui, attrs } = useUI("divider", toRef(props, "ui"), config);
71
- const isHorizontal = computed(() => props.orientation === "horizontal");
72
71
  const wrapperClass = computed(() => {
73
72
  return twMerge(twJoin(
74
73
  ui.value.wrapper.base,
75
- isHorizontal.value ? ui.value.wrapper.horizontal : ui.value.wrapper.vertical
74
+ ui.value.wrapper[props.orientation]
76
75
  ), props.class);
77
76
  });
78
77
  const containerClass = computed(() => {
79
78
  return twJoin(
80
79
  ui.value.container.base,
81
- isHorizontal.value ? ui.value.container.horizontal : ui.value.container.vertical
80
+ ui.value.container[props.orientation]
82
81
  );
83
82
  });
84
83
  const borderClass = computed(() => {
85
84
  return twJoin(
86
85
  ui.value.border.base,
87
- isHorizontal.value ? ui.value.border.horizontal : ui.value.border.vertical,
88
- isHorizontal.value ? ui.value.border.size.horizontal : ui.value.border.size.vertical,
86
+ ui.value.border[props.orientation],
87
+ ui.value.border.size[props.orientation],
89
88
  ui.value.border.type[props.type]
90
89
  );
91
90
  });
@@ -5,19 +5,19 @@
5
5
  <ULink
6
6
  as="span"
7
7
  :class="[ui.base, index === links.length - 1 ? ui.active : !!link.to ? ui.inactive : '']"
8
- v-bind="omit(link, ['label', 'icon', 'iconClass'])"
8
+ v-bind="getULinkProps(link)"
9
9
  :aria-current="index === links.length - 1 ? 'page' : undefined"
10
10
  >
11
11
  <slot name="icon" :link="link" :index="index" :is-active="index === links.length - 1">
12
12
  <UIcon
13
13
  v-if="link.icon"
14
14
  :name="link.icon"
15
- :class="[ui.icon.base, index === links.length - 1 ? ui.icon.active : !!link.to ? ui.icon.inactive : '', link.iconClass]"
15
+ :class="twMerge(twJoin(ui.icon.base, index === links.length - 1 ? ui.icon.active : !!link.to ? ui.icon.inactive : ''), link.iconClass)"
16
16
  />
17
17
  </slot>
18
18
 
19
19
  <slot :link="link" :index="index" :is-active="index === links.length - 1">
20
- {{ link.label }}
20
+ <span v-if="link.label" :class="twMerge(ui.label, link.labelClass)">{{ link.label }}</span>
21
21
  </slot>
22
22
  </ULink>
23
23
 
@@ -34,10 +34,11 @@
34
34
 
35
35
  <script>
36
36
  import { defineComponent, toRef } from "vue";
37
+ import { twMerge, twJoin } from "tailwind-merge";
37
38
  import UIcon from "../elements/Icon.vue";
38
39
  import ULink from "../elements/Link.vue";
39
40
  import { useUI } from "../../composables/useUI";
40
- import { mergeConfig, omit } from "../../utils";
41
+ import { mergeConfig, getULinkProps } from "../../utils";
41
42
  import appConfig from "#build/app.config";
42
43
  import { breadcrumb } from "#ui/ui.config";
43
44
  const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.breadcrumb, breadcrumb);
@@ -71,7 +72,9 @@ export default defineComponent({
71
72
  // eslint-disable-next-line vue/no-dupe-keys
72
73
  ui,
73
74
  attrs,
74
- omit
75
+ getULinkProps,
76
+ twMerge,
77
+ twJoin
75
78
  };
76
79
  }
77
80
  });
@@ -1,5 +1,5 @@
1
1
  import type { PropType } from 'vue';
2
- import { omit } from '../../utils';
2
+ import { twJoin } from 'tailwind-merge';
3
3
  import type { BreadcrumbLink } from '../../types';
4
4
  declare const _default: import("vue").DefineComponent<{
5
5
  links: {
@@ -23,7 +23,9 @@ declare const _default: import("vue").DefineComponent<{
23
23
  attrs: import("vue").ComputedRef<Pick<{
24
24
  [x: string]: unknown;
25
25
  }, string>>;
26
- omit: typeof omit;
26
+ getULinkProps: (props: any) => {};
27
+ twMerge: (...classLists: import("tailwind-merge").ClassNameValue[]) => string;
28
+ twJoin: typeof twJoin;
27
29
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
28
30
  links: {
29
31
  type: PropType<BreadcrumbLink[]>;
@@ -3,7 +3,7 @@ import type { UseFuseOptions } from '@vueuse/integrations/useFuse';
3
3
  import type { Group, Command, Button } from '../../types';
4
4
  declare const _default: import("vue").DefineComponent<{
5
5
  modelValue: {
6
- type: (ObjectConstructor | NumberConstructor | ArrayConstructor | StringConstructor)[];
6
+ type: (ObjectConstructor | NumberConstructor | StringConstructor | ArrayConstructor)[];
7
7
  default: null;
8
8
  };
9
9
  by: {
@@ -112,7 +112,7 @@ declare const _default: import("vue").DefineComponent<{
112
112
  onClear: () => void;
113
113
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "update:modelValue")[], "close" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
114
114
  modelValue: {
115
- type: (ObjectConstructor | NumberConstructor | ArrayConstructor | StringConstructor)[];
115
+ type: (ObjectConstructor | NumberConstructor | StringConstructor | ArrayConstructor)[];
116
116
  default: null;
117
117
  };
118
118
  by: {
@@ -220,8 +220,8 @@ declare const _default: import("vue").DefineComponent<{
220
220
  loadingIcon: string;
221
221
  nullable: boolean;
222
222
  selectedIcon: string;
223
- searchable: boolean;
224
223
  debounce: number;
224
+ searchable: boolean;
225
225
  groups: Group[];
226
226
  groupAttribute: string;
227
227
  commandAttribute: string;
@@ -4,7 +4,7 @@
4
4
  <UButton
5
5
  v-if="firstButton && showFirst"
6
6
  :size="size"
7
- :disabled="!canGoFirstOrPrev"
7
+ :disabled="!canGoFirstOrPrev || disabled"
8
8
  :class="[ui.base, ui.rounded]"
9
9
  v-bind="{ ...(ui.default.firstButton || {}), ...firstButton }"
10
10
  :ui="{ rounded: '' }"
@@ -17,7 +17,7 @@
17
17
  <UButton
18
18
  v-if="prevButton"
19
19
  :size="size"
20
- :disabled="!canGoFirstOrPrev"
20
+ :disabled="!canGoFirstOrPrev || disabled"
21
21
  :class="[ui.base, ui.rounded]"
22
22
  v-bind="{ ...(ui.default.prevButton || {}), ...prevButton }"
23
23
  :ui="{ rounded: '' }"
@@ -30,6 +30,7 @@
30
30
  v-for="(page, index) of displayedPages"
31
31
  :key="`${page}-${index}`"
32
32
  :size="size"
33
+ :disabled="disabled"
33
34
  :label="`${page}`"
34
35
  v-bind="page === currentPage ? { ...(ui.default.activeButton || {}), ...activeButton } : { ...(ui.default.inactiveButton || {}), ...inactiveButton }"
35
36
  :class="[{ 'pointer-events-none': typeof page === 'string', 'z-[1]': page === currentPage }, ui.base, ui.rounded]"
@@ -41,7 +42,7 @@
41
42
  <UButton
42
43
  v-if="nextButton"
43
44
  :size="size"
44
- :disabled="!canGoLastOrNext"
45
+ :disabled="!canGoLastOrNext || disabled"
45
46
  :class="[ui.base, ui.rounded]"
46
47
  v-bind="{ ...(ui.default.nextButton || {}), ...nextButton }"
47
48
  :ui="{ rounded: '' }"
@@ -54,7 +55,7 @@
54
55
  <UButton
55
56
  v-if="lastButton && showLast"
56
57
  :size="size"
57
- :disabled="!canGoLastOrNext"
58
+ :disabled="!canGoLastOrNext || disabled"
58
59
  :class="[ui.base, ui.rounded]"
59
60
  v-bind="{ ...(ui.default.lastButton || {}), ...lastButton }"
60
61
  :ui="{ rounded: '' }"
@@ -99,6 +100,10 @@ export default defineComponent({
99
100
  return value >= 5 && value < Number.MAX_VALUE;
100
101
  }
101
102
  },
103
+ disabled: {
104
+ type: Boolean,
105
+ default: false
106
+ },
102
107
  size: {
103
108
  type: String,
104
109
  default: () => config.default.size,
@@ -18,6 +18,10 @@ declare const _default: import("vue").DefineComponent<{
18
18
  default: number;
19
19
  validate(value: any): boolean;
20
20
  };
21
+ disabled: {
22
+ type: BooleanConstructor;
23
+ default: boolean;
24
+ };
21
25
  size: {
22
26
  type: PropType<ButtonSize>;
23
27
  default: () => any;
@@ -100,6 +104,10 @@ declare const _default: import("vue").DefineComponent<{
100
104
  default: number;
101
105
  validate(value: any): boolean;
102
106
  };
107
+ disabled: {
108
+ type: BooleanConstructor;
109
+ default: boolean;
110
+ };
103
111
  size: {
104
112
  type: PropType<ButtonSize>;
105
113
  default: () => any;
@@ -155,6 +163,7 @@ declare const _default: import("vue").DefineComponent<{
155
163
  size: ButtonSize;
156
164
  ui: any;
157
165
  class: any;
166
+ disabled: boolean;
158
167
  max: number;
159
168
  divider: string;
160
169
  pageCount: number;
@@ -1,49 +1,59 @@
1
1
  <template>
2
2
  <nav :class="ui.wrapper" v-bind="attrs">
3
- <ULink
4
- v-for="(link, index) of links"
5
- v-slot="{ isActive }"
6
- :key="index"
7
- v-bind="omit(link, ['label', 'icon', 'iconClass', 'avatar', 'badge', 'click'])"
8
- :class="[ui.base, ui.padding, ui.width, ui.ring, ui.rounded, ui.font, ui.size]"
9
- :active-class="ui.active"
10
- :inactive-class="ui.inactive"
11
- @click="link.click"
12
- @keyup.enter="$event.target.blur()"
13
- >
14
- <slot name="avatar" :link="link" :is-active="isActive">
15
- <UAvatar
16
- v-if="link.avatar"
17
- v-bind="{ size: ui.avatar.size, ...link.avatar }"
18
- :class="[ui.avatar.base]"
19
- />
20
- </slot>
21
- <slot name="icon" :link="link" :is-active="isActive">
22
- <UIcon
23
- v-if="link.icon"
24
- :name="link.icon"
25
- :class="[ui.icon.base, isActive ? ui.icon.active : ui.icon.inactive, link.iconClass]"
26
- />
27
- </slot>
28
- <slot :link="link" :is-active="isActive">
29
- <span v-if="link.label" :class="ui.label">{{ link.label }}</span>
30
- </slot>
31
- <slot name="badge" :link="link" :is-active="isActive">
32
- <span v-if="link.badge" :class="[ui.badge.base, isActive ? ui.badge.active : ui.badge.inactive]">
33
- {{ link.badge }}
34
- </span>
35
- </slot>
36
- </ULink>
3
+ <ul v-for="(section, sectionIndex) of sections" :key="`section${sectionIndex}`">
4
+ <li v-for="(link, index) of section" :key="`section${sectionIndex}-${index}`">
5
+ <ULink
6
+ v-slot="{ isActive }"
7
+ v-bind="getULinkProps(link)"
8
+ :class="[ui.base, ui.padding, ui.width, ui.ring, ui.rounded, ui.font, ui.size]"
9
+ :active-class="ui.active"
10
+ :inactive-class="ui.inactive"
11
+ @click="link.click"
12
+ @keyup.enter="$event.target.blur()"
13
+ >
14
+ <slot name="avatar" :link="link" :is-active="isActive">
15
+ <UAvatar
16
+ v-if="link.avatar"
17
+ v-bind="{ size: ui.avatar.size, ...link.avatar }"
18
+ :class="[ui.avatar.base]"
19
+ />
20
+ </slot>
21
+ <slot name="icon" :link="link" :is-active="isActive">
22
+ <UIcon
23
+ v-if="link.icon"
24
+ :name="link.icon"
25
+ :class="twMerge(twJoin(ui.icon.base, isActive ? ui.icon.active : ui.icon.inactive), link.iconClass)"
26
+ />
27
+ </slot>
28
+ <slot :link="link" :is-active="isActive">
29
+ <span v-if="link.label" :class="twMerge(ui.label, link.labelClass)">
30
+ <span v-if="isActive" class="sr-only">
31
+ Current page:
32
+ </span>
33
+ {{ link.label }}
34
+ </span>
35
+ </slot>
36
+ <slot name="badge" :link="link" :is-active="isActive">
37
+ <span v-if="link.badge" :class="[ui.badge.base, isActive ? ui.badge.active : ui.badge.inactive]">
38
+ {{ link.badge }}
39
+ </span>
40
+ </slot>
41
+ </ULink>
42
+ </li>
43
+ <UDivider v-if="sectionIndex < sections.length - 1" :ui="ui.divider" />
44
+ </ul>
37
45
  </nav>
38
46
  </template>
39
47
 
40
48
  <script>
41
- import { toRef, defineComponent } from "vue";
49
+ import { toRef, defineComponent, computed } from "vue";
50
+ import { twMerge, twJoin } from "tailwind-merge";
42
51
  import UIcon from "../elements/Icon.vue";
43
52
  import UAvatar from "../elements/Avatar.vue";
44
53
  import ULink from "../elements/Link.vue";
54
+ import UDivider from "../layout/Divider.vue";
45
55
  import { useUI } from "../../composables/useUI";
46
- import { mergeConfig, omit } from "../../utils";
56
+ import { mergeConfig, getULinkProps } from "../../utils";
47
57
  import appConfig from "#build/app.config";
48
58
  import { verticalNavigation } from "#ui/ui.config";
49
59
  const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.verticalNavigation, verticalNavigation);
@@ -51,7 +61,8 @@ export default defineComponent({
51
61
  components: {
52
62
  UIcon,
53
63
  UAvatar,
54
- ULink
64
+ ULink,
65
+ UDivider
55
66
  },
56
67
  inheritAttrs: false,
57
68
  props: {
@@ -70,11 +81,15 @@ export default defineComponent({
70
81
  },
71
82
  setup(props) {
72
83
  const { ui, attrs } = useUI("verticalNavigation", toRef(props, "ui"), config, toRef(props, "class"));
84
+ const sections = computed(() => Array.isArray(props.links[0]) ? props.links : [props.links]);
73
85
  return {
74
86
  // eslint-disable-next-line vue/no-dupe-keys
75
87
  ui,
76
88
  attrs,
77
- omit
89
+ sections,
90
+ getULinkProps,
91
+ twMerge,
92
+ twJoin
78
93
  };
79
94
  }
80
95
  });
@@ -1,9 +1,9 @@
1
1
  import type { PropType } from 'vue';
2
- import { omit } from '../../utils';
2
+ import { twJoin } from 'tailwind-merge';
3
3
  import type { VerticalNavigationLink } from '../../types';
4
4
  declare const _default: import("vue").DefineComponent<{
5
5
  links: {
6
- type: PropType<VerticalNavigationLink[]>;
6
+ type: PropType<VerticalNavigationLink[] | VerticalNavigationLink[][]>;
7
7
  default: () => never[];
8
8
  };
9
9
  class: {
@@ -19,10 +19,13 @@ declare const _default: import("vue").DefineComponent<{
19
19
  attrs: import("vue").ComputedRef<Pick<{
20
20
  [x: string]: unknown;
21
21
  }, string>>;
22
- omit: typeof omit;
22
+ sections: import("vue").ComputedRef<VerticalNavigationLink[][]>;
23
+ getULinkProps: (props: any) => {};
24
+ twMerge: (...classLists: import("tailwind-merge").ClassNameValue[]) => string;
25
+ twJoin: typeof twJoin;
23
26
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
24
27
  links: {
25
- type: PropType<VerticalNavigationLink[]>;
28
+ type: PropType<VerticalNavigationLink[] | VerticalNavigationLink[][]>;
26
29
  default: () => never[];
27
30
  };
28
31
  class: {
@@ -36,6 +39,6 @@ declare const _default: import("vue").DefineComponent<{
36
39
  }>>, {
37
40
  ui: any;
38
41
  class: any;
39
- links: VerticalNavigationLink[];
42
+ links: VerticalNavigationLink[] | VerticalNavigationLink[][];
40
43
  }, {}>;
41
44
  export default _default;
@@ -78,11 +78,11 @@ declare const _default: import("vue").DefineComponent<{
78
78
  onClose?: ((...args: any[]) => any) | undefined;
79
79
  }, {
80
80
  ui: any;
81
+ transition: boolean;
81
82
  class: any;
82
83
  modelValue: boolean;
83
84
  appear: boolean;
84
85
  overlay: boolean;
85
- transition: boolean;
86
86
  preventClose: boolean;
87
87
  fullscreen: boolean;
88
88
  }, {}>;
@@ -1,5 +1,6 @@
1
1
  <template>
2
- <HPopover ref="popover" v-slot="{ open: headlessOpen, close }" :class="ui.wrapper" v-bind="attrs" @mouseleave="onMouseLeave">
2
+ <!-- eslint-disable-next-line vue/no-template-shadow -->
3
+ <HPopover ref="popover" v-slot="{ open, close }" :class="ui.wrapper" v-bind="attrs" @mouseleave="onMouseLeave">
3
4
  <HPopoverButton
4
5
  ref="trigger"
5
6
  as="div"
@@ -8,7 +9,7 @@
8
9
  role="button"
9
10
  @mouseover="onMouseOver"
10
11
  >
11
- <slot :open="(open !== undefined) ? open : headlessOpen" :close="close">
12
+ <slot :open="open" :close="close">
12
13
  <button :disabled="disabled">
13
14
  Open
14
15
  </button>
@@ -16,16 +17,16 @@
16
17
  </HPopoverButton>
17
18
 
18
19
  <Transition v-if="overlay" appear v-bind="ui.overlay.transition">
19
- <div v-if="(open !== undefined) ? open : headlessOpen" :class="[ui.overlay.base, ui.overlay.background]" @click="$emit('update:open')" />
20
+ <div v-if="open" :class="[ui.overlay.base, ui.overlay.background]" />
20
21
  </Transition>
21
22
 
22
- <div v-if="(open !== undefined) ? open : headlessOpen" ref="container" :class="[ui.container, ui.width]" :style="containerStyle" @mouseover="onMouseOver">
23
+ <div v-if="open" ref="container" :class="[ui.container, ui.width]" :style="containerStyle" @mouseover="onMouseOver">
23
24
  <Transition appear v-bind="ui.transition">
24
25
  <div>
25
26
  <div v-if="popper.arrow" data-popper-arrow :class="Object.values(ui.arrow)" />
26
27
 
27
28
  <HPopoverPanel :class="[ui.base, ui.background, ui.ring, ui.rounded, ui.shadow]" static>
28
- <slot name="panel" :open="(open !== undefined) ? open : headlessOpen" :close="close" />
29
+ <slot name="panel" :open="open" :close="close" />
29
30
  </HPopoverPanel>
30
31
  </div>
31
32
  </Transition>
@@ -34,7 +35,7 @@
34
35
  </template>
35
36
 
36
37
  <script>
37
- import { computed, ref, toRef, onMounted, defineComponent } from "vue";
38
+ import { computed, ref, toRef, onMounted, defineComponent, watch } from "vue";
38
39
  import { defu } from "defu";
39
40
  import { Popover as HPopover, PopoverButton as HPopoverButton, PopoverPanel as HPopoverPanel } from "@headlessui/vue";
40
41
  import { useUI } from "../../composables/useUI";
@@ -90,7 +91,7 @@ export default defineComponent({
90
91
  }
91
92
  },
92
93
  emits: ["update:open"],
93
- setup(props) {
94
+ setup(props, { emit }) {
94
95
  const { ui, attrs } = useUI("popover", toRef(props, "ui"), config, toRef(props, "class"));
95
96
  const popper = computed(() => defu(props.mode === "hover" ? { offsetDistance: 0 } : {}, props.popper, ui.value.popper));
96
97
  const [trigger, container] = usePopper(popper.value);
@@ -105,16 +106,35 @@ export default defineComponent({
105
106
  }
106
107
  const popoverProvidesSymbols = Object.getOwnPropertySymbols(popoverProvides);
107
108
  popoverApi.value = popoverProvidesSymbols.length && popoverProvides[popoverProvidesSymbols[0]];
109
+ if (props.open) {
110
+ popoverApi.value?.togglePopover();
111
+ }
108
112
  });
109
113
  const containerStyle = computed(() => {
114
+ if (props.mode !== "hover") {
115
+ return {};
116
+ }
110
117
  const offsetDistance = props.popper?.offsetDistance || ui.value.popper?.offsetDistance || 8;
118
+ const placement = popper.value.placement?.split("-")[0];
111
119
  const padding = `${offsetDistance}px`;
112
- return props.mode === "hover" ? {
113
- paddingTop: padding,
114
- paddingBottom: padding,
115
- paddingLeft: padding,
116
- paddingRight: padding
117
- } : {};
120
+ if (placement === "top" || placement === "bottom") {
121
+ return {
122
+ paddingTop: padding,
123
+ paddingBottom: padding
124
+ };
125
+ } else if (placement === "left" || placement === "right") {
126
+ return {
127
+ paddingLeft: padding,
128
+ paddingRight: padding
129
+ };
130
+ } else {
131
+ return {
132
+ paddingTop: padding,
133
+ paddingBottom: padding,
134
+ paddingLeft: padding,
135
+ paddingRight: padding
136
+ };
137
+ }
118
138
  });
119
139
  function onMouseOver() {
120
140
  if (props.mode !== "hover" || !popoverApi.value) {
@@ -148,6 +168,22 @@ export default defineComponent({
148
168
  closeTimeout = null;
149
169
  }, props.closeDelay);
150
170
  }
171
+ watch(() => props.open, (newValue, oldValue) => {
172
+ if (!popoverApi.value)
173
+ return;
174
+ if (oldValue === void 0 || newValue === oldValue)
175
+ return;
176
+ if (newValue) {
177
+ popoverApi.value.popoverState = 0;
178
+ } else {
179
+ popoverApi.value.closePopover();
180
+ }
181
+ });
182
+ watch(() => popoverApi.value?.popoverState, (newValue, oldValue) => {
183
+ if (oldValue === void 0 || newValue === oldValue)
184
+ return;
185
+ emit("update:open", newValue === 0);
186
+ });
151
187
  return {
152
188
  // eslint-disable-next-line vue/no-dupe-keys
153
189
  ui,
@@ -43,20 +43,30 @@ declare const _default: import("vue").DefineComponent<{
43
43
  attrs: import("vue").ComputedRef<Pick<{
44
44
  [x: string]: unknown;
45
45
  }, string>>;
46
- popover: any;
46
+ popover: import("vue").Ref<any>;
47
47
  popper: import("vue").ComputedRef<PopperOptions>;
48
48
  trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
49
49
  container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
50
50
  containerStyle: import("vue").ComputedRef<{
51
+ paddingTop?: undefined;
52
+ paddingBottom?: undefined;
53
+ paddingLeft?: undefined;
54
+ paddingRight?: undefined;
55
+ } | {
51
56
  paddingTop: string;
52
57
  paddingBottom: string;
58
+ paddingLeft?: undefined;
59
+ paddingRight?: undefined;
60
+ } | {
53
61
  paddingLeft: string;
54
62
  paddingRight: string;
55
- } | {
56
63
  paddingTop?: undefined;
57
64
  paddingBottom?: undefined;
58
- paddingLeft?: undefined;
59
- paddingRight?: undefined;
65
+ } | {
66
+ paddingTop: string;
67
+ paddingBottom: string;
68
+ paddingLeft: string;
69
+ paddingRight: string;
60
70
  }>;
61
71
  onMouseOver: () => void;
62
72
  onMouseLeave: () => void;
@@ -80,11 +80,11 @@ declare const _default: import("vue").DefineComponent<{
80
80
  onClose?: ((...args: any[]) => any) | undefined;
81
81
  }, {
82
82
  ui: any;
83
+ transition: boolean;
83
84
  class: any;
84
85
  modelValue: boolean;
85
86
  appear: boolean;
86
87
  overlay: boolean;
87
- transition: boolean;
88
88
  preventClose: boolean;
89
89
  side: "right" | "left";
90
90
  }, {}>;
@@ -19,7 +19,7 @@
19
19
 
20
20
  <UKbd v-for="shortcut of shortcuts" :key="shortcut" size="xs">
21
21
  {{ shortcut }}
22
- </Ukbd>
22
+ </UKbd>
23
23
  </span>
24
24
  </div>
25
25
  </div>
@@ -5,7 +5,9 @@ export const _useShortcuts = () => {
5
5
  const metaSymbol = ref(" ");
6
6
  const activeElement = useActiveElement();
7
7
  const usingInput = computed(() => {
8
- const usingInput2 = !!(activeElement.value?.tagName === "INPUT" || activeElement.value?.tagName === "TEXTAREA" || activeElement.value?.contentEditable === "true");
8
+ const tagName = activeElement.value?.tagName;
9
+ const contentEditable = activeElement.value?.contentEditable;
10
+ const usingInput2 = !!(tagName === "INPUT" || tagName === "TEXTAREA" || contentEditable === "true" || contentEditable === "plaintext-only");
9
11
  if (usingInput2) {
10
12
  return activeElement.value?.name || true;
11
13
  }
@@ -1,7 +1,12 @@
1
1
  import { alert } from '../ui.config'
2
2
  import type { NestedKeyOf, ExtractDeepKey, ExtractDeepObject } from '.'
3
+ import type { Button } from './button'
3
4
  import colors from '#ui-colors'
4
5
  import type { AppConfig } from 'nuxt/schema'
5
6
 
6
7
  export type AlertColor = keyof typeof alert.color | ExtractDeepKey<AppConfig, ['ui', 'alert', 'color']> | typeof colors[number]
7
8
  export type AlertVariant = keyof typeof alert.variant | ExtractDeepKey<AppConfig, ['ui', 'alert', 'variant']> | NestedKeyOf<typeof alert.color> | NestedKeyOf<ExtractDeepObject<AppConfig, ['ui', 'alert', 'color']>>
9
+
10
+ export interface AlertAction extends Button {
11
+ click?: Function
12
+ }
@@ -2,6 +2,7 @@ import type { Link } from './link'
2
2
 
3
3
  export interface BreadcrumbLink extends Link {
4
4
  label: string
5
+ labelClass?: string
5
6
  icon?: string
6
7
  iconClass?: string
7
8
  // FIXME: This is a workaround for `link.to` not being resolved although it extends `NuxtLinkProps`
@@ -6,6 +6,10 @@ export type ChipColor = 'gray' | typeof colors[number]
6
6
  export type ChipPosition = keyof typeof chip.position
7
7
 
8
8
  export interface Chip {
9
+ size?: ChipSize
9
10
  color?: ChipColor
10
11
  position?: ChipPosition
12
+ text?: string
13
+ inset?: boolean
14
+ show?: boolean
11
15
  }
@@ -3,11 +3,13 @@ import type { Avatar } from './avatar'
3
3
 
4
4
  export interface DropdownItem extends NuxtLinkProps {
5
5
  label: string
6
+ labelClass?: string
6
7
  slot?: string
7
8
  icon?: string
8
9
  iconClass?: string
9
10
  avatar?: Avatar
10
11
  shortcuts?: string[]
11
12
  disabled?: boolean
13
+ class?: string
12
14
  click?: Function
13
15
  }
@@ -15,6 +15,7 @@ export interface Form<T> {
15
15
  errors: Ref<FormError[]>
16
16
  setErrors(errs: FormError[], path?: string): void
17
17
  getErrors(path?: string): FormError[]
18
+ submit(): Promise<void>
18
19
  }
19
20
 
20
21
  export type FormSubmitEvent<T> = SubmitEvent & { data: T }
@@ -22,5 +22,6 @@ export * from './select'
22
22
  export * from './tabs'
23
23
  export * from './textarea'
24
24
  export * from './toggle'
25
+ export * from './tooltip'
25
26
  export * from './vertical-navigation'
26
27
  export * from './utils'