iryx-ui 0.24.1 → 0.26.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 (47) hide show
  1. package/dist/components/AvatarGroup.vue.d.ts +8 -2
  2. package/dist/components/AvatarGroup.vue_vue_type_script_setup_true_lang.js +57 -23
  3. package/dist/components/Breadcrumb.vue.d.ts +10 -2
  4. package/dist/components/Breadcrumb.vue_vue_type_script_setup_true_lang.js +66 -34
  5. package/dist/components/CommandPalette.vue.d.ts +12 -0
  6. package/dist/components/CommandPalette.vue_vue_type_script_setup_true_lang.js +122 -85
  7. package/dist/components/ConfirmPopover.vue.d.ts +1 -1
  8. package/dist/components/DateRangePicker.vue.d.ts +14 -2
  9. package/dist/components/DateRangePicker.vue_vue_type_script_setup_true_lang.js +111 -70
  10. package/dist/components/FileUpload.vue.d.ts +23 -1
  11. package/dist/components/FileUpload.vue_vue_type_script_setup_true_lang.js +139 -96
  12. package/dist/components/Input.vue.d.ts +14 -0
  13. package/dist/components/Input.vue_vue_type_script_setup_true_lang.js +86 -69
  14. package/dist/components/SignaturePad.vue.d.ts +1 -1
  15. package/dist/components/Tabs.vue.d.ts +7 -6
  16. package/dist/components/Tabs.vue_vue_type_script_setup_true_lang.js +65 -30
  17. package/dist/components/Textarea.vue.d.ts +14 -0
  18. package/dist/components/Textarea.vue_vue_type_script_setup_true_lang.js +90 -42
  19. package/dist/components/Toaster.vue_vue_type_script_setup_true_lang.js +42 -41
  20. package/dist/components/index.js +144 -144
  21. package/dist/composables/character-count.d.ts +6 -0
  22. package/dist/composables/character-count.js +18 -0
  23. package/dist/composables/command-palette.d.ts +7 -0
  24. package/dist/composables/command-palette.js +8 -2
  25. package/dist/composables/date.d.ts +25 -0
  26. package/dist/composables/date.js +59 -16
  27. package/dist/composables/scroll-fade.d.ts +1 -1
  28. package/dist/composables/toast.d.ts +16 -1
  29. package/dist/composables/toast.js +23 -2
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.js +154 -154
  32. package/dist/theme/avatar.d.ts +21 -0
  33. package/dist/theme/avatar.js +28 -21
  34. package/dist/theme/bar-chart.d.ts +3 -3
  35. package/dist/theme/date-picker.d.ts +9 -0
  36. package/dist/theme/date-picker.js +3 -0
  37. package/dist/theme/donut-chart.d.ts +3 -3
  38. package/dist/theme/file-upload.d.ts +24 -0
  39. package/dist/theme/file-upload.js +6 -2
  40. package/dist/theme/input.d.ts +46 -0
  41. package/dist/theme/input.js +10 -2
  42. package/dist/theme/line-chart.d.ts +3 -3
  43. package/dist/theme/tabs.d.ts +18 -3
  44. package/dist/theme/tabs.js +20 -12
  45. package/dist/theme/toast.d.ts +9 -0
  46. package/dist/theme/toast.js +2 -1
  47. package/package.json +1 -1
@@ -11,21 +11,27 @@ export interface AvatarGroupProps {
11
11
  max?: number;
12
12
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
13
13
  shape?: 'circle' | 'square';
14
+ /**
15
+ * Show each person's `name` in a tooltip, and lift the avatar under the
16
+ * pointer or focus out of the stack.
17
+ */
18
+ tooltip?: boolean;
14
19
  /** Skip built-in classes; you take over styling entirely. */
15
20
  unstyled?: boolean;
16
21
  class?: ClassValue;
17
22
  /** Override classes per element, e.g. `{ overflow: 'bg-primary' }`. */
18
23
  ui?: {
19
24
  root?: string;
25
+ trigger?: string;
20
26
  item?: string;
21
27
  overflow?: string;
22
28
  };
23
29
  }
