@luna-park/plugin-nuxt-ui 1.5.1 → 1.5.2

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.
@@ -0,0 +1,133 @@
1
+ import { K as e, g as t, n, t as r } from "./_plugin-vue_export-helper-4np6qU5y.js";
2
+ import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, isRef as f, normalizeClass as p, openBlock as m, ref as h, renderList as g, toDisplayString as _, unref as v, useModel as y, withCtx as b } from "vue";
3
+ import { LButton as x, LDropdown as S, LFloating as C, LInput as w } from "@luna-park/design";
4
+ //#region src/inputs/IconInput.vue?vue&type=script&setup=true&lang.ts
5
+ var T = { class: "popper" }, E = { class: "search" }, D = {
6
+ key: 0,
7
+ class: "list"
8
+ }, O = ["title", "onClick"], k = {
9
+ key: 1,
10
+ class: "empty"
11
+ }, A = /*#__PURE__*/ r(/* @__PURE__ */ d({
12
+ __name: "IconInput",
13
+ props: {
14
+ modelValue: {},
15
+ modelModifiers: {}
16
+ },
17
+ emits: ["update:modelValue"],
18
+ setup(r) {
19
+ let d = y(r, "modelValue"), A = [
20
+ {
21
+ id: "all",
22
+ label: "All libraries"
23
+ },
24
+ {
25
+ id: "lucide",
26
+ label: "Lucide"
27
+ },
28
+ {
29
+ id: "ph",
30
+ label: "Phosphor"
31
+ },
32
+ {
33
+ id: "ri",
34
+ label: "Remix"
35
+ },
36
+ {
37
+ id: "tabler",
38
+ label: "Tabler"
39
+ },
40
+ {
41
+ id: "heroicons",
42
+ label: "Heroicons"
43
+ },
44
+ {
45
+ id: "material-symbols",
46
+ label: "Material Symbols"
47
+ },
48
+ {
49
+ id: "mdi",
50
+ label: "Material Design"
51
+ },
52
+ {
53
+ id: "fa7-solid,fa7-regular,fa7-brands",
54
+ label: "Font Awesome"
55
+ },
56
+ {
57
+ id: "simple-icons",
58
+ label: "Simple Icons"
59
+ },
60
+ {
61
+ id: "logos",
62
+ label: "Logos"
63
+ }
64
+ ], j = h(""), M = t("nuxt-ui-icon-library", "lucide"), N = h([]), P = h(!1), F, I = a(() => /^[a-z0-9-]+:[a-z0-9-]+$/.test(j.value.trim()) ? j.value.trim() : void 0), L = a(() => I.value ? [I.value, ...N.value.filter((e) => e !== I.value)] : N.value), R = a(() => j.value.trim() ? P.value ? "Searching..." : "No icon found" : "Type to search Iconify icons");
65
+ e([j, M], z, { debounce: 250 });
66
+ async function z() {
67
+ F?.abort();
68
+ let e = j.value.trim();
69
+ if (!e) {
70
+ N.value = [];
71
+ return;
72
+ }
73
+ F = new AbortController(), P.value = !0;
74
+ try {
75
+ let t = new URLSearchParams({
76
+ limit: "96",
77
+ query: e
78
+ });
79
+ M.value !== "all" && t.set("prefixes", M.value);
80
+ let { icons: n } = await (await fetch(`https://api.iconify.design/search?${t}`, { signal: F.signal })).json();
81
+ N.value = n, P.value = !1;
82
+ } catch (e) {
83
+ e.name !== "AbortError" && (N.value = [], P.value = !1);
84
+ }
85
+ }
86
+ function B(e, t) {
87
+ d.value = e, t();
88
+ }
89
+ return (e, t) => (m(), o(v(C), null, {
90
+ popper: b(({ hide: e }) => [l("div", T, [l("div", E, [u(v(w), {
91
+ modelValue: j.value,
92
+ "onUpdate:modelValue": t[0] ||= (e) => j.value = e,
93
+ class: "query",
94
+ focus: "",
95
+ borderless: "",
96
+ placeholder: "Search icon...",
97
+ small: "",
98
+ onEnter: (t) => L.value[0] && B(L.value[0], e)
99
+ }, null, 8, ["modelValue", "onEnter"]), u(v(S), {
100
+ modelValue: v(M),
101
+ "onUpdate:modelValue": t[1] ||= (e) => f(M) ? M.value = e : null,
102
+ borderless: "",
103
+ class: "library",
104
+ options: A,
105
+ small: ""
106
+ }, null, 8, ["modelValue"])]), L.value.length ? (m(), c("div", D, [(m(!0), c(i, null, g(L.value, (t) => (m(), c("button", {
107
+ key: t,
108
+ class: p(["item", { selected: t === d.value }]),
109
+ title: t,
110
+ type: "button",
111
+ onClick: (n) => B(t, e)
112
+ }, [u(v(n), { icon: t }, null, 8, ["icon"])], 10, O))), 128))])) : (m(), c("div", k, _(R.value), 1))])]),
113
+ default: b(() => [u(v(x), {
114
+ borderless: "",
115
+ class: "button",
116
+ left: "",
117
+ small: "",
118
+ title: d.value,
119
+ wide: ""
120
+ }, {
121
+ default: b(() => [d.value ? (m(), o(v(n), {
122
+ key: 0,
123
+ class: "preview",
124
+ icon: d.value
125
+ }, null, 8, ["icon"])) : s("", !0), l("span", { class: p(["name", { placeholder: !d.value }]) }, _(d.value || "Select icon..."), 3)]),
126
+ _: 1
127
+ }, 8, ["title"])]),
128
+ _: 1
129
+ }));
130
+ }
131
+ }), [["__scopeId", "data-v-af29ecbe"]]);
132
+ //#endregion
133
+ export { A as default };