24
- declare var __VLS_1: {
30
+ declare var __VLS_8: {
25
31
  count: number;
26
32
  };
27
33
  type __VLS_Slots = {} & {
28
- overflow?: (props: typeof __VLS_1) => any;
34
+ overflow?: (props: typeof __VLS_8) => any;
29
35
  };
30
36
  declare const __VLS_base: import("vue").DefineComponent<AvatarGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AvatarGroupProps> & Readonly<{}>, {
31
37
  unstyled: boolean;
@@ -1,15 +1,17 @@
1
1
  import { useIryxUiConfig as e } from "../config.js";
2
2
  import { avatarGroupTheme as t } from "../theme/avatar.js";
3
3
  import n from "./Avatar.js";
4
- import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createTextVNode as c, defineComponent as l, mergeProps as u, normalizeClass as d, openBlock as f, renderList as p, renderSlot as m, toDisplayString as h } from "vue";
4
+ import r from "./Tooltip.js";
5
+ import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, mergeProps as p, normalizeClass as m, openBlock as h, renderList as g, renderSlot as _, toDisplayString as v, withCtx as y } from "vue";
5
6
  //#region src/components/AvatarGroup.vue?vue&type=script&setup=true&lang.ts
6
- var g = /*@__PURE__*/ l({
7
+ var b = ["tabindex"], x = ["tabindex"], S = /*@__PURE__*/ f({
7
8
  __name: "AvatarGroup",
8
9
  props: {
9
10
  items: {},
10
11
  max: {},
11
12
  size: {},
12
13
  shape: {},
14
+ tooltip: { type: Boolean },
13
15
  unstyled: {
14
16
  type: Boolean,
15
17
  default: void 0
@@ -22,29 +24,61 @@ var g = /*@__PURE__*/ l({
22
24
  ] },
23
25
  ui: {}
24
26
  },
25
- setup(l) {
26
- let g = l, _ = i(() => g.items ?? []), v = i(() => {
27
- let e = g.max;
28
- return [...e !== void 0 && _.value.length > e ? _.value.slice(0, e) : _.value].reverse();
29
- }), y = i(() => {
30
- let e = g.max;
31
- return e === void 0 || _.value.length <= e ? 0 : _.value.length - e;
32
- }), b = e(), x = i(() => g.unstyled ?? b.unstyled), S = i(() => t({ size: g.size })), C = i(() => x.value ? [g.ui?.root, g.class] : S.value.root({ class: [g.ui?.root, g.class] })), w = i(() => x.value ? g.ui?.item : S.value.item({ class: g.ui?.item })), T = i(() => x.value ? g.ui?.overflow : S.value.overflow({ class: g.ui?.overflow }));
33
- return (e, t) => (f(), s("div", { class: d(C.value) }, [y.value ? (f(), s("span", {
27
+ setup(f) {
28
+ let S = f, C = a(() => S.items ?? []), w = a(() => {
29
+ let e = S.max;
30
+ return [...e !== void 0 && C.value.length > e ? C.value.slice(0, e) : C.value].reverse();
31
+ }), T = a(() => {
32
+ let e = S.max;
33
+ return e === void 0 || C.value.length <= e ? 0 : C.value.length - e;
34
+ }), E = a(() => C.value.slice(C.value.length - T.value).map((e) => e.name).filter(Boolean).join(", ")), D = e(), O = a(() => S.unstyled ?? D.unstyled), k = a(() => t({
35
+ size: S.size,
36
+ tooltip: S.tooltip
37
+ })), A = a(() => O.value ? [S.ui?.root, S.class] : k.value.root({ class: [S.ui?.root, S.class] })), j = a(() => O.value ? S.ui?.trigger : k.value.trigger({ class: S.ui?.trigger })), M = a(() => O.value ? S.ui?.item : k.value.item({ class: S.ui?.item })), N = a(() => O.value ? S.ui?.overflow : k.value.overflow({ class: S.ui?.overflow }));
38
+ return (e, t) => (h(), c("div", { class: m(A.value) }, [T.value ? (h(), o(r, {
34
39
  key: 0,
35
- class: d(T.value)
36
- }, [m(e.$slots, "overflow", { count: y.value }, () => [c("+" + h(y.value), 1)])], 2)) : o("", !0), (f(!0), s(r, null, p(v.value, (e, t) => (f(), a(n, u({ key: t }, { ref_for: !0 }, e, {
37
- size: g.size,
38
- shape: g.shape,
39
- unstyled: x.value,
40
- class: w.value
41
- }), null, 16, [
42
- "size",
43
- "shape",
44
- "unstyled",
45
- "class"
40
+ text: E.value,
41
+ disabled: !S.tooltip || !E.value,
42
+ "side-offset": 10,
43
+ unstyled: O.value
44
+ }, {
45
+ trigger: y(() => [l("span", {
46
+ class: m(N.value),
47
+ tabindex: S.tooltip && E.value ? 0 : void 0
48
+ }, [_(e.$slots, "overflow", { count: T.value }, () => [u("+" + v(T.value), 1)])], 10, b)]),
49
+ _: 3
50
+ }, 8, [
51
+ "text",
52
+ "disabled",
53
+ "unstyled"
54
+ ])) : s("", !0), (h(!0), c(i, null, g(w.value, (e, t) => (h(), o(r, {
55
+ key: t,
56
+ text: e.name,
57
+ disabled: !S.tooltip || !e.name,
58
+ "side-offset": 10,
59
+ unstyled: O.value
60
+ }, {
61
+ trigger: y(() => [l("span", {
62
+ class: m(j.value),
63
+ tabindex: S.tooltip && e.name ? 0 : void 0
64
+ }, [d(n, p({ ref_for: !0 }, e, {
65
+ size: S.size,
66
+ shape: S.shape,
67
+ unstyled: O.value,
68
+ class: M.value
69
+ }), null, 16, [
70
+ "size",
71
+ "shape",
72
+ "unstyled",
73
+ "class"
74
+ ])], 10, x)]),
75
+ _: 2
76
+ }, 1032, [
77
+ "text",
78
+ "disabled",
79
+ "unstyled"
46
80
  ]))), 128))], 2));
47
81
  }
48
82
  });
49
83
  //#endregion
50
- export { g as default };
84
+ export { S as default };
@@ -15,6 +15,13 @@ export interface BreadcrumbProps {
15
15
  * apps.
16
16
  */
17
17
  label?: string;
18
+ /**
19
+ * Show at most this many crumbs: the first, then a "…" menu holding the
20
+ * middle, then the last `max - 1`. Below 2 it is treated as 2.
21
+ */
22
+ max?: number;
23
+ /** Accessible name for the "…" button — override for non-English apps. */
24
+ moreLabel?: string;
18
25
  /** Skip built-in classes; you take over styling entirely. */
19
26
  unstyled?: boolean;
20
27
  class?: ClassValue;
@@ -28,13 +35,14 @@ export interface BreadcrumbProps {
28
35
  separator?: string;
29
36
  };
30
37
  }
31
- declare var __VLS_26: {};
38
+ declare var __VLS_38: {};
32
39
  type __VLS_Slots = {} & {
33
- separator?: (props: typeof __VLS_26) => any;
40
+ separator?: (props: typeof __VLS_38) => any;
34
41
  };
35
42
  declare const __VLS_base: import("vue").DefineComponent<BreadcrumbProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<BreadcrumbProps> & Readonly<{}>, {
36
43
  label: string;
37
44
  unstyled: boolean;
45
+ moreLabel: string;
38
46
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
39
47
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
40
48
  declare const _default: typeof __VLS_export;
@@ -1,15 +1,18 @@
1
1
  import { useIryxUiConfig as e } from "../config.js";
2
2
  import t from "./Icon.js";
3
3
  import { breadcrumbTheme as n } from "../theme/breadcrumb.js";
4
- import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, normalizeClass as f, openBlock as p, renderList as m, renderSlot as h, resolveDynamicComponent as g, toDisplayString as _, unref as v, withCtx as y } from "vue";
5
- import { ArrowRight01Icon as b } from "@hugeicons/core-free-icons";
6
- import { Primitive as x } from "reka-ui";
4
+ import r from "./DropdownMenu.js";
5
+ import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, normalizeClass as p, openBlock as m, renderList as h, renderSlot as g, resolveDynamicComponent as _, toDisplayString as v, unref as y, withCtx as b } from "vue";
6
+ import { ArrowRight01Icon as x, MoreHorizontalIcon as S } from "@hugeicons/core-free-icons";
7
+ import { Primitive as C } from "reka-ui";
7
8
  //#region src/components/Breadcrumb.vue?vue&type=script&setup=true&lang.ts
8
- var S = /*@__PURE__*/ d({
9
+ var w = ["aria-label"], T = /*@__PURE__*/ f({
9
10
  __name: "Breadcrumb",
10
11
  props: {
11
12
  items: {},
12
13
  label: { default: "Breadcrumb" },
14
+ max: {},
15
+ moreLabel: { default: "Show hidden pages" },
13
16
  unstyled: {
14
17
  type: Boolean,
15
18
  default: void 0
@@ -22,52 +25,81 @@ var S = /*@__PURE__*/ d({
22
25
  ] },
23
26
  ui: {}
24
27
  },
25
- setup(d) {
26
- let S = d, C = e(), w = i(() => S.unstyled ?? C.unstyled), T = i(() => S.items ?? []), E = i(() => T.value.length - 1), D = i(() => n());
27
- function O(e) {
28
- let t = S.ui?.[e];
29
- return w.value ? t : D.value[e]({ class: t });
28
+ setup(f) {
29
+ let T = f, E = e(), D = a(() => T.unstyled ?? E.unstyled), O = a(() => T.items ?? []), k = a(() => O.value.length - 1), A = a(() => {
30
+ if (T.max === void 0) return 0;
31
+ let e = Math.max(T.max, 2);
32
+ return O.value.length > e ? O.value.length - e : 0;
33
+ }), j = a(() => {
34
+ let e = O.value.map((e, t) => ({
35
+ item: e,
36
+ index: t
37
+ }));
38
+ return A.value ? [
39
+ e[0],
40
+ null,
41
+ ...e.slice(1 + A.value)
42
+ ] : e;
43
+ }), M = a(() => O.value.slice(1, 1 + A.value).map((e) => ({
44
+ label: e.label,
45
+ icon: e.icon,
46
+ onSelect: e.onSelect ?? (e.href ? () => window.location.assign(e.href) : void 0)
47
+ }))), N = a(() => n());
48
+ function P(e) {
49
+ let t = T.ui?.[e];
50
+ return D.value ? t : N.value[e]({ class: t });
30
51
  }
31
- return (e, n) => (p(), a(v(x), {
52
+ return (e, n) => (m(), o(y(C), {
32
53
  as: "nav",
33
- "aria-label": S.label,
34
- class: f(w.value ? [S.ui?.root, S.class] : D.value.root({ class: [S.ui?.root, S.class] }))
54
+ "aria-label": T.label,
55
+ class: p(D.value ? [T.ui?.root, T.class] : N.value.root({ class: [T.ui?.root, T.class] }))
35
56
  }, {
36
- default: y(() => [c("ol", { class: f(O("list")) }, [(p(!0), s(r, null, m(T.value, (n, r) => (p(), s("li", {
37
- key: r,
38
- class: f(O("item"))
39
- }, [r === E.value ? (p(), s("span", {
40
- key: 0,
57
+ default: b(() => [l("ol", { class: p(P("list")) }, [(m(!0), c(i, null, h(j.value, (n) => (m(), c("li", {
58
+ key: n?.index ?? "more",
59
+ class: p(P("item"))
60
+ }, [n ? n.index === k.value ? (m(), c("span", {
61
+ key: 1,
41
62
  "aria-current": "page",
42
- class: f(O("current"))
43
- }, [n.icon ? (p(), a(t, {
63
+ class: p(P("current"))
64
+ }, [n.item.icon ? (m(), o(t, {
44
65
  key: 0,
45
- icon: n.icon
46
- }, null, 8, ["icon"])) : o("", !0), l(" " + _(n.label), 1)], 2)) : (p(), a(g(n.href ? "a" : "button"), {
47
- key: 1,
48
- href: n.href,
49
- type: n.href ? void 0 : "button",
50
- class: f(O("link")),
51
- onClick: (e) => n.onSelect?.()
66
+ icon: n.item.icon
67
+ }, null, 8, ["icon"])) : s("", !0), u(" " + v(n.item.label), 1)], 2)) : (m(), o(_(n.item.href ? "a" : "button"), {
68
+ key: 2,
69
+ href: n.item.href,
70
+ type: n.item.href ? void 0 : "button",
71
+ class: p(P("link")),
72
+ onClick: (e) => n.item.onSelect?.()
52
73
  }, {
53
- default: y(() => [n.icon ? (p(), a(t, {
74
+ default: b(() => [n.item.icon ? (m(), o(t, {
54
75
  key: 0,
55
- icon: n.icon
56
- }, null, 8, ["icon"])) : o("", !0), l(" " + _(n.label), 1)]),
76
+ icon: n.item.icon
77
+ }, null, 8, ["icon"])) : s("", !0), u(" " + v(n.item.label), 1)]),
57
78
  _: 2
58
79
  }, 1032, [
59
80
  "href",
60
81
  "type",
61
82
  "class",
62
83
  "onClick"
63
- ])), r === E.value ? o("", !0) : (p(), s("span", {
64
- key: 2,
84
+ ])) : (m(), o(r, {
85
+ key: 0,
86
+ items: M.value,
87
+ unstyled: D.value
88
+ }, {
89
+ trigger: b(() => [l("button", {
90
+ type: "button",
91
+ "aria-label": T.moreLabel,
92
+ class: p(P("link"))
93
+ }, [d(t, { icon: y(S) }, null, 8, ["icon"])], 10, w)]),
94
+ _: 1
95
+ }, 8, ["items", "unstyled"])), n?.index === k.value ? s("", !0) : (m(), c("span", {
96
+ key: 3,
65
97
  "aria-hidden": "true",
66
- class: f(O("separator"))
67
- }, [h(e.$slots, "separator", {}, () => [u(t, { icon: v(b) }, null, 8, ["icon"])])], 2))], 2))), 128))], 2)]),
98
+ class: p(P("separator"))
99
+ }, [g(e.$slots, "separator", {}, () => [d(t, { icon: y(x) }, null, 8, ["icon"])])], 2))], 2))), 128))], 2)]),
68
100
  _: 3
69
101
  }, 8, ["aria-label", "class"]));
70
102
  }
71
103
  });
72
104
  //#endregion
73
- export { S as default };
105
+ export { T as default };
@@ -15,6 +15,16 @@ export interface CommandPaletteProps {
15
15
  hotkey?: string | null;
16
16
  /** Close once a command is chosen. */
17
17
  closeOnSelect?: boolean;
18
+ /**
19
+ * Remember recently chosen commands under this `localStorage` key and list
20
+ * them first while the search is empty. Unset (the default) remembers
21
+ * nothing. Use a different key per palette.
22
+ */
23
+ recentKey?: string;
24
+ /** How many recent commands to keep. */
25
+ recentLimit?: number;
26
+ /** Heading over the recent commands. Override for non-English apps. */
27
+ recentLabel?: string;
18
28
  /** Hint row along the bottom. Set `false` to drop it. */
19
29
  footer?: boolean;
20
30
  /** Skip built-in classes; you take over styling entirely. */
@@ -53,6 +63,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
53
63
  emptyText: string;
54
64
  hotkey: string | null;
55
65
  closeOnSelect: boolean;
66
+ recentLimit: number;
67
+ recentLabel: string;
56
68
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
57
69
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
58
70
  declare const _default: typeof __VLS_export;
@@ -1,15 +1,15 @@
1
1
  import { useIryxUiConfig as e } from "../config.js";
2
2
  import t from "./Icon.js";
3
- import { commandHaystack as n, matchesHotkey as r, toCommandGroups as i } from "../composables/command-palette.js";
4
- import { commandPaletteTheme as a } from "../theme/command-palette.js";
5
- import o from "./Kbd.js";
6
- import { Fragment as s, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, mergeModels as g, normalizeClass as _, onBeforeUnmount as v, onMounted as y, openBlock as b, ref as x, renderList as S, renderSlot as C, toDisplayString as w, unref as T, useModel as E, watch as D, withCtx as O } from "vue";
7
- import { Search01Icon as k } from "@hugeicons/core-free-icons";
8
- import { DialogContent as ee, DialogOverlay as te, DialogPortal as ne, DialogRoot as A, DialogTitle as j, ListboxContent as M, ListboxFilter as N, ListboxGroup as P, ListboxGroupLabel as F, ListboxItem as I, ListboxRoot as L, VisuallyHidden as R, useFilter as z } from "reka-ui";
3
+ import { commandHaystack as n, commandId as r, matchesHotkey as i, pushRecent as a, toCommandGroups as o } from "../composables/command-palette.js";
4
+ import { commandPaletteTheme as s } from "../theme/command-palette.js";
5
+ import c from "./Kbd.js";
6
+ import { Fragment as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createTextVNode as h, createVNode as g, defineComponent as _, mergeModels as v, normalizeClass as y, onBeforeUnmount as b, onMounted as x, openBlock as S, ref as C, renderList as w, renderSlot as T, toDisplayString as E, unref as D, useModel as O, watch as k, withCtx as A } from "vue";
7
+ import { Search01Icon as j } from "@hugeicons/core-free-icons";
8
+ import { DialogContent as M, DialogOverlay as ee, DialogPortal as te, DialogRoot as ne, DialogTitle as re, ListboxContent as ie, ListboxFilter as ae, ListboxGroup as oe, ListboxGroupLabel as se, ListboxItem as N, ListboxRoot as P, VisuallyHidden as F, useFilter as I } from "reka-ui";
9
9
  //#region src/components/CommandPalette.vue?vue&type=script&setup=true&lang.ts
10
- var B = /*@__PURE__*/ h({
10
+ var L = /*@__PURE__*/ _({
11
11
  __name: "CommandPalette",
12
- props: /*@__PURE__*/ g({
12
+ props: /*@__PURE__*/ v({
13
13
  items: {},
14
14
  placeholder: { default: "Search commands…" },
15
15
  emptyText: { default: "No matching commands." },
@@ -19,6 +19,9 @@ var B = /*@__PURE__*/ h({
19
19
  type: Boolean,
20
20
  default: !0
21
21
  },
22
+ recentKey: {},
23
+ recentLimit: { default: 5 },
24
+ recentLabel: { default: "Recent" },
22
25
  footer: {
23
26
  type: Boolean,
24
27
  default: !0
@@ -41,109 +44,143 @@ var B = /*@__PURE__*/ h({
41
44
  },
42
45
  openModifiers: {}
43
46
  }),
44
- emits: /*@__PURE__*/ g(["select"], ["update:open"]),
45
- setup(h, { emit: g }) {
46
- let B = h, V = g, H = E(h, "open"), U = x("");
47
- D(H, (e) => {
48
- e || (U.value = "");
47
+ emits: /*@__PURE__*/ v(["select"], ["update:open"]),
48
+ setup(_, { emit: v }) {
49
+ let L = _, R = v, z = O(_, "open"), B = C("");
50
+ k(z, (e) => {
51
+ e || (B.value = "");
49
52
  });
50
- let { contains: W } = z({ sensitivity: "base" }), G = c(() => i(B.items)), K = c(() => {
51
- let e = U.value.trim();
52
- return G.value.map((t) => ({
53
+ let { contains: V } = I({ sensitivity: "base" }), H = u(() => o(L.items)), U = C([]);
54
+ function W() {
55
+ if (L.recentKey) try {
56
+ let e = JSON.parse(window.localStorage.getItem(L.recentKey) ?? "[]");
57
+ U.value = Array.isArray(e) ? e.filter((e) => typeof e == "string") : [];
58
+ } catch {
59
+ U.value = [];
60
+ }
61
+ }
62
+ function G(e, t) {
63
+ if (L.recentKey) {
64
+ U.value = a(U.value, r(e, t), L.recentLimit);
65
+ try {
66
+ window.localStorage.setItem(L.recentKey, JSON.stringify(U.value));
67
+ } catch {}
68
+ }
69
+ }
70
+ x(W), k(() => L.recentKey, W);
71
+ let K = u(() => {
72
+ if (!L.recentKey || !U.value.length) return;
73
+ let e = /* @__PURE__ */ new Map();
74
+ for (let t of H.value) for (let n of t.items) e.set(r(n, t.label), {
75
+ item: n,
76
+ group: t.label
77
+ });
78
+ let t = U.value.slice(0, L.recentLimit).map((t) => e.get(t)).filter((e) => !!e && !e.item.disabled);
79
+ return t.length ? {
80
+ label: L.recentLabel,
81
+ items: t.map((e) => e.item),
82
+ sources: t.map((e) => e.group)
83
+ } : void 0;
84
+ }), q = u(() => {
85
+ let e = B.value.trim(), t = H.value.map((t) => ({
53
86
  ...t,
54
- items: e ? t.items.filter((r) => W(n(r, t.label), e)) : t.items
87
+ items: e ? t.items.filter((r) => V(n(r, t.label), e)) : t.items
88
+ })).map((e) => ({
89
+ ...e,
90
+ sources: e.items.map(() => e.label)
55
91
  })).filter((e) => e.items.length > 0);
56
- }), q = c(() => K.value.length === 0);
92
+ return !e && K.value ? [K.value, ...t] : t;
93
+ }), ce = u(() => q.value.length === 0);
57
94
  function J(e, t) {
58
95
  return `${e}:${t}`;
59
96
  }
60
- function Y(e) {
61
- e.disabled || (V("select", e), e.onSelect?.(), B.closeOnSelect && (H.value = !1));
97
+ function le(e, t) {
98
+ e.disabled || (G(e, t), R("select", e), e.onSelect?.(), L.closeOnSelect && (z.value = !1));
62
99
  }
63
- function X(e) {
64
- B.hotkey && r(e, B.hotkey) && (e.preventDefault(), H.value = !H.value);
100
+ function Y(e) {
101
+ L.hotkey && i(e, L.hotkey) && (e.preventDefault(), z.value = !z.value);
65
102
  }
66
- y(() => window.addEventListener("keydown", X)), v(() => window.removeEventListener("keydown", X));
67
- let re = e(), Z = c(() => B.unstyled ?? re.unstyled), Q = c(() => a());
103
+ x(() => window.addEventListener("keydown", Y)), b(() => window.removeEventListener("keydown", Y));
104
+ let X = e(), Z = u(() => L.unstyled ?? X.unstyled), Q = u(() => s());
68
105
  function $(e, t) {
69
- let n = B.ui?.[e];
106
+ let n = L.ui?.[e];
70
107
  return Z.value ? [n, t].filter(Boolean).join(" ") : Q.value[e]({ class: [n, t] });
71
108
  }
72
- function ie(e) {
109
+ function ue(e) {
73
110
  return e.split(" ").filter(Boolean);
74
111
  }
75
- return (e, n) => (b(), l(T(A), {
76
- open: H.value,
77
- "onUpdate:open": n[1] ||= (e) => H.value = e
112
+ return (e, n) => (S(), d(D(ne), {
113
+ open: z.value,
114
+ "onUpdate:open": n[1] ||= (e) => z.value = e
78
115
  }, {
79
- default: O(() => [m(T(ne), null, {
80
- default: O(() => [m(T(te), { class: _($("overlay")) }, null, 8, ["class"]), m(T(ee), {
81
- class: _(Z.value ? [B.ui?.content, B.class] : Q.value.content({ class: [B.ui?.content, B.class] })),
82
- "aria-label": B.label,
116
+ default: A(() => [g(D(te), null, {
117
+ default: A(() => [g(D(ee), { class: y($("overlay")) }, null, 8, ["class"]), g(D(M), {
118
+ class: y(Z.value ? [L.ui?.content, L.class] : Q.value.content({ class: [L.ui?.content, L.class] })),
119
+ "aria-label": L.label,
83
120
  "aria-describedby": void 0
84
121
  }, {
85
- default: O(() => [
86
- m(T(R), null, {
87
- default: O(() => [m(T(j), null, {
88
- default: O(() => [p(w(B.label), 1)]),
122
+ default: A(() => [
123
+ g(D(F), null, {
124
+ default: A(() => [g(D(re), null, {
125
+ default: A(() => [h(E(L.label), 1)]),
89
126
  _: 1
90
127
  })]),
91
128
  _: 1
92
129
  }),
93
- m(T(L), {
130
+ g(D(P), {
94
131
  "highlight-on-hover": "",
95
- class: _($("list"))
132
+ class: y($("list"))
96
133
  }, {
97
- default: O(() => [f("div", { class: _($("header")) }, [f("span", { class: _($("icon")) }, [m(t, { icon: T(k) }, null, 8, ["icon"])], 2), m(T(N), {
98
- modelValue: U.value,
99
- "onUpdate:modelValue": n[0] ||= (e) => U.value = e,
134
+ default: A(() => [m("div", { class: y($("header")) }, [m("span", { class: y($("icon")) }, [g(t, { icon: D(j) }, null, 8, ["icon"])], 2), g(D(ae), {
135
+ modelValue: B.value,
136
+ "onUpdate:modelValue": n[0] ||= (e) => B.value = e,
100
137
  "auto-focus": "",
101
- placeholder: B.placeholder,
102
- class: _($("input"))
138
+ placeholder: L.placeholder,
139
+ class: y($("input"))
103
140
  }, null, 8, [
104
141
  "modelValue",
105
142
  "placeholder",
106
143
  "class"
107
- ])], 2), m(T(M), { class: _($("viewport")) }, {
108
- default: O(() => [q.value ? (b(), d("p", {
144
+ ])], 2), g(D(ie), { class: y($("viewport")) }, {
145
+ default: A(() => [ce.value ? (S(), p("p", {
109
146
  key: 0,
110
- class: _($("empty"))
111
- }, [C(e.$slots, "empty", { query: U.value }, () => [p(w(B.emptyText), 1)])], 2)) : u("", !0), (b(!0), d(s, null, S(K.value, (n, r) => (b(), l(T(P), {
147
+ class: y($("empty"))
148
+ }, [T(e.$slots, "empty", { query: B.value }, () => [h(E(L.emptyText), 1)])], 2)) : f("", !0), (S(!0), p(l, null, w(q.value, (n, r) => (S(), d(D(oe), {
112
149
  key: n.label || r,
113
- class: _($("group"))
150
+ class: y($("group"))
114
151
  }, {
115
- default: O(() => [n.label ? (b(), l(T(F), {
152
+ default: A(() => [n.label ? (S(), d(D(se), {
116
153
  key: 0,
117
- class: _($("groupLabel"))
154
+ class: y($("groupLabel"))
118
155
  }, {
119
- default: O(() => [p(w(n.label), 1)]),
156
+ default: A(() => [h(E(n.label), 1)]),
120
157
  _: 2
121
- }, 1032, ["class"])) : u("", !0), (b(!0), d(s, null, S(n.items, (n, i) => (b(), l(T(I), {
122
- key: J(r, i),
123
- value: J(r, i),
124
- disabled: n.disabled,
125
- "aria-disabled": n.disabled || void 0,
126
- as: n.href ? "a" : "div",
127
- href: n.href,
128
- class: _($("item")),
129
- onSelect: (e) => Y(n)
158
+ }, 1032, ["class"])) : f("", !0), (S(!0), p(l, null, w(n.items, (i, a) => (S(), d(D(N), {
159
+ key: J(r, a),
160
+ value: J(r, a),
161
+ disabled: i.disabled,
162
+ "aria-disabled": i.disabled || void 0,
163
+ as: i.href ? "a" : "div",
164
+ href: i.href,
165
+ class: y($("item")),
166
+ onSelect: (e) => le(i, n.sources[a] ?? n.label)
130
167
  }, {
131
- default: O(() => [C(e.$slots, "item", { item: n }, () => [
132
- n.icon ? (b(), d("span", {
168
+ default: A(() => [T(e.$slots, "item", { item: i }, () => [
169
+ i.icon ? (S(), p("span", {
133
170
  key: 0,
134
- class: _($("itemIcon"))
135
- }, [m(t, { icon: n.icon }, null, 8, ["icon"])], 2)) : u("", !0),
136
- f("span", { class: _($("itemLabel")) }, w(n.label), 3),
137
- n.shortcut ? (b(), l(o, {
171
+ class: y($("itemIcon"))
172
+ }, [g(t, { icon: i.icon }, null, 8, ["icon"])], 2)) : f("", !0),
173
+ m("span", { class: y($("itemLabel")) }, E(i.label), 3),
174
+ i.shortcut ? (S(), d(c, {
138
175
  key: 1,
139
- keys: ie(n.shortcut),
140
- class: _($("shortcut")),
141
- ui: { key: B.ui?.key }
176
+ keys: ue(i.shortcut),
177
+ class: y($("shortcut")),
178
+ ui: { key: L.ui?.key }
142
179
  }, null, 8, [
143
180
  "keys",
144
181
  "class",
145
182
  "ui"
146
- ])) : u("", !0)
183
+ ])) : f("", !0)
147
184
  ])]),
148
185
  _: 2
149
186
  }, 1032, [
@@ -161,23 +198,23 @@ var B = /*@__PURE__*/ h({
161
198
  }, 8, ["class"])]),
162
199
  _: 3
163
200
  }, 8, ["class"]),
164
- B.footer ? (b(), d("div", {
201
+ L.footer ? (S(), p("div", {
165
202
  key: 0,
166
- class: _($("footer"))
167
- }, [C(e.$slots, "footer", {}, () => [
168
- f("span", null, [m(o, {
203
+ class: y($("footer"))
204
+ }, [T(e.$slots, "footer", {}, () => [
205
+ m("span", null, [g(c, {
169
206
  keys: ["up", "down"],
170
- ui: { key: B.ui?.key }
171
- }, null, 8, ["ui"]), n[2] ||= p(" to navigate", -1)]),
172
- f("span", null, [m(o, {
207
+ ui: { key: L.ui?.key }
208
+ }, null, 8, ["ui"]), n[2] ||= h(" to navigate", -1)]),
209
+ m("span", null, [g(c, {
173
210
  keys: "enter",
174
- ui: { key: B.ui?.key }
175
- }, null, 8, ["ui"]), n[3] ||= p(" to select", -1)]),
176
- f("span", null, [m(o, {
211
+ ui: { key: L.ui?.key }
212
+ }, null, 8, ["ui"]), n[3] ||= h(" to select", -1)]),
213
+ m("span", null, [g(c, {
177
214
  keys: "escape",
178
- ui: { key: B.ui?.key }
179
- }, null, 8, ["ui"]), n[4] ||= p(" to close", -1)])
180
- ])], 2)) : u("", !0)
215
+ ui: { key: L.ui?.key }
216
+ }, null, 8, ["ui"]), n[4] ||= h(" to close", -1)])
217
+ ])], 2)) : f("", !0)
181
218
  ]),
182
219
  _: 3
183
220
  }, 8, ["class", "aria-label"])]),
@@ -188,4 +225,4 @@ var B = /*@__PURE__*/ h({
188
225
  }
189
226
  });
190
227
  //#endregion
191
- export { B as default };
228
+ export { L as default };
@@ -48,10 +48,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
48
48
  }>, {
49
49
  unstyled: boolean;
50
50
  side: "top" | "right" | "bottom" | "left";
51
+ arrow: boolean;
51
52
  sideOffset: number;
52
53
  confirmLabel: string;
53
54
  cancelLabel: string;
54
- arrow: boolean;
55
55
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
56
56
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
57
57
  declare const _default: typeof __VLS_export;