@vue-interface/tag-field 1.0.0 → 1.0.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.
- package/README.md +1 -1
- package/dist/src/TagField.vue.d.ts +31 -20
- package/dist/tag-field.js +260 -216
- package/dist/tag-field.js.map +1 -1
- package/dist/tag-field.umd.cjs +1 -1
- package/dist/tag-field.umd.cjs.map +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
|
+
import { BadgeSize } from '@vue-interface/badge';
|
|
1
2
|
import { FormControlProps, FormControlSlots } from '@vue-interface/form-control';
|
|
2
3
|
import { IFuseOptions } from 'fuse.js';
|
|
3
4
|
import { HTMLAttributes } from 'vue';
|
|
4
5
|
export type TagFieldSizePrefix = 'form-control';
|
|
5
|
-
export type TagFieldProps<
|
|
6
|
-
options?:
|
|
7
|
-
fuseOptions?: IFuseOptions<
|
|
8
|
-
display?: (option:
|
|
9
|
-
format?: (value: string) =>
|
|
6
|
+
export type TagFieldProps<ModelValue, Value> = FormControlProps<HTMLAttributes, TagFieldSizePrefix, ModelValue[], Value[]> & {
|
|
7
|
+
options?: ModelValue[];
|
|
8
|
+
fuseOptions?: IFuseOptions<ModelValue>;
|
|
9
|
+
display?: (option: ModelValue) => string;
|
|
10
|
+
format?: (value: string) => ModelValue;
|
|
10
11
|
allowCustom?: boolean;
|
|
11
12
|
addTagLabel?: string;
|
|
12
13
|
noResultsText?: string;
|
|
13
14
|
showNoResults?: boolean;
|
|
14
15
|
clearable?: boolean;
|
|
16
|
+
badgeClass?: string | string[] | Record<string, boolean>;
|
|
17
|
+
activeBadgeColor?: string | string[] | Record<string, boolean>;
|
|
18
|
+
badgeSize?: BadgeSize;
|
|
19
|
+
badgeCloseable?: boolean;
|
|
20
|
+
badgeCloseLeft?: boolean;
|
|
15
21
|
};
|
|
16
|
-
declare const _default: <
|
|
22
|
+
declare const _default: <ModelValue, Value>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
17
23
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
18
24
|
readonly onInput?: ((event: Event) => any) | undefined;
|
|
19
25
|
readonly onSelect?: ((event: Event) => any) | undefined;
|
|
@@ -49,9 +55,9 @@ declare const _default: <T, Value>(__VLS_props: NonNullable<Awaited<typeof __VLS
|
|
|
49
55
|
readonly onTouchcancel?: ((event: TouchEvent) => any) | undefined;
|
|
50
56
|
readonly onChange?: ((event: Event) => any) | undefined;
|
|
51
57
|
readonly onBeforeinput?: ((event: Event) => any) | undefined;
|
|
52
|
-
readonly "onUpdate:modelValue"?: ((value:
|
|
58
|
+
readonly "onUpdate:modelValue"?: ((value: ModelValue[]) => any) | undefined;
|
|
53
59
|
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onCopy" | "onCut" | "onPaste" | "onFocus" | "onFocusin" | "onFocusout" | "onBlur" | "onChange" | "onBeforeinput" | "onInput" | "onReset" | "onSubmit" | "onInvalid" | "onKeydown" | "onKeypress" | "onKeyup" | "onMousedown" | "onMouseenter" | "onMouseleave" | "onMousemove" | "onMouseout" | "onMouseover" | "onMouseup" | "onSelect" | "onScroll" | "onTouchcancel" | "onTouchend" | "onTouchmove" | "onTouchstart" | "onClick" | "onContextmenu" | "onWheel" | "onDoubleclick" | "onSelectionchange" | "onUpdate:modelValue"> & ({
|
|
54
|
-
modelValue?:
|
|
60
|
+
modelValue?: ModelValue[];
|
|
55
61
|
} & {
|
|
56
62
|
activity?: boolean;
|
|
57
63
|
disabled?: boolean;
|
|
@@ -66,7 +72,7 @@ declare const _default: <T, Value>(__VLS_props: NonNullable<Awaited<typeof __VLS
|
|
|
66
72
|
invalid?: boolean;
|
|
67
73
|
label?: string;
|
|
68
74
|
labelClass?: string;
|
|
69
|
-
modelValue?:
|
|
75
|
+
modelValue?: ModelValue[] | undefined;
|
|
70
76
|
name?: string;
|
|
71
77
|
plaintext?: boolean;
|
|
72
78
|
size?: import('@vue-interface/form-control').FormControlSize<"form-control"> | undefined;
|
|
@@ -75,36 +81,41 @@ declare const _default: <T, Value>(__VLS_props: NonNullable<Awaited<typeof __VLS
|
|
|
75
81
|
valid?: boolean;
|
|
76
82
|
value?: Value[] | undefined;
|
|
77
83
|
} & Omit<HTMLAttributes, "size"> & {
|
|
78
|
-
options?:
|
|
79
|
-
fuseOptions?: IFuseOptions<
|
|
80
|
-
display?: ((option:
|
|
81
|
-
format?: ((value: string) =>
|
|
84
|
+
options?: ModelValue[] | undefined;
|
|
85
|
+
fuseOptions?: IFuseOptions<ModelValue> | undefined;
|
|
86
|
+
display?: ((option: ModelValue) => string) | undefined;
|
|
87
|
+
format?: ((value: string) => ModelValue) | undefined;
|
|
82
88
|
allowCustom?: boolean;
|
|
83
89
|
addTagLabel?: string;
|
|
84
90
|
noResultsText?: string;
|
|
85
91
|
showNoResults?: boolean;
|
|
86
92
|
clearable?: boolean;
|
|
93
|
+
badgeClass?: string | string[] | Record<string, boolean>;
|
|
94
|
+
activeBadgeColor?: string | string[] | Record<string, boolean>;
|
|
95
|
+
badgeSize?: BadgeSize;
|
|
96
|
+
badgeCloseable?: boolean;
|
|
97
|
+
badgeCloseLeft?: boolean;
|
|
87
98
|
}) & Partial<{}>> & import('vue').PublicProps;
|
|
88
99
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
89
100
|
attrs: any;
|
|
90
|
-
slots: Readonly<FormControlSlots<"form-control",
|
|
101
|
+
slots: Readonly<FormControlSlots<"form-control", ModelValue[]> & {
|
|
91
102
|
default(props: {
|
|
92
|
-
option:
|
|
93
|
-
display?: (option:
|
|
103
|
+
option: ModelValue;
|
|
104
|
+
display?: (option: ModelValue) => string;
|
|
94
105
|
}): any;
|
|
95
106
|
'no-results'(props: {
|
|
96
107
|
input: string | undefined;
|
|
97
108
|
}): any;
|
|
98
|
-
}> & FormControlSlots<"form-control",
|
|
109
|
+
}> & FormControlSlots<"form-control", ModelValue[]> & {
|
|
99
110
|
default(props: {
|
|
100
|
-
option:
|
|
101
|
-
display?: (option:
|
|
111
|
+
option: ModelValue;
|
|
112
|
+
display?: (option: ModelValue) => string;
|
|
102
113
|
}): any;
|
|
103
114
|
'no-results'(props: {
|
|
104
115
|
input: string | undefined;
|
|
105
116
|
}): any;
|
|
106
117
|
};
|
|
107
|
-
emit: (((evt: "input", event: Event) => void) & ((evt: "select", event: Event) => void) & ((evt: "click", event: MouseEvent) => void) & ((evt: "submit", event: Event) => void) & ((evt: "reset", event: Event) => void) & ((evt: "blur", event: FocusEvent) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "focusin", event: FocusEvent) => void) & ((evt: "focusout", event: FocusEvent) => void) & ((evt: "doubleclick", event: MouseEvent) => void) & ((evt: "contextmenu", event: MouseEvent) => void) & ((evt: "mousedown", event: MouseEvent) => void) & ((evt: "mouseup", event: MouseEvent) => void) & ((evt: "mouseover", event: MouseEvent) => void) & ((evt: "mouseout", event: MouseEvent) => void) & ((evt: "mouseenter", event: MouseEvent) => void) & ((evt: "mouseleave", event: MouseEvent) => void) & ((evt: "mousemove", event: MouseEvent) => void) & ((evt: "keydown", event: KeyboardEvent) => void) & ((evt: "keyup", event: KeyboardEvent) => void) & ((evt: "keypress", event: KeyboardEvent) => void) & ((evt: "selectionchange", event: Event) => void) & ((evt: "invalid", event: Event) => void) & ((evt: "scroll", event: Event) => void) & ((evt: "wheel", event: WheelEvent) => void) & ((evt: "copy", event: ClipboardEvent) => void) & ((evt: "cut", event: ClipboardEvent) => void) & ((evt: "paste", event: ClipboardEvent) => void) & ((evt: "touchstart", event: TouchEvent) => void) & ((evt: "touchend", event: TouchEvent) => void) & ((evt: "touchmove", event: TouchEvent) => void) & ((evt: "touchcancel", event: TouchEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "beforeinput", event: Event) => void)) & ((evt: "update:modelValue", value:
|
|
118
|
+
emit: (((evt: "input", event: Event) => void) & ((evt: "select", event: Event) => void) & ((evt: "click", event: MouseEvent) => void) & ((evt: "submit", event: Event) => void) & ((evt: "reset", event: Event) => void) & ((evt: "blur", event: FocusEvent) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "focusin", event: FocusEvent) => void) & ((evt: "focusout", event: FocusEvent) => void) & ((evt: "doubleclick", event: MouseEvent) => void) & ((evt: "contextmenu", event: MouseEvent) => void) & ((evt: "mousedown", event: MouseEvent) => void) & ((evt: "mouseup", event: MouseEvent) => void) & ((evt: "mouseover", event: MouseEvent) => void) & ((evt: "mouseout", event: MouseEvent) => void) & ((evt: "mouseenter", event: MouseEvent) => void) & ((evt: "mouseleave", event: MouseEvent) => void) & ((evt: "mousemove", event: MouseEvent) => void) & ((evt: "keydown", event: KeyboardEvent) => void) & ((evt: "keyup", event: KeyboardEvent) => void) & ((evt: "keypress", event: KeyboardEvent) => void) & ((evt: "selectionchange", event: Event) => void) & ((evt: "invalid", event: Event) => void) & ((evt: "scroll", event: Event) => void) & ((evt: "wheel", event: WheelEvent) => void) & ((evt: "copy", event: ClipboardEvent) => void) & ((evt: "cut", event: ClipboardEvent) => void) & ((evt: "paste", event: ClipboardEvent) => void) & ((evt: "touchstart", event: TouchEvent) => void) & ((evt: "touchend", event: TouchEvent) => void) & ((evt: "touchmove", event: TouchEvent) => void) & ((evt: "touchcancel", event: TouchEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "beforeinput", event: Event) => void)) & ((evt: "update:modelValue", value: ModelValue[]) => void);
|
|
108
119
|
}>) => import('vue').VNode & {
|
|
109
120
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
110
121
|
};
|
package/dist/tag-field.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { openBlock as r, createElementBlock as
|
|
2
|
-
import { ActivityIndicator as
|
|
3
|
-
import { Badge as
|
|
4
|
-
import { useFormControl as
|
|
1
|
+
import { openBlock as r, createElementBlock as c, createElementVNode as g, defineComponent as Me, useModel as ze, useTemplateRef as H, ref as z, computed as B, watch as ue, toRaw as Fe, unref as d, onBeforeMount as Ae, onBeforeUnmount as Ke, normalizeClass as F, renderSlot as k, toDisplayString as h, createCommentVNode as x, normalizeProps as A, guardReactiveProps as K, mergeProps as Le, withModifiers as s, Fragment as se, renderList as re, createBlock as V, withCtx as L, createTextVNode as Q, createVNode as N, withDirectives as Se, withKeys as f, vModelText as Ie, Transition as Oe, mergeModels as ie } from "vue";
|
|
2
|
+
import { ActivityIndicator as Re } from "@vue-interface/activity-indicator";
|
|
3
|
+
import { Badge as Ve } from "@vue-interface/badge";
|
|
4
|
+
import { useFormControl as Ne, FormControlErrors as De, FormControlFeedback as je } from "@vue-interface/form-control";
|
|
5
5
|
import Pe from "fuse.js";
|
|
6
|
-
import { isEqual as
|
|
7
|
-
function Ue(
|
|
8
|
-
return r(),
|
|
6
|
+
import { isEqual as S } from "lodash-es";
|
|
7
|
+
function Ue(o, D) {
|
|
8
|
+
return r(), c("svg", {
|
|
9
9
|
xmlns: "http://www.w3.org/2000/svg",
|
|
10
10
|
fill: "none",
|
|
11
11
|
viewBox: "0 0 24 24",
|
|
@@ -14,15 +14,15 @@ function Ue(I, N) {
|
|
|
14
14
|
"aria-hidden": "true",
|
|
15
15
|
"data-slot": "icon"
|
|
16
16
|
}, [
|
|
17
|
-
|
|
17
|
+
g("path", {
|
|
18
18
|
"stroke-linecap": "round",
|
|
19
19
|
"stroke-linejoin": "round",
|
|
20
20
|
d: "M12 4.5v15m7.5-7.5h-15"
|
|
21
21
|
})
|
|
22
22
|
]);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return r(),
|
|
24
|
+
function de(o, D) {
|
|
25
|
+
return r(), c("svg", {
|
|
26
26
|
xmlns: "http://www.w3.org/2000/svg",
|
|
27
27
|
fill: "none",
|
|
28
28
|
viewBox: "0 0 24 24",
|
|
@@ -31,349 +31,393 @@ function ue(I, N) {
|
|
|
31
31
|
"aria-hidden": "true",
|
|
32
32
|
"data-slot": "icon"
|
|
33
33
|
}, [
|
|
34
|
-
|
|
34
|
+
g("path", {
|
|
35
35
|
"stroke-linecap": "round",
|
|
36
36
|
"stroke-linejoin": "round",
|
|
37
37
|
d: "M6 18 18 6M6 6l12 12"
|
|
38
38
|
})
|
|
39
39
|
]);
|
|
40
40
|
}
|
|
41
|
-
const qe = ["for"], Ge = { class: "form-control-inner" }, Je = { class: "flex flex-wrap gap-2 mr-2 flex-1" }, We = ["placeholder", "onKeydown"], He = { class: "form-control-activity-indicator" }, Qe = {
|
|
41
|
+
const qe = ["for"], Ge = { class: "form-control-inner" }, Je = { class: "flex flex-wrap gap-2 mr-2 flex-1" }, We = ["placeholder", "disabled", "readonly", "onKeydown"], He = { class: "form-control-activity-indicator" }, Qe = ["onMouseup"], Xe = { class: "truncate" }, Ye = {
|
|
42
|
+
key: 1,
|
|
43
|
+
class: "py-2 px-4 text-neutral-400 dark:text-neutral-500"
|
|
44
|
+
}, Ze = {
|
|
42
45
|
invalid: "",
|
|
43
46
|
class: "invalid-feedback"
|
|
44
|
-
},
|
|
47
|
+
}, _e = {
|
|
45
48
|
valid: "",
|
|
46
49
|
class: "valid-feedback"
|
|
47
|
-
},
|
|
50
|
+
}, et = {
|
|
48
51
|
key: 0,
|
|
49
52
|
class: "form-help"
|
|
50
|
-
},
|
|
51
|
-
key: 1,
|
|
52
|
-
class: "py-2 px-4 text-neutral-400 dark:text-neutral-500"
|
|
53
|
-
}, st = /* @__PURE__ */ xe({
|
|
53
|
+
}, st = /* @__PURE__ */ Me({
|
|
54
54
|
inheritAttrs: !1,
|
|
55
55
|
__name: "TagField",
|
|
56
|
-
props: {
|
|
56
|
+
props: /* @__PURE__ */ ie({
|
|
57
|
+
activity: { type: Boolean },
|
|
58
|
+
disabled: { type: Boolean },
|
|
59
|
+
error: {},
|
|
60
|
+
errors: {},
|
|
61
|
+
feedback: {},
|
|
62
|
+
formControlClass: { default: "form-control" },
|
|
63
|
+
helpText: {},
|
|
64
|
+
id: {},
|
|
65
|
+
indicator: {},
|
|
66
|
+
indicatorSize: {},
|
|
67
|
+
invalid: { type: Boolean },
|
|
68
|
+
label: {},
|
|
69
|
+
labelClass: { default: "form-label" },
|
|
70
|
+
modelValue: {},
|
|
71
|
+
name: {},
|
|
72
|
+
plaintext: { type: Boolean },
|
|
73
|
+
size: { default: "form-control-md" },
|
|
74
|
+
color: {},
|
|
75
|
+
readonly: { type: Boolean },
|
|
76
|
+
valid: { type: Boolean },
|
|
77
|
+
value: {},
|
|
78
|
+
options: { default: () => [] },
|
|
79
|
+
fuseOptions: {},
|
|
80
|
+
display: {},
|
|
81
|
+
format: {},
|
|
82
|
+
allowCustom: { type: Boolean, default: !1 },
|
|
83
|
+
addTagLabel: { default: "Add Tag" },
|
|
84
|
+
noResultsText: { default: "No results found" },
|
|
85
|
+
showNoResults: { type: Boolean, default: !0 },
|
|
86
|
+
clearable: { type: Boolean, default: !1 },
|
|
87
|
+
badgeClass: { default: "badge-neutral-100 dark:badge-neutral-500" },
|
|
88
|
+
activeBadgeColor: { default: "badge-blue-100! dark:badge-blue-600!" },
|
|
89
|
+
badgeSize: { default: "badge-[.95em]" },
|
|
90
|
+
badgeCloseable: { type: Boolean, default: !0 },
|
|
91
|
+
badgeCloseLeft: { type: Boolean, default: !1 }
|
|
92
|
+
}, {
|
|
57
93
|
modelValue: {},
|
|
58
94
|
modelModifiers: {}
|
|
59
|
-
},
|
|
60
|
-
emits: /* @__PURE__ */
|
|
61
|
-
setup(
|
|
62
|
-
const
|
|
63
|
-
controlAttributes:
|
|
64
|
-
formGroupClasses:
|
|
65
|
-
listeners:
|
|
66
|
-
} =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}),
|
|
70
|
-
|
|
95
|
+
}),
|
|
96
|
+
emits: /* @__PURE__ */ ie(["blur", "focus", "focusin", "focusout", "click", "doubleclick", "contextmenu", "mousedown", "mouseup", "mouseover", "mouseout", "mouseenter", "mouseleave", "mousemove", "keydown", "keyup", "keypress", "select", "selectionchange", "invalid", "submit", "reset", "scroll", "wheel", "copy", "cut", "paste", "touchstart", "touchend", "touchmove", "touchcancel", "change", "input", "beforeinput"], ["update:modelValue"]),
|
|
97
|
+
setup(o, { emit: D }) {
|
|
98
|
+
const u = o, n = ze(o, "modelValue"), ce = D, {
|
|
99
|
+
controlAttributes: j,
|
|
100
|
+
formGroupClasses: ve,
|
|
101
|
+
listeners: P
|
|
102
|
+
} = Ne({ model: n, props: u, emit: ce }), U = H("wrapperEl"), I = H("inputEl"), q = H("tagEl"), a = z(), v = z([]), C = z(!1), i = z(), O = z(u.options), m = B(() => !u.disabled && !u.readonly), G = B(() => u.clearable && (!!a.value || !!n.value?.length) && m.value), fe = B(() => typeof u.options == "object" && u.options?.[0] ? Object.keys(u.options?.[0]) : []), X = ge(u.options), me = B(() => m.value && C.value && (b.value.length || a.value)), R = B(() => v.value.map((e) => (n.value ?? []).findIndex((t) => S(t, e))));
|
|
103
|
+
ue(() => u.options, () => {
|
|
104
|
+
O.value = u.options;
|
|
105
|
+
}), ue(a, () => {
|
|
106
|
+
C.value = !0, i.value = void 0, y();
|
|
71
107
|
});
|
|
72
|
-
function
|
|
73
|
-
return new Pe(e,
|
|
108
|
+
function ge(e) {
|
|
109
|
+
return new Pe(e, u.fuseOptions ?? {
|
|
74
110
|
includeScore: !0,
|
|
75
111
|
threshold: 0.45,
|
|
76
|
-
keys:
|
|
112
|
+
keys: fe.value
|
|
77
113
|
});
|
|
78
114
|
}
|
|
79
|
-
const
|
|
80
|
-
const e =
|
|
81
|
-
return
|
|
115
|
+
const b = B(() => {
|
|
116
|
+
const e = O.value.filter((t) => !(n.value ?? []).find((l) => S(l, Fe(d(t)))));
|
|
117
|
+
return a.value ? (X.setCollection(e), X.search(a.value).map(({ item: t }) => t)) : e;
|
|
82
118
|
});
|
|
83
|
-
function
|
|
84
|
-
|
|
85
|
-
|
|
119
|
+
function J(e) {
|
|
120
|
+
if (!m.value) return;
|
|
121
|
+
const t = u.format?.(e) ?? e;
|
|
122
|
+
O.value.find((l) => S(l, t)) || (O.value.push(t), E(t), a.value = void 0);
|
|
86
123
|
}
|
|
87
|
-
function
|
|
88
|
-
n.value = [...n.value ?? [], e],
|
|
124
|
+
function E(e) {
|
|
125
|
+
m.value && (n.value = [...n.value ?? [], e], a.value = void 0, i.value = void 0);
|
|
89
126
|
}
|
|
90
|
-
function
|
|
127
|
+
function Y(e) {
|
|
128
|
+
if (!m.value) return;
|
|
91
129
|
const t = [...n.value ?? []];
|
|
92
|
-
t.splice(t.indexOf(e), 1),
|
|
130
|
+
t.splice(t.indexOf(e), 1), M(e), n.value = t;
|
|
93
131
|
}
|
|
94
|
-
function
|
|
95
|
-
t ||
|
|
132
|
+
function $(e, t = !1) {
|
|
133
|
+
m.value && (t || y(e), T(e) ? M(e) : _(e));
|
|
96
134
|
}
|
|
97
|
-
function
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
135
|
+
function be(e) {
|
|
136
|
+
if (!m.value) return;
|
|
137
|
+
const t = n.value ?? [], l = t.indexOf(e), p = R.value[R.value.length - 1], w = T(e) ? M : _;
|
|
138
|
+
if (p === void 0) {
|
|
139
|
+
$(e);
|
|
101
140
|
return;
|
|
102
141
|
}
|
|
103
|
-
let
|
|
104
|
-
|
|
105
|
-
for (const
|
|
106
|
-
w(
|
|
142
|
+
let W = [];
|
|
143
|
+
l > p ? W = t.slice(p, l + 1) : l < p && (W = t.slice(l, p + 1));
|
|
144
|
+
for (const Ee of W)
|
|
145
|
+
w(Ee);
|
|
107
146
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
147
|
+
function ye() {
|
|
148
|
+
a.value || (v.value = [...n.value ?? []]);
|
|
110
149
|
}
|
|
111
|
-
function
|
|
150
|
+
function y(e) {
|
|
112
151
|
if (!e)
|
|
113
152
|
v.value = [];
|
|
114
153
|
else {
|
|
115
154
|
const t = v.value.filter(
|
|
116
|
-
(
|
|
155
|
+
(l) => !S(l, e)
|
|
117
156
|
);
|
|
118
|
-
for (const
|
|
119
|
-
|
|
157
|
+
for (const l of t)
|
|
158
|
+
M(l);
|
|
120
159
|
}
|
|
121
|
-
|
|
160
|
+
Z();
|
|
122
161
|
}
|
|
123
|
-
function
|
|
124
|
-
if (
|
|
125
|
-
for (const e of
|
|
162
|
+
function Z() {
|
|
163
|
+
if (q.value)
|
|
164
|
+
for (const e of q.value)
|
|
126
165
|
e?.$el?.blur();
|
|
127
166
|
}
|
|
128
|
-
function
|
|
129
|
-
return !!v.value.find((t) =>
|
|
167
|
+
function T(e) {
|
|
168
|
+
return !!v.value.find((t) => S(t, e));
|
|
130
169
|
}
|
|
131
|
-
function
|
|
132
|
-
|
|
170
|
+
function _(e) {
|
|
171
|
+
T(e) || v.value.push(e);
|
|
133
172
|
}
|
|
134
|
-
function
|
|
135
|
-
|
|
173
|
+
function M(e) {
|
|
174
|
+
T(e) && v.value.splice(v.value.indexOf(e), 1), Z();
|
|
136
175
|
}
|
|
137
|
-
function
|
|
138
|
-
n.value = (n.value ?? []).filter((e) =>
|
|
176
|
+
function ee() {
|
|
177
|
+
n.value = (n.value ?? []).filter((e) => !T(e)), v.value = [];
|
|
139
178
|
}
|
|
140
|
-
function
|
|
141
|
-
|
|
179
|
+
function pe() {
|
|
180
|
+
I.value?.focus(), !a.value && (v.value.length ? ee() : n.value?.length && Y(n.value[n.value.length - 1]));
|
|
142
181
|
}
|
|
143
|
-
function
|
|
144
|
-
i.value !== void 0 ?
|
|
182
|
+
function ke(e) {
|
|
183
|
+
i.value !== void 0 ? E(b.value[i.value]) : b.value.length ? E(b.value[0]) : u.allowCustom && a.value && J(a.value), e.preventDefault();
|
|
145
184
|
}
|
|
146
|
-
function
|
|
147
|
-
i.value !== void 0 && (
|
|
185
|
+
function we(e) {
|
|
186
|
+
i.value !== void 0 && (E(b.value[i.value]), e.preventDefault());
|
|
148
187
|
}
|
|
149
188
|
function he() {
|
|
150
|
-
i.value ? i.value-- : i.value =
|
|
189
|
+
i.value ? i.value-- : i.value = b.value.length - 1;
|
|
151
190
|
}
|
|
152
|
-
function
|
|
153
|
-
i.value === void 0 || i.value ===
|
|
191
|
+
function xe() {
|
|
192
|
+
i.value === void 0 || i.value === b.value.length - 1 ? i.value = 0 : i.value++;
|
|
154
193
|
}
|
|
155
|
-
function
|
|
156
|
-
if (!n.value?.length ||
|
|
194
|
+
function te(e = !1) {
|
|
195
|
+
if (!n.value?.length || a.value)
|
|
157
196
|
return;
|
|
158
|
-
const t = Math.min(...
|
|
159
|
-
n.value[t] ?
|
|
197
|
+
const t = Math.min(...R.value, n.value.length) - 1;
|
|
198
|
+
n.value[t] ? $(n.value[t], e) : y();
|
|
160
199
|
}
|
|
161
|
-
function
|
|
162
|
-
if (!n.value?.length ||
|
|
200
|
+
function le(e = !1) {
|
|
201
|
+
if (!n.value?.length || a.value)
|
|
163
202
|
return;
|
|
164
|
-
const t = Math.max(...
|
|
165
|
-
n.value[t] ?
|
|
203
|
+
const t = Math.max(...R.value, -1) + 1;
|
|
204
|
+
n.value[t] ? $(n.value[t], e) : y();
|
|
166
205
|
}
|
|
167
206
|
function Ce() {
|
|
168
|
-
|
|
207
|
+
C.value ? C.value = !1 : y();
|
|
169
208
|
}
|
|
170
|
-
function $e() {
|
|
171
|
-
|
|
209
|
+
function $e(e) {
|
|
210
|
+
u.allowCustom && a.value && J(a.value), C.value = !1, y(), P.onBlur(e);
|
|
172
211
|
}
|
|
173
|
-
function Te() {
|
|
174
|
-
|
|
212
|
+
function Te(e) {
|
|
213
|
+
C.value = !0, y(), P.onFocus(e);
|
|
175
214
|
}
|
|
176
|
-
function
|
|
177
|
-
|
|
215
|
+
function Be() {
|
|
216
|
+
a.value && J(a.value);
|
|
178
217
|
}
|
|
179
218
|
function oe() {
|
|
180
|
-
|
|
219
|
+
m.value && (a.value = void 0, n.value = []);
|
|
181
220
|
}
|
|
182
221
|
function ne(e) {
|
|
183
|
-
e.target && (
|
|
222
|
+
e.target && (U.value == e.target || U.value?.contains(e.target) || y());
|
|
184
223
|
}
|
|
185
|
-
function
|
|
224
|
+
function ae(e) {
|
|
186
225
|
switch (e.key) {
|
|
187
226
|
case "Backspace":
|
|
188
|
-
v.value.length && (
|
|
227
|
+
v.value.length && (ee(), e.preventDefault());
|
|
189
228
|
break;
|
|
190
229
|
case "Escape":
|
|
191
|
-
|
|
230
|
+
C.value || y();
|
|
192
231
|
}
|
|
193
232
|
}
|
|
194
233
|
return Ae(() => {
|
|
195
|
-
document.addEventListener("click", ne), document.addEventListener("keydown",
|
|
234
|
+
document.addEventListener("click", ne), document.addEventListener("keydown", ae);
|
|
196
235
|
}), Ke(() => {
|
|
197
|
-
document.removeEventListener("click", ne), document.removeEventListener("keydown",
|
|
198
|
-
}), (e, t) => (r(),
|
|
236
|
+
document.removeEventListener("click", ne), document.removeEventListener("keydown", ae);
|
|
237
|
+
}), (e, t) => (r(), c("div", {
|
|
199
238
|
ref_key: "wrapperEl",
|
|
200
|
-
ref:
|
|
201
|
-
class:
|
|
239
|
+
ref: U,
|
|
240
|
+
class: F(["tag-field", [d(ve), { "has-clear-button": G.value }]])
|
|
202
241
|
}, [
|
|
203
242
|
k(e.$slots, "label", {}, () => [
|
|
204
|
-
|
|
243
|
+
o.label ? (r(), c("label", {
|
|
205
244
|
key: 0,
|
|
206
|
-
class:
|
|
207
|
-
for:
|
|
208
|
-
},
|
|
245
|
+
class: F(o.labelClass),
|
|
246
|
+
for: d(j).id
|
|
247
|
+
}, h(o.label), 11, qe)) : x("", !0)
|
|
209
248
|
]),
|
|
210
|
-
|
|
211
|
-
k(e.$slots, "control",
|
|
212
|
-
e.$slots.icon ? (r(),
|
|
249
|
+
g("div", Ge, [
|
|
250
|
+
k(e.$slots, "control", A(K({ controlAttributes: d(j), listeners: d(P) })), () => [
|
|
251
|
+
e.$slots.icon ? (r(), c("div", {
|
|
213
252
|
key: 0,
|
|
214
253
|
class: "form-control-inner-icon",
|
|
215
|
-
onClick: t[0] || (t[0] = (
|
|
254
|
+
onClick: t[0] || (t[0] = (l) => I.value?.focus())
|
|
216
255
|
}, [
|
|
217
256
|
k(e.$slots, "icon")
|
|
218
|
-
])) :
|
|
219
|
-
|
|
220
|
-
class: "form-control flex",
|
|
221
|
-
onClick: t[8] || (t[8] =
|
|
257
|
+
])) : x("", !0),
|
|
258
|
+
g("div", Le(d(j), {
|
|
259
|
+
class: ["form-control flex", e.$attrs.class],
|
|
260
|
+
onClick: t[8] || (t[8] = s((l) => I.value?.focus(), ["self"]))
|
|
222
261
|
}), [
|
|
223
|
-
|
|
224
|
-
(r(!0),
|
|
262
|
+
g("div", Je, [
|
|
263
|
+
(r(!0), c(se, null, re(n.value, (l, p) => (r(), V(d(Ve), {
|
|
225
264
|
ref_for: !0,
|
|
226
265
|
ref_key: "tagEl",
|
|
227
|
-
ref:
|
|
228
|
-
key: `tag-${
|
|
266
|
+
ref: q,
|
|
267
|
+
key: `tag-${p}`,
|
|
229
268
|
tabindex: "-1",
|
|
230
|
-
size:
|
|
231
|
-
class:
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
269
|
+
size: o.badgeSize,
|
|
270
|
+
class: F([
|
|
271
|
+
o.badgeClass,
|
|
272
|
+
{ "pointer-events-none": !m.value },
|
|
273
|
+
T(l) ? o.activeBadgeColor : void 0
|
|
274
|
+
]),
|
|
275
|
+
closeable: o.badgeCloseable,
|
|
276
|
+
"close-left": o.badgeCloseLeft,
|
|
277
|
+
onMousedown: t[2] || (t[2] = s(() => {
|
|
236
278
|
}, ["prevent"])),
|
|
237
|
-
onClose: (w) =>
|
|
238
|
-
onFocus: (w) =>
|
|
239
|
-
onBlur: (w) =>
|
|
279
|
+
onClose: (w) => Y(l),
|
|
280
|
+
onFocus: (w) => $(l),
|
|
281
|
+
onBlur: (w) => M(l),
|
|
240
282
|
onClick: [
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
283
|
+
s((w) => $(l, !0), ["exact", "meta"]),
|
|
284
|
+
s((w) => $(l), ["exact"]),
|
|
285
|
+
s((w) => be(l), ["exact", "shift"])
|
|
244
286
|
]
|
|
245
287
|
}, {
|
|
246
|
-
"close-icon":
|
|
247
|
-
|
|
288
|
+
"close-icon": L(() => [
|
|
289
|
+
N(d(de), {
|
|
248
290
|
class: "size-[1.25em]",
|
|
249
|
-
onMousedown: t[1] || (t[1] =
|
|
291
|
+
onMousedown: t[1] || (t[1] = s(() => {
|
|
250
292
|
}, ["prevent"]))
|
|
251
293
|
})
|
|
252
294
|
]),
|
|
253
|
-
default:
|
|
295
|
+
default: L(() => [
|
|
254
296
|
k(e.$slots, "default", {
|
|
255
|
-
option:
|
|
256
|
-
display:
|
|
297
|
+
option: l,
|
|
298
|
+
display: o.display
|
|
257
299
|
}, () => [
|
|
258
|
-
|
|
300
|
+
Q(h(o.display?.(l) ?? l), 1)
|
|
259
301
|
])
|
|
260
302
|
]),
|
|
261
303
|
_: 2
|
|
262
|
-
}, 1032, ["class", "onClose", "onFocus", "onBlur", "onClick"]))), 128)),
|
|
263
|
-
|
|
304
|
+
}, 1032, ["size", "class", "closeable", "close-left", "onClose", "onFocus", "onBlur", "onClick"]))), 128)),
|
|
305
|
+
Se(g("input", {
|
|
264
306
|
ref_key: "inputEl",
|
|
265
|
-
ref:
|
|
266
|
-
"onUpdate:modelValue": t[3] || (t[3] = (
|
|
267
|
-
placeholder: e.placeholder,
|
|
307
|
+
ref: I,
|
|
308
|
+
"onUpdate:modelValue": t[3] || (t[3] = (l) => a.value = l),
|
|
309
|
+
placeholder: n.value?.length ? void 0 : e.$attrs.placeholder,
|
|
310
|
+
disabled: u.disabled,
|
|
311
|
+
readonly: u.readonly,
|
|
268
312
|
class: "bg-transparent outline-none flex-1 min-w-0",
|
|
269
313
|
onKeydown: [
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
t[4] || (t[4] =
|
|
277
|
-
t[5] || (t[5] =
|
|
278
|
-
t[6] || (t[6] =
|
|
279
|
-
t[7] || (t[7] =
|
|
280
|
-
|
|
314
|
+
f(s(pe, ["exact"]), ["delete"]),
|
|
315
|
+
f(s(ye, ["exact", "meta"]), ["a"]),
|
|
316
|
+
f(s(ke, ["exact"]), ["enter"]),
|
|
317
|
+
f(s(we, ["exact"]), ["space"]),
|
|
318
|
+
f(s(he, ["exact"]), ["arrow-up"]),
|
|
319
|
+
f(s(xe, ["exact"]), ["arrow-down"]),
|
|
320
|
+
t[4] || (t[4] = f(s((l) => te(), ["exact"]), ["arrow-left"])),
|
|
321
|
+
t[5] || (t[5] = f(s((l) => te(!0), ["exact", "shift"]), ["arrow-left"])),
|
|
322
|
+
t[6] || (t[6] = f(s((l) => le(), ["exact"]), ["arrow-right"])),
|
|
323
|
+
t[7] || (t[7] = f(s((l) => le(!0), ["exact", "shift"]), ["arrow-right"])),
|
|
324
|
+
f(Ce, ["esc"])
|
|
281
325
|
],
|
|
282
326
|
onBlur: $e,
|
|
283
327
|
onFocus: Te
|
|
284
328
|
}, null, 40, We), [
|
|
285
|
-
[
|
|
329
|
+
[Ie, a.value]
|
|
286
330
|
])
|
|
287
331
|
])
|
|
288
332
|
], 16)
|
|
289
333
|
]),
|
|
290
|
-
|
|
291
|
-
k(e.$slots, "activity",
|
|
292
|
-
|
|
334
|
+
g("div", He, [
|
|
335
|
+
k(e.$slots, "activity", A(K({ canClear: G.value, clear: oe, isInteractive: m.value })), () => [
|
|
336
|
+
G.value ? (r(), c("button", {
|
|
293
337
|
key: 0,
|
|
294
338
|
type: "button",
|
|
295
339
|
class: "tag-field-clear-button",
|
|
296
|
-
onClick:
|
|
340
|
+
onClick: s(oe, ["stop"])
|
|
297
341
|
}, [
|
|
298
|
-
|
|
299
|
-
])) : (r(),
|
|
342
|
+
N(d(de), { class: "size-[1.25em]" })
|
|
343
|
+
])) : (r(), V(Oe, {
|
|
300
344
|
key: 1,
|
|
301
345
|
name: "tag-field-fade"
|
|
302
346
|
}, {
|
|
303
|
-
default:
|
|
304
|
-
|
|
347
|
+
default: L(() => [
|
|
348
|
+
u.activity && u.indicator ? (r(), V(d(Re), {
|
|
305
349
|
key: "activity",
|
|
306
|
-
type:
|
|
307
|
-
size:
|
|
308
|
-
}, null, 8, ["type", "size"])) :
|
|
350
|
+
type: u.indicator,
|
|
351
|
+
size: u.indicatorSize
|
|
352
|
+
}, null, 8, ["type", "size"])) : x("", !0)
|
|
309
353
|
]),
|
|
310
354
|
_: 1
|
|
311
355
|
}))
|
|
312
356
|
])
|
|
313
357
|
])
|
|
314
358
|
]),
|
|
315
|
-
|
|
316
|
-
e.error || e.errors ? (r(), R(u(Ne), {
|
|
317
|
-
key: 0,
|
|
318
|
-
id: u(E).id,
|
|
319
|
-
name: e.name,
|
|
320
|
-
error: e.error,
|
|
321
|
-
errors: e.errors
|
|
322
|
-
}, {
|
|
323
|
-
default: K(({ error: o }) => [
|
|
324
|
-
f("div", Qe, y(o), 1)
|
|
325
|
-
]),
|
|
326
|
-
_: 1
|
|
327
|
-
}, 8, ["id", "name", "error", "errors"])) : h("", !0)
|
|
328
|
-
]),
|
|
329
|
-
k(e.$slots, "feedback", F(A({ feedback: e.feedback })), () => [
|
|
330
|
-
S(u(je), { feedback: e.feedback }, {
|
|
331
|
-
default: K(({ feedback: o }) => [
|
|
332
|
-
f("div", Xe, y(o), 1)
|
|
333
|
-
]),
|
|
334
|
-
_: 1
|
|
335
|
-
}, 8, ["feedback"])
|
|
336
|
-
]),
|
|
337
|
-
k(e.$slots, "help", F(A({ helpText: e.helpText })), () => [
|
|
338
|
-
e.helpText ? (r(), d("small", Ye, y(e.helpText), 1)) : h("", !0)
|
|
339
|
-
]),
|
|
340
|
-
fe.value ? (r(), d("div", {
|
|
359
|
+
me.value ? (r(), c("div", {
|
|
341
360
|
key: 0,
|
|
342
361
|
tabindex: "-1",
|
|
343
|
-
class: "tag-field-dropdown",
|
|
344
|
-
onMousedown: t[11] || (t[11] =
|
|
362
|
+
class: F(["tag-field-dropdown", o.size]),
|
|
363
|
+
onMousedown: t[11] || (t[11] = s(() => {
|
|
345
364
|
}, ["prevent", "stop"]))
|
|
346
365
|
}, [
|
|
347
|
-
(r(!0),
|
|
348
|
-
key: `option-${JSON.stringify(
|
|
366
|
+
(r(!0), c(se, null, re(b.value, (l, p) => (r(), c("button", {
|
|
367
|
+
key: `option-${JSON.stringify(l)}`,
|
|
349
368
|
type: "button",
|
|
350
369
|
tabindex: "-1",
|
|
351
|
-
class:
|
|
352
|
-
"bg-neutral-100 dark:bg-neutral-800": i.value ===
|
|
370
|
+
class: F({
|
|
371
|
+
"bg-neutral-100 dark:bg-neutral-800": i.value === p
|
|
353
372
|
}),
|
|
354
|
-
onMousedown: t[9] || (t[9] =
|
|
373
|
+
onMousedown: t[9] || (t[9] = s(() => {
|
|
355
374
|
}, ["prevent"])),
|
|
356
|
-
onMouseup: (w) =>
|
|
375
|
+
onMouseup: (w) => E(l)
|
|
357
376
|
}, [
|
|
358
|
-
|
|
359
|
-
], 42,
|
|
360
|
-
|
|
377
|
+
g("div", Xe, h(o.display?.(l) ?? l), 1)
|
|
378
|
+
], 42, Qe))), 128)),
|
|
379
|
+
o.allowCustom && a.value ? (r(), c("button", {
|
|
361
380
|
key: 0,
|
|
362
381
|
class: "flex items-center gap-1",
|
|
363
382
|
type: "button",
|
|
364
|
-
onMousedown: t[10] || (t[10] =
|
|
383
|
+
onMousedown: t[10] || (t[10] = s(() => {
|
|
365
384
|
}, ["prevent"])),
|
|
366
|
-
onMouseup:
|
|
385
|
+
onMouseup: Be
|
|
367
386
|
}, [
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
], 32)) :
|
|
371
|
-
|
|
372
|
-
k(e.$slots, "no-results", { input:
|
|
373
|
-
|
|
387
|
+
N(d(Ue), { class: "size-4" }),
|
|
388
|
+
Q(" " + h(o.addTagLabel), 1)
|
|
389
|
+
], 32)) : x("", !0),
|
|
390
|
+
o.showNoResults && !b.value.length && !o.allowCustom ? (r(), c("div", Ye, [
|
|
391
|
+
k(e.$slots, "no-results", { input: a.value }, () => [
|
|
392
|
+
Q(h(o.noResultsText), 1)
|
|
374
393
|
])
|
|
375
|
-
])) :
|
|
376
|
-
],
|
|
394
|
+
])) : x("", !0)
|
|
395
|
+
], 34)) : x("", !0),
|
|
396
|
+
k(e.$slots, "errors", A(K({ error: o.error, errors: o.errors, id: e.$attrs.id, name: e.$attrs.name })), () => [
|
|
397
|
+
o.error || o.errors ? (r(), V(d(De), {
|
|
398
|
+
key: 0,
|
|
399
|
+
id: o.id,
|
|
400
|
+
name: o.name,
|
|
401
|
+
error: o.error,
|
|
402
|
+
errors: o.errors
|
|
403
|
+
}, {
|
|
404
|
+
default: L(({ error: l }) => [
|
|
405
|
+
g("div", Ze, h(l), 1)
|
|
406
|
+
]),
|
|
407
|
+
_: 1
|
|
408
|
+
}, 8, ["id", "name", "error", "errors"])) : x("", !0)
|
|
409
|
+
]),
|
|
410
|
+
k(e.$slots, "feedback", A(K({ feedback: o.feedback })), () => [
|
|
411
|
+
N(d(je), { feedback: o.feedback }, {
|
|
412
|
+
default: L(({ feedback: l }) => [
|
|
413
|
+
g("div", _e, h(l), 1)
|
|
414
|
+
]),
|
|
415
|
+
_: 1
|
|
416
|
+
}, 8, ["feedback"])
|
|
417
|
+
]),
|
|
418
|
+
k(e.$slots, "help", A(K({ helpText: o.helpText })), () => [
|
|
419
|
+
o.helpText ? (r(), c("small", et, h(o.helpText), 1)) : x("", !0)
|
|
420
|
+
])
|
|
377
421
|
], 2));
|
|
378
422
|
}
|
|
379
423
|
});
|
package/dist/tag-field.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag-field.js","sources":["../../../node_modules/.pnpm/@heroicons+vue@2.2.0_vue@3.5.27_typescript@5.9.3_/node_modules/@heroicons/vue/24/outline/esm/PlusIcon.js","../../../node_modules/.pnpm/@heroicons+vue@2.2.0_vue@3.5.27_typescript@5.9.3_/node_modules/@heroicons/vue/24/outline/esm/XMarkIcon.js","../src/TagField.vue"],"sourcesContent":["import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nexport default function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n \"stroke-width\": \"1.5\",\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\"\n }, [\n _createElementVNode(\"path\", {\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n d: \"M12 4.5v15m7.5-7.5h-15\"\n })\n ]))\n}","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nexport default function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n \"stroke-width\": \"1.5\",\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\"\n }, [\n _createElementVNode(\"path\", {\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n d: \"M6 18 18 6M6 6l12 12\"\n })\n ]))\n}","<script setup lang=\"ts\" generic=\"T, Value\">\nimport { PlusIcon, XMarkIcon } from '@heroicons/vue/24/outline';\nimport { ActivityIndicator } from '@vue-interface/activity-indicator';\nimport { Badge } from '@vue-interface/badge';\nimport type { FormControlEvents, FormControlProps, FormControlSlots } from '@vue-interface/form-control';\nimport { FormControlErrors, FormControlFeedback, useFormControl } from '@vue-interface/form-control';\nimport type { IFuseOptions } from 'fuse.js';\nimport Fuse from 'fuse.js';\nimport { isEqual } from 'lodash-es';\nimport { type HTMLAttributes, computed, onBeforeMount, onBeforeUnmount, ref, toRaw, unref, useTemplateRef, watch, type Ref } from 'vue';\n\nexport type TagFieldSizePrefix = 'form-control';\n\nexport type TagFieldProps<T, Value> = /* @vue-ignore */ FormControlProps<\n HTMLAttributes,\n TagFieldSizePrefix,\n T[],\n Value[]\n> & {\n options?: T[];\n fuseOptions?: IFuseOptions<T>;\n display?: (option: T) => string;\n format?: (value: string) => T;\n allowCustom?: boolean;\n addTagLabel?: string;\n noResultsText?: string;\n showNoResults?: boolean;\n clearable?: boolean;\n};\n\nconst props = withDefaults(defineProps<TagFieldProps<T, Value>>(), {\n formControlClass: 'form-control',\n labelClass: 'form-label',\n size: 'form-control-md',\n allowCustom: false,\n addTagLabel: 'Add Tag',\n noResultsText: 'No results found',\n showNoResults: true,\n clearable: false,\n options: () => [],\n});\n\ndefineOptions({\n inheritAttrs: false\n});\n\nconst model = defineModel<T[]>();\n\ndefineSlots<FormControlSlots<TagFieldSizePrefix, T[]> & {\n default(props: { option: T; display?: (option: T) => string }): any;\n 'no-results'(props: { input: string | undefined }): any;\n}>();\n\nconst emit = defineEmits<FormControlEvents>();\n\nconst {\n controlAttributes,\n formGroupClasses,\n listeners\n} = useFormControl<HTMLAttributes, TagFieldSizePrefix, T[]|undefined, Value[]>({ model, props, emit });\n\nconst wrapperEl = useTemplateRef('wrapperEl');\nconst inputEl = useTemplateRef('inputEl');\nconst tagEl = useTemplateRef('tagEl');\n\nconst input = ref<string>();\nconst selected = ref<T[]>([]) as Ref<T[]>;\nconst hasFocus = ref(false);\nconst focusIndex = ref<number>();\nconst options = ref(props.options) as Ref<T[]>;\n\nconst isInteractive = computed(() => !props.disabled && !props.readonly);\n\nconst canClear = computed(() => {\n return props.clearable && (!!input.value || !!model.value?.length) && isInteractive.value;\n});\n\nconst keys = computed(() => {\n return typeof props.options === 'object' && props.options?.[0]\n ? Object.keys(props.options?.[0])\n : [];\n});\n\nconst fuse: Fuse<T> = createFuse(props.options);\n\nconst showOptions = computed(() => {\n return hasFocus.value && (filtered.value.length || input.value);\n});\n\nconst selectedIndexes = computed(() => {\n return selected.value.map(tag => {\n return (model.value ?? []).findIndex(item => isEqual(item, tag));\n });\n});\n\nwatch(() => props.options, () => {\n options.value = props.options;\n});\n\nwatch(input, () => {\n hasFocus.value = true;\n focusIndex.value = undefined;\n\n deactivateTags();\n});\n\nfunction createFuse(items: T[]) {\n return new Fuse(items, props.fuseOptions ?? {\n includeScore: true,\n threshold: .45,\n keys: keys.value\n });\n}\n\nconst filtered = computed<T[]>(() => {\n const items = options.value.filter(option => {\n return !(model.value ?? []).find(item => {\n return isEqual(item, toRaw(unref(option)));\n });\n });\n\n if(!input.value) {\n return items;\n }\n\n fuse.setCollection(items as T[]);\n\n return fuse.search(input.value).map(({ item }) => item);\n});\n\nfunction addCustomTag(value: string) {\n const tag = props.format?.(value) ?? value as T;\n\n if(!options.value.find(option => isEqual(option, tag))) {\n options.value.push(tag);\n\n addTag(tag);\n\n input.value = undefined;\n }\n}\n\nfunction addTag(tag: T) {\n model.value = [...(model.value ?? []), tag];\n input.value = undefined;\n focusIndex.value = undefined;\n}\n\nfunction removeTag(tag: T) {\n const value = [...(model.value ?? [])];\n\n value.splice(value.indexOf(tag), 1);\n\n deactivateTag(tag);\n\n model.value = value;\n}\n\nfunction toggleActiveTag(tag: T, multiple = false) {\n if(!multiple) {\n deactivateTags(tag);\n }\n\n if(!isTagActive(tag)) {\n activateTag(tag);\n }\n else {\n deactivateTag(tag);\n }\n}\n\nfunction toggleActiveTagRange(tag: T) {\n const items = model.value ?? [];\n const index = items.indexOf(tag);\n const lastSelectedIndex = selectedIndexes.value[selectedIndexes.value.length - 1];\n const fn = !isTagActive(tag) ? activateTag : deactivateTag;\n\n if(lastSelectedIndex === undefined) {\n toggleActiveTag(tag);\n\n return;\n }\n\n let range: T[] = [];\n\n if(index > lastSelectedIndex) {\n range = items.slice(lastSelectedIndex, index + 1);\n }\n else if(index < lastSelectedIndex) {\n range = items.slice(index, lastSelectedIndex + 1);\n }\n\n for(const tag of range) {\n fn(tag);\n }\n}\n\nfunction selectAllTags() {\n if(input.value) {\n return;\n }\n\n selected.value = [...(model.value ?? [])];\n}\n\nfunction deactivateTags(omit?: T) {\n if(!omit) {\n selected.value = [];\n }\n else {\n const tags = selected.value.filter(\n item => !isEqual(item, omit)\n );\n\n for(const tag of tags) {\n deactivateTag(tag);\n }\n }\n\n blurTags();\n}\n\nfunction blurTags() {\n if(!tagEl.value) {\n return;\n }\n\n for(const tag of tagEl.value) {\n (tag?.$el as HTMLElement | undefined)?.blur();\n }\n}\n\nfunction isTagActive(tag: T) {\n return !!selected.value.find(item => isEqual(item, tag));\n}\n\nfunction activateTag(tag: T) {\n if(!isTagActive(tag)) {\n selected.value.push(tag);\n }\n}\n\nfunction deactivateTag(tag: T) {\n if(isTagActive(tag)) {\n selected.value.splice(selected.value.indexOf(tag), 1);\n }\n\n blurTags();\n}\n\nfunction removeActiveTags() {\n model.value = (model.value ?? []).filter(tag => {\n return !isTagActive(tag);\n });\n\n selected.value = [];\n}\n\nfunction onBackspace() {\n inputEl.value?.focus();\n\n if(input.value) {\n return;\n }\n\n if(selected.value.length) {\n removeActiveTags();\n }\n else if(model.value?.length) {\n removeTag(model.value[model.value.length - 1]);\n }\n}\n\nfunction onKeydownEnter(e: KeyboardEvent) {\n if(focusIndex.value !== undefined) {\n addTag(filtered.value[focusIndex.value]);\n }\n else if(filtered.value.length) {\n addTag(filtered.value[0]);\n }\n else if(props.allowCustom && input.value) {\n addCustomTag(input.value);\n }\n\n e.preventDefault();\n}\n\nfunction onKeydownSpace(e: KeyboardEvent) {\n if(focusIndex.value === undefined) {\n return;\n }\n\n addTag(filtered.value[focusIndex.value]);\n\n e.preventDefault();\n}\n\nfunction onKeydownUp() {\n if(!focusIndex.value) {\n focusIndex.value = filtered.value.length - 1;\n }\n else {\n focusIndex.value--;\n }\n}\n\nfunction onKeydownDown() {\n if(focusIndex.value === undefined || focusIndex.value === filtered.value.length - 1) {\n focusIndex.value = 0;\n }\n else {\n focusIndex.value++;\n }\n}\n\nfunction onKeydownLeft(multiple: boolean = false) {\n if(!model.value?.length || input.value) {\n return;\n }\n\n const nextIndex = Math.min(...selectedIndexes.value, model.value.length) - 1;\n\n if(model.value[nextIndex]) {\n toggleActiveTag(model.value[nextIndex], multiple);\n }\n else {\n deactivateTags();\n }\n}\n\nfunction onKeydownRight(multiple: boolean = false) {\n if(!model.value?.length || input.value) {\n return;\n }\n\n const nextIndex = Math.max(...selectedIndexes.value, -1) + 1;\n\n if(model.value[nextIndex]) {\n toggleActiveTag(model.value[nextIndex], multiple);\n }\n else {\n deactivateTags();\n }\n}\n\nfunction onEscape() {\n if(hasFocus.value) {\n hasFocus.value = false;\n }\n else {\n deactivateTags();\n }\n}\n\nfunction onBlur() {\n if(props.allowCustom && input.value) {\n addCustomTag(input.value);\n }\n\n hasFocus.value = false;\n\n deactivateTags();\n}\n\nfunction onFocus() {\n hasFocus.value = true;\n\n deactivateTags();\n}\n\nfunction onClickAddTag() {\n if(input.value) {\n addCustomTag(input.value);\n }\n}\n\nfunction clear() {\n if (!isInteractive.value) return;\n input.value = undefined;\n model.value = [];\n}\n\nfunction onClickOutsideWrapper(e: MouseEvent) {\n if(!e.target) {\n return;\n }\n\n if(!(wrapperEl.value == e.target || wrapperEl.value?.contains(e.target as Element))) {\n deactivateTags();\n }\n}\n\nfunction onDocumentKeydown(e: KeyboardEvent) {\n switch (e.key) {\n case 'Backspace':\n if(selected.value.length) {\n removeActiveTags();\n e.preventDefault();\n }\n break;\n case 'Escape':\n if(!hasFocus.value) {\n deactivateTags();\n }\n }\n}\n\nonBeforeMount(() => {\n document.addEventListener('click', onClickOutsideWrapper);\n document.addEventListener('keydown', onDocumentKeydown);\n});\n\nonBeforeUnmount(() => {\n document.removeEventListener('click', onClickOutsideWrapper);\n document.removeEventListener('keydown', onDocumentKeydown);\n});\n</script>\n\n<template>\n <div\n ref=\"wrapperEl\"\n class=\"tag-field\"\n :class=\"[formGroupClasses, { 'has-clear-button': canClear }]\">\n <slot name=\"label\">\n <label\n v-if=\"label\"\n :class=\"labelClass\"\n :for=\"controlAttributes.id\">\n {{ label }}\n </label>\n </slot>\n\n <div class=\"form-control-inner\">\n <slot\n name=\"control\"\n v-bind=\"{ controlAttributes, listeners }\">\n <div\n v-if=\"$slots.icon\"\n class=\"form-control-inner-icon\"\n @click=\"inputEl?.focus()\">\n <slot name=\"icon\" />\n </div>\n <div\n v-bind=\"controlAttributes\"\n class=\"form-control flex\"\n @click.self=\"inputEl?.focus()\">\n <div class=\"flex flex-wrap gap-2 mr-2 flex-1\">\n <Badge\n v-for=\"(tag, i) in model\"\n ref=\"tagEl\"\n :key=\"`tag-${i}`\"\n tabindex=\"-1\"\n size=\"badge-[.95em]\"\n class=\"badge-neutral-100 dark:badge-neutral-500\"\n :class=\"{\n 'badge-blue-600!': isTagActive(tag),\n }\"\n closeable\n @mousedown.prevent\n @close=\"removeTag(tag)\"\n @focus=\"toggleActiveTag(tag)\"\n @blur=\"deactivateTag(tag)\"\n @click.exact.meta=\"toggleActiveTag(tag, true)\"\n @click.exact=\"toggleActiveTag(tag)\"\n @click.exact.shift=\"toggleActiveTagRange(tag)\">\n <slot :option=\"tag\" :display=\"display\">\n {{ display?.(tag) ?? tag }}\n </slot>\n <template #close-icon>\n <XMarkIcon class=\"size-[1.25em]\" @mousedown.prevent />\n </template>\n </Badge>\n\n <input\n ref=\"inputEl\"\n v-model=\"input\"\n :placeholder=\"placeholder\"\n class=\"bg-transparent outline-none flex-1 min-w-0\"\n @keydown.exact.delete=\"onBackspace\"\n @keydown.exact.meta.a=\"selectAllTags\"\n @keydown.exact.enter=\"onKeydownEnter\"\n @keydown.exact.space=\"onKeydownSpace\"\n @keydown.exact.arrow-up=\"onKeydownUp\"\n @keydown.exact.arrow-down=\"onKeydownDown\"\n @keydown.exact.arrow-left=\"onKeydownLeft()\"\n @keydown.exact.shift.arrow-left=\"onKeydownLeft(true)\"\n @keydown.exact.arrow-right=\"onKeydownRight()\"\n @keydown.exact.shift.arrow-right=\"onKeydownRight(true)\"\n @keydown.esc=\"onEscape\"\n @blur=\"onBlur\"\n @focus=\"onFocus\">\n </div>\n </div>\n </slot>\n\n <div class=\"form-control-activity-indicator\">\n <slot name=\"activity\" v-bind=\"{ canClear, clear, isInteractive }\">\n <button\n v-if=\"canClear\"\n type=\"button\"\n class=\"tag-field-clear-button\"\n @click.stop=\"clear\">\n <XMarkIcon class=\"size-[1.25em]\" />\n </button>\n <Transition name=\"tag-field-fade\" v-else>\n <ActivityIndicator\n v-if=\"activity && indicator\"\n key=\"activity\"\n :type=\"indicator\"\n :size=\"indicatorSize\" />\n </Transition>\n </slot>\n </div>\n </div>\n\n <slot\n name=\"errors\"\n v-bind=\"{ error, errors, id: controlAttributes.id, name }\">\n <FormControlErrors\n v-if=\"!!(error || errors)\"\n :id=\"controlAttributes.id\"\n v-slot=\"{ error: err }\"\n :name=\"name\"\n :error=\"error\"\n :errors=\"errors\">\n <div\n invalid\n class=\"invalid-feedback\">\n {{ err }}\n </div>\n </FormControlErrors>\n </slot>\n\n <slot\n name=\"feedback\"\n v-bind=\"{ feedback }\">\n <FormControlFeedback\n v-slot=\"{ feedback: fb }\"\n :feedback=\"feedback\">\n <div\n valid\n class=\"valid-feedback\">\n {{ fb }}\n </div>\n </FormControlFeedback>\n </slot>\n\n <slot\n name=\"help\"\n v-bind=\"{ helpText }\">\n <small\n v-if=\"helpText\"\n class=\"form-help\">\n {{ helpText }}\n </small>\n </slot>\n\n <div\n v-if=\"showOptions\"\n tabindex=\"-1\"\n class=\"tag-field-dropdown\"\n @mousedown.prevent.stop>\n <button\n v-for=\"(option, i) in filtered\"\n :key=\"`option-${JSON.stringify(option)}`\"\n type=\"button\"\n tabindex=\"-1\"\n :class=\"{\n ['bg-neutral-100 dark:bg-neutral-800']: focusIndex === i\n }\"\n @mousedown.prevent\n @mouseup=\"addTag(option)\">\n <div class=\"truncate\">\n {{ display?.(option) ?? option }}\n </div>\n </button>\n <button\n v-if=\"allowCustom && input\"\n class=\"flex items-center gap-1\"\n type=\"button\"\n @mousedown.prevent\n @mouseup=\"onClickAddTag\">\n <PlusIcon class=\"size-4\" /> {{ addTagLabel }}\n </button>\n <div\n v-if=\"showNoResults && !filtered.length && !allowCustom\"\n class=\"py-2 px-4 text-neutral-400 dark:text-neutral-500\">\n <slot name=\"no-results\" :input=\"input\">\n {{ noResultsText }}\n </slot>\n </div>\n </div>\n </div>\n</template>\n"],"names":["render","_ctx","_cache","_openBlock","_createElementBlock","_createElementVNode","props","__props","model","_useModel","emit","__emit","controlAttributes","formGroupClasses","listeners","useFormControl","wrapperEl","useTemplateRef","inputEl","tagEl","input","ref","selected","hasFocus","focusIndex","options","isInteractive","computed","canClear","keys","fuse","createFuse","showOptions","filtered","selectedIndexes","tag","item","isEqual","watch","deactivateTags","items","Fuse","option","toRaw","unref","addCustomTag","value","addTag","removeTag","deactivateTag","toggleActiveTag","multiple","isTagActive","activateTag","toggleActiveTagRange","index","lastSelectedIndex","fn","range","selectAllTags","omit","tags","blurTags","removeActiveTags","onBackspace","onKeydownEnter","onKeydownSpace","onKeydownUp","onKeydownDown","onKeydownLeft","nextIndex","onKeydownRight","onEscape","onBlur","onFocus","onClickAddTag","clear","onClickOutsideWrapper","onDocumentKeydown","onBeforeMount","onBeforeUnmount","_normalizeClass","_unref","_renderSlot","label","labelClass","_hoisted_1","_hoisted_2","_normalizeProps","_guardReactiveProps","$slots","$event","_mergeProps","_withModifiers","_hoisted_3","_Fragment","_renderList","i","_createBlock","Badge","_createVNode","XMarkIcon","display","placeholder","_hoisted_5","_Transition","activity","indicator","ActivityIndicator","indicatorSize","error","errors","name","FormControlErrors","_withCtx","err","_hoisted_6","_toDisplayString","feedback","FormControlFeedback","fb","_hoisted_7","helpText","_hoisted_8","_hoisted_10","allowCustom","PlusIcon","_createTextVNode","addTagLabel","showNoResults","_hoisted_11","noResultsText"],"mappings":";;;;;;AAEe,SAASA,GAAOC,GAAMC,GAAQ;AAC3C,SAAQC,EAAU,GAAIC,EAAoB,OAAO;AAAA,IAC/C,OAAO;AAAA,IACP,MAAM;AA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AAA,QAAA;QAI5BmF,EAAAA,eAAezG,EAAA,cADzBhB,EAOS,UAAA;AAAA;UALL,OAAM;AAAA,UACN,MAAK;AAAA,UACJ,iCAAD,MAAA;AAAA,UAAA,GAAkB,CAAA,SAAA,CAAA;AAAA,UACjB,WAASuE;AAAA,QAAA;UACVyB,EAA2BlB,EAAA4C,EAAA,GAAA,EAAjB,OAAM,UAAQ;AAAA,UAAGC,EAAA,QAAIC,EAAAA,WAAW,GAAA,CAAA;AAAA,QAAA;QAGpCC,EAAAA,iBAAa,CAAKhG,EAAA,MAAS,WAAW4F,EAAAA,eADhD1H,EAAA,GAAAC,EAMM,OANN8H,IAMM;AAAA,UAHF/C,EAEOlF,EAAA,QAAA,cAAA,EAFkB,OAAOmB,EAAA,MAAA,GAAhC,MAEO;AAAA,gBADA+G,EAAAA,aAAa,GAAA,CAAA;AAAA,UAAA;;;;;;","x_google_ignoreList":[0,1]}
|
|
1
|
+
{"version":3,"file":"tag-field.js","sources":["../../../node_modules/.pnpm/@heroicons+vue@2.2.0_vue@3.5.27_typescript@5.9.3_/node_modules/@heroicons/vue/24/outline/esm/PlusIcon.js","../../../node_modules/.pnpm/@heroicons+vue@2.2.0_vue@3.5.27_typescript@5.9.3_/node_modules/@heroicons/vue/24/outline/esm/XMarkIcon.js","../src/TagField.vue"],"sourcesContent":["import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nexport default function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n \"stroke-width\": \"1.5\",\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\"\n }, [\n _createElementVNode(\"path\", {\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n d: \"M12 4.5v15m7.5-7.5h-15\"\n })\n ]))\n}","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nexport default function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n \"stroke-width\": \"1.5\",\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\"\n }, [\n _createElementVNode(\"path\", {\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n d: \"M6 18 18 6M6 6l12 12\"\n })\n ]))\n}","<script setup lang=\"ts\" generic=\"ModelValue, Value\">\nimport { PlusIcon, XMarkIcon } from '@heroicons/vue/24/outline';\nimport { ActivityIndicator } from '@vue-interface/activity-indicator';\nimport { Badge, type BadgeSize } from '@vue-interface/badge';\nimport type { FormControlEvents, FormControlProps, FormControlSlots } from '@vue-interface/form-control';\nimport { FormControlErrors, FormControlFeedback, useFormControl } from '@vue-interface/form-control';\nimport type { IFuseOptions } from 'fuse.js';\nimport Fuse from 'fuse.js';\nimport { isEqual } from 'lodash-es';\nimport { type HTMLAttributes, computed, onBeforeMount, onBeforeUnmount, ref, toRaw, unref, useTemplateRef, watch, type Ref } from 'vue';\n\nexport type TagFieldSizePrefix = 'form-control';\n\nexport type TagFieldProps<ModelValue, Value> = FormControlProps<\n HTMLAttributes,\n TagFieldSizePrefix,\n ModelValue[],\n Value[]\n> & {\n options?: ModelValue[];\n fuseOptions?: IFuseOptions<ModelValue>;\n display?: (option: ModelValue) => string;\n format?: (value: string) => ModelValue;\n allowCustom?: boolean;\n addTagLabel?: string;\n noResultsText?: string;\n showNoResults?: boolean;\n clearable?: boolean;\n badgeClass?: string | string[] | Record<string, boolean>;\n activeBadgeColor?: string | string[] | Record<string, boolean>;\n badgeSize?: BadgeSize;\n badgeCloseable?: boolean;\n badgeCloseLeft?: boolean;\n};\n\nconst props = withDefaults(defineProps<TagFieldProps<ModelValue, Value>>(), {\n formControlClass: 'form-control',\n labelClass: 'form-label',\n size: 'form-control-md',\n allowCustom: false,\n addTagLabel: 'Add Tag',\n noResultsText: 'No results found',\n showNoResults: true,\n clearable: false,\n options: () => [],\n badgeClass: 'badge-neutral-100 dark:badge-neutral-500',\n activeBadgeColor: 'badge-blue-100! dark:badge-blue-600!',\n badgeSize: 'badge-[.95em]',\n badgeCloseable: true,\n badgeCloseLeft: false,\n});\n\ndefineOptions({\n inheritAttrs: false\n});\n\nconst model = defineModel<ModelValue[]>();\n\ndefineSlots<FormControlSlots<TagFieldSizePrefix, ModelValue[]> & {\n default(props: { option: ModelValue; display?: (option: ModelValue) => string }): any;\n 'no-results'(props: { input: string | undefined }): any;\n}>();\n\nconst emit = defineEmits<FormControlEvents>();\n\nconst {\n controlAttributes,\n formGroupClasses,\n listeners\n} = useFormControl<HTMLAttributes, TagFieldSizePrefix, ModelValue[]|undefined, Value[]>({ model, props, emit });\n\nconst wrapperEl = useTemplateRef('wrapperEl');\nconst inputEl = useTemplateRef('inputEl');\nconst tagEl = useTemplateRef('tagEl');\n\nconst input = ref<string>();\nconst selected = ref<ModelValue[]>([]) as Ref<ModelValue[]>;\nconst hasFocus = ref(false);\nconst focusIndex = ref<number>();\nconst options = ref(props.options) as Ref<ModelValue[]>;\n\nconst isInteractive = computed(() => !props.disabled && !props.readonly);\n\nconst canClear = computed(() => {\n return props.clearable && (!!input.value || !!model.value?.length) && isInteractive.value;\n});\n\nconst keys = computed(() => {\n return typeof props.options === 'object' && props.options?.[0]\n ? Object.keys(props.options?.[0])\n : [];\n});\n\nconst fuse: Fuse<ModelValue> = createFuse(props.options);\n\nconst showOptions = computed(() => {\n return isInteractive.value && hasFocus.value && (filtered.value.length || input.value);\n});\n\nconst selectedIndexes = computed(() => {\n return selected.value.map(tag => {\n return (model.value ?? []).findIndex(item => isEqual(item, tag));\n });\n});\n\nwatch(() => props.options, () => {\n options.value = props.options;\n});\n\nwatch(input, () => {\n hasFocus.value = true;\n focusIndex.value = undefined;\n\n deactivateTags();\n});\n\nfunction createFuse(items: ModelValue[]) {\n return new Fuse(items, props.fuseOptions ?? {\n includeScore: true,\n threshold: .45,\n keys: keys.value\n });\n}\n\nconst filtered = computed<ModelValue[]>(() => {\n const items = options.value.filter(option => {\n return !(model.value ?? []).find(item => {\n return isEqual(item, toRaw(unref(option)));\n });\n });\n\n if(!input.value) {\n return items;\n }\n\n fuse.setCollection(items as ModelValue[]);\n\n return fuse.search(input.value).map(({ item }) => item);\n});\n\nfunction addCustomTag(value: string) {\n if(!isInteractive.value) return;\n\n const tag = props.format?.(value) ?? value as ModelValue;\n\n if(!options.value.find(option => isEqual(option, tag))) {\n options.value.push(tag);\n\n addTag(tag);\n\n input.value = undefined;\n }\n}\n\nfunction addTag(tag: ModelValue) {\n if(!isInteractive.value) return;\n\n model.value = [...(model.value ?? []), tag];\n input.value = undefined;\n focusIndex.value = undefined;\n}\n\nfunction removeTag(tag: ModelValue) {\n if(!isInteractive.value) return;\n\n const value = [...(model.value ?? [])];\n\n value.splice(value.indexOf(tag), 1);\n\n deactivateTag(tag);\n\n model.value = value;\n}\n\nfunction toggleActiveTag(tag: ModelValue, multiple = false) {\n if(!isInteractive.value) return;\n\n if(!multiple) {\n deactivateTags(tag);\n }\n\n if(!isTagActive(tag)) {\n activateTag(tag);\n }\n else {\n deactivateTag(tag);\n }\n}\n\nfunction toggleActiveTagRange(tag: ModelValue) {\n if(!isInteractive.value) return;\n\n const items = model.value ?? [];\n const index = items.indexOf(tag);\n const lastSelectedIndex = selectedIndexes.value[selectedIndexes.value.length - 1];\n const fn = !isTagActive(tag) ? activateTag : deactivateTag;\n\n if(lastSelectedIndex === undefined) {\n toggleActiveTag(tag);\n\n return;\n }\n\n let range: ModelValue[] = [];\n\n if(index > lastSelectedIndex) {\n range = items.slice(lastSelectedIndex, index + 1);\n }\n else if(index < lastSelectedIndex) {\n range = items.slice(index, lastSelectedIndex + 1);\n }\n\n for(const tag of range) {\n fn(tag);\n }\n}\n\nfunction selectAllTags() {\n if(input.value) {\n return;\n }\n\n selected.value = [...(model.value ?? [])];\n}\n\nfunction deactivateTags(omit?: ModelValue) {\n if(!omit) {\n selected.value = [];\n }\n else {\n const tags = selected.value.filter(\n item => !isEqual(item, omit)\n );\n\n for(const tag of tags) {\n deactivateTag(tag);\n }\n }\n\n blurTags();\n}\n\nfunction blurTags() {\n if(!tagEl.value) {\n return;\n }\n\n for(const tag of tagEl.value) {\n (tag?.$el as HTMLElement | undefined)?.blur();\n }\n}\n\nfunction isTagActive(tag: ModelValue) {\n return !!selected.value.find(item => isEqual(item, tag));\n}\n\nfunction activateTag(tag: ModelValue) {\n if(!isTagActive(tag)) {\n selected.value.push(tag);\n }\n}\n\nfunction deactivateTag(tag: ModelValue) {\n if(isTagActive(tag)) {\n selected.value.splice(selected.value.indexOf(tag), 1);\n }\n\n blurTags();\n}\n\nfunction removeActiveTags() {\n model.value = (model.value ?? []).filter(tag => {\n return !isTagActive(tag);\n });\n\n selected.value = [];\n}\n\nfunction onBackspace() {\n inputEl.value?.focus();\n\n if(input.value) {\n return;\n }\n\n if(selected.value.length) {\n removeActiveTags();\n }\n else if(model.value?.length) {\n removeTag(model.value[model.value.length - 1]);\n }\n}\n\nfunction onKeydownEnter(e: KeyboardEvent) {\n if(focusIndex.value !== undefined) {\n addTag(filtered.value[focusIndex.value]);\n }\n else if(filtered.value.length) {\n addTag(filtered.value[0]);\n }\n else if(props.allowCustom && input.value) {\n addCustomTag(input.value);\n }\n\n e.preventDefault();\n}\n\nfunction onKeydownSpace(e: KeyboardEvent) {\n if(focusIndex.value === undefined) {\n return;\n }\n\n addTag(filtered.value[focusIndex.value]);\n\n e.preventDefault();\n}\n\nfunction onKeydownUp() {\n if(!focusIndex.value) {\n focusIndex.value = filtered.value.length - 1;\n }\n else {\n focusIndex.value--;\n }\n}\n\nfunction onKeydownDown() {\n if(focusIndex.value === undefined || focusIndex.value === filtered.value.length - 1) {\n focusIndex.value = 0;\n }\n else {\n focusIndex.value++;\n }\n}\n\nfunction onKeydownLeft(multiple: boolean = false) {\n if(!model.value?.length || input.value) {\n return;\n }\n\n const nextIndex = Math.min(...selectedIndexes.value, model.value.length) - 1;\n\n if(model.value[nextIndex]) {\n toggleActiveTag(model.value[nextIndex], multiple);\n }\n else {\n deactivateTags();\n }\n}\n\nfunction onKeydownRight(multiple: boolean = false) {\n if(!model.value?.length || input.value) {\n return;\n }\n\n const nextIndex = Math.max(...selectedIndexes.value, -1) + 1;\n\n if(model.value[nextIndex]) {\n toggleActiveTag(model.value[nextIndex], multiple);\n }\n else {\n deactivateTags();\n }\n}\n\nfunction onEscape() {\n if(hasFocus.value) {\n hasFocus.value = false;\n }\n else {\n deactivateTags();\n }\n}\n\nfunction onBlur(e: FocusEvent) {\n if(props.allowCustom && input.value) {\n addCustomTag(input.value);\n }\n\n hasFocus.value = false;\n\n deactivateTags();\n\n listeners.onBlur(e);\n}\n\nfunction onFocus(e: FocusEvent) {\n hasFocus.value = true;\n\n deactivateTags();\n\n listeners.onFocus(e);\n}\n\nfunction onClickAddTag() {\n if(input.value) {\n addCustomTag(input.value);\n }\n}\n\nfunction clear() {\n if (!isInteractive.value) return;\n input.value = undefined;\n model.value = [];\n}\n\nfunction onClickOutsideWrapper(e: MouseEvent) {\n if(!e.target) {\n return;\n }\n\n if(!(wrapperEl.value == e.target || wrapperEl.value?.contains(e.target as Element))) {\n deactivateTags();\n }\n}\n\nfunction onDocumentKeydown(e: KeyboardEvent) {\n switch (e.key) {\n case 'Backspace':\n if(selected.value.length) {\n removeActiveTags();\n e.preventDefault();\n }\n break;\n case 'Escape':\n if(!hasFocus.value) {\n deactivateTags();\n }\n }\n}\n\nonBeforeMount(() => {\n document.addEventListener('click', onClickOutsideWrapper);\n document.addEventListener('keydown', onDocumentKeydown);\n});\n\nonBeforeUnmount(() => {\n document.removeEventListener('click', onClickOutsideWrapper);\n document.removeEventListener('keydown', onDocumentKeydown);\n});\n</script>\n\n<template>\n <div\n ref=\"wrapperEl\"\n class=\"tag-field\"\n :class=\"[formGroupClasses, { 'has-clear-button': canClear }]\">\n <slot name=\"label\">\n <label\n v-if=\"label\"\n :class=\"labelClass\"\n :for=\"controlAttributes.id\">\n {{ label }}\n </label>\n </slot>\n\n <div class=\"form-control-inner\">\n <slot\n name=\"control\"\n v-bind=\"{ controlAttributes, listeners }\">\n <div\n v-if=\"$slots.icon\"\n class=\"form-control-inner-icon\"\n @click=\"inputEl?.focus()\">\n <slot name=\"icon\" />\n </div>\n <div\n v-bind=\"controlAttributes\"\n class=\"form-control flex\"\n :class=\"$attrs.class\"\n @click.self=\"inputEl?.focus()\">\n <div class=\"flex flex-wrap gap-2 mr-2 flex-1\">\n <Badge\n v-for=\"(tag, i) in model\"\n ref=\"tagEl\"\n :key=\"`tag-${i}`\"\n tabindex=\"-1\"\n :size=\"badgeSize\"\n :class=\"[\n badgeClass,\n { 'pointer-events-none': !isInteractive },\n isTagActive(tag) ? activeBadgeColor : undefined\n ]\"\n :closeable=\"badgeCloseable\"\n :close-left=\"badgeCloseLeft\"\n @mousedown.prevent\n @close=\"removeTag(tag)\"\n @focus=\"toggleActiveTag(tag)\"\n @blur=\"deactivateTag(tag)\"\n @click.exact.meta=\"toggleActiveTag(tag, true)\"\n @click.exact=\"toggleActiveTag(tag)\"\n @click.exact.shift=\"toggleActiveTagRange(tag)\">\n <slot :option=\"tag\" :display=\"display\">\n {{ display?.(tag) ?? tag }}\n </slot>\n <template #close-icon>\n <XMarkIcon class=\"size-[1.25em]\" @mousedown.prevent />\n </template>\n </Badge>\n\n <input\n ref=\"inputEl\"\n v-model=\"input\"\n :placeholder=\"model?.length ? undefined : ($attrs.placeholder as string)\"\n :disabled=\"props.disabled\"\n :readonly=\"props.readonly\"\n class=\"bg-transparent outline-none flex-1 min-w-0\"\n @keydown.exact.delete=\"onBackspace\"\n @keydown.exact.meta.a=\"selectAllTags\"\n @keydown.exact.enter=\"onKeydownEnter\"\n @keydown.exact.space=\"onKeydownSpace\"\n @keydown.exact.arrow-up=\"onKeydownUp\"\n @keydown.exact.arrow-down=\"onKeydownDown\"\n @keydown.exact.arrow-left=\"onKeydownLeft()\"\n @keydown.exact.shift.arrow-left=\"onKeydownLeft(true)\"\n @keydown.exact.arrow-right=\"onKeydownRight()\"\n @keydown.exact.shift.arrow-right=\"onKeydownRight(true)\"\n @keydown.esc=\"onEscape\"\n @blur=\"onBlur\"\n @focus=\"onFocus\">\n </div>\n </div>\n </slot>\n\n <div class=\"form-control-activity-indicator\">\n <slot name=\"activity\" v-bind=\"{ canClear, clear, isInteractive }\">\n <button\n v-if=\"canClear\"\n type=\"button\"\n class=\"tag-field-clear-button\"\n @click.stop=\"clear\">\n <XMarkIcon class=\"size-[1.25em]\" />\n </button>\n <Transition name=\"tag-field-fade\" v-else>\n <ActivityIndicator\n v-if=\"props.activity && props.indicator\"\n key=\"activity\"\n :type=\"props.indicator\"\n :size=\"props.indicatorSize\" />\n </Transition>\n </slot>\n </div>\n </div>\n\n <div\n v-if=\"showOptions\"\n tabindex=\"-1\"\n class=\"tag-field-dropdown\"\n :class=\"size\"\n @mousedown.prevent.stop>\n <button\n v-for=\"(option, i) in filtered\"\n :key=\"`option-${JSON.stringify(option)}`\"\n type=\"button\"\n tabindex=\"-1\"\n :class=\"{\n ['bg-neutral-100 dark:bg-neutral-800']: focusIndex === i\n }\"\n @mousedown.prevent\n @mouseup=\"addTag(option)\">\n <div class=\"truncate\">\n {{ display?.(option) ?? option }}\n </div>\n </button>\n <button\n v-if=\"allowCustom && input\"\n class=\"flex items-center gap-1\"\n type=\"button\"\n @mousedown.prevent\n @mouseup=\"onClickAddTag\">\n <PlusIcon class=\"size-4\" /> {{ addTagLabel }}\n </button>\n <div\n v-if=\"showNoResults && !filtered.length && !allowCustom\"\n class=\"py-2 px-4 text-neutral-400 dark:text-neutral-500\">\n <slot name=\"no-results\" :input=\"input\">\n {{ noResultsText }}\n </slot>\n </div>\n </div>\n\n <slot\n name=\"errors\"\n v-bind=\"{ error, errors, id: $attrs.id, name: $attrs.name }\">\n <FormControlErrors\n v-if=\"!!(error || errors)\"\n :id=\"id\"\n v-slot=\"{ error }\"\n :name=\"name\"\n :error=\"error\"\n :errors=\"errors\">\n <div\n invalid\n class=\"invalid-feedback\">\n {{ error }}\n </div>\n </FormControlErrors>\n </slot>\n\n <slot\n name=\"feedback\"\n v-bind=\"{ feedback }\">\n <FormControlFeedback\n v-slot=\"{ feedback }\"\n :feedback=\"feedback\">\n <div\n valid\n class=\"valid-feedback\">\n {{ feedback }}\n </div>\n </FormControlFeedback>\n </slot>\n\n <slot\n name=\"help\"\n v-bind=\"{ helpText }\">\n <small\n v-if=\"helpText\"\n class=\"form-help\">\n {{ helpText }}\n </small>\n </slot>\n </div>\n</template>\n"],"names":["render","_ctx","_cache","_openBlock","_createElementBlock","_createElementVNode","props","__props","model","_useModel","emit","__emit","controlAttributes","formGroupClasses","listeners","useFormControl","wrapperEl","useTemplateRef","inputEl","tagEl","input","ref","selected","hasFocus","focusIndex","options","isInteractive","computed","canClear","keys","fuse","createFuse","showOptions","filtered","selectedIndexes","tag","item","isEqual","watch","deactivateTags","items","Fuse","option","toRaw","unref","addCustomTag","value","addTag","removeTag","deactivateTag","toggleActiveTag","multiple","isTagActive","activateTag","toggleActiveTagRange","index","lastSelectedIndex","fn","range","selectAllTags","omit","tags","blurTags","removeActiveTags","onBackspace","onKeydownEnter","onKeydownSpace","onKeydownUp","onKeydownDown","onKeydownLeft","nextIndex","onKeydownRight","onEscape","onBlur","onFocus","onClickAddTag","clear","onClickOutsideWrapper","onDocumentKeydown","onBeforeMount","onBeforeUnmount","_normalizeClass","_unref","_renderSlot","_hoisted_1","_hoisted_2","_normalizeProps","_guardReactiveProps","$slots","$event","_mergeProps","$attrs","_withModifiers","_hoisted_3","_Fragment","_renderList","i","_createBlock","Badge","_createVNode","XMarkIcon","_hoisted_5","_Transition","ActivityIndicator","_hoisted_7","_toDisplayString","PlusIcon","_createTextVNode","_hoisted_8","FormControlErrors","_withCtx","error","_hoisted_9","FormControlFeedback","feedback","_hoisted_10","_hoisted_11"],"m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&typeof module<"u"?e(exports,require("vue"),require("@vue-interface/activity-indicator"),require("@vue-interface/badge"),require("@vue-interface/form-control"),require("fuse.js"),require("lodash-es")):typeof define=="function"&&define.amd?define(["exports","vue","@vue-interface/activity-indicator","@vue-interface/badge","@vue-interface/form-control","fuse.js","lodash-es"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s.TagField={},s.Vue,s.VueInterfaceActivityIndicator,s.VueInterfaceBadge,s.VueInterfaceFormControl,s.FuseJs,s.LodashEs))})(this,(function(s,e,U,J,v,G,h){"use strict";function W(B,T){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 4.5v15m7.5-7.5h-15"})])}function z(B,T){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18 18 6M6 6l12 12"})])}const H=["for"],Q={class:"form-control-inner"},X={class:"flex flex-wrap gap-2 mr-2 flex-1"},Y=["placeholder","onKeydown"],Z={class:"form-control-activity-indicator"},_={invalid:"",class:"invalid-feedback"},ee={valid:"",class:"valid-feedback"},te={key:0,class:"form-help"},oe=["onMouseup"],ne={class:"truncate"},re={key:1,class:"py-2 px-4 text-neutral-400 dark:text-neutral-500"},le=e.defineComponent({inheritAttrs:!1,__name:"TagField",props:{modelValue:{},modelModifiers:{}},emits:e.mergeModels(["blur","focus","focusin","focusout","click","doubleclick","contextmenu","mousedown","mouseup","mouseover","mouseout","mouseenter","mouseleave","mousemove","keydown","keyup","keypress","select","selectionchange","invalid","submit","reset","scroll","wheel","copy","cut","paste","touchstart","touchend","touchmove","touchcancel","change","input","beforeinput"],["update:modelValue"]),setup(B,{emit:T}){const i=B,r=e.useModel(B,"modelValue"),ie=T,{controlAttributes:y,formGroupClasses:ae,listeners:se}=v.useFormControl({model:r,props:i,emit:ie}),V=e.useTemplateRef("wrapperEl"),E=e.useTemplateRef("inputEl"),N=e.useTemplateRef("tagEl"),l=e.ref(),c=e.ref([]),m=e.ref(!1),a=e.ref(),C=e.ref(i.options),$=e.computed(()=>!i.disabled&&!i.readonly),S=e.computed(()=>i.clearable&&(!!l.value||!!r.value?.length)&&$.value),ce=e.computed(()=>typeof i.options=="object"&&i.options?.[0]?Object.keys(i.options?.[0]):[]),F=fe(i.options),de=e.computed(()=>m.value&&(d.value.length||l.value)),M=e.computed(()=>c.value.map(t=>(r.value??[]).findIndex(o=>h.isEqual(o,t))));e.watch(()=>i.options,()=>{C.value=i.options}),e.watch(l,()=>{m.value=!0,a.value=void 0,f()});function fe(t){return new G(t,i.fuseOptions??{includeScore:!0,threshold:.45,keys:ce.value})}const d=e.computed(()=>{const t=C.value.filter(o=>!(r.value??[]).find(n=>h.isEqual(n,e.toRaw(e.unref(o)))));return l.value?(F.setCollection(t),F.search(l.value).map(({item:o})=>o)):t});function x(t){const o=i.format?.(t)??t;C.value.find(n=>h.isEqual(n,o))||(C.value.push(o),g(o),l.value=void 0)}function g(t){r.value=[...r.value??[],t],l.value=void 0,a.value=void 0}function D(t){const o=[...r.value??[]];o.splice(o.indexOf(t),1),b(t),r.value=o}function k(t,o=!1){o||f(t),w(t)?b(t):R(t)}function ue(t){const o=r.value??[],n=o.indexOf(t),u=M.value[M.value.length-1],p=w(t)?b:R;if(u===void 0){k(t);return}let K=[];n>u?K=o.slice(u,n+1):n<u&&(K=o.slice(n,u+1));for(const Ce of K)p(Ce)}function pe(){l.value||(c.value=[...r.value??[]])}function f(t){if(!t)c.value=[];else{const o=c.value.filter(n=>!h.isEqual(n,t));for(const n of o)b(n)}I()}function I(){if(N.value)for(const t of N.value)t?.$el?.blur()}function w(t){return!!c.value.find(o=>h.isEqual(o,t))}function R(t){w(t)||c.value.push(t)}function b(t){w(t)&&c.value.splice(c.value.indexOf(t),1),I()}function P(){r.value=(r.value??[]).filter(t=>!w(t)),c.value=[]}function me(){E.value?.focus(),!l.value&&(c.value.length?P():r.value?.length&&D(r.value[r.value.length-1]))}function ke(t){a.value!==void 0?g(d.value[a.value]):d.value.length?g(d.value[0]):i.allowCustom&&l.value&&x(l.value),t.preventDefault()}function we(t){a.value!==void 0&&(g(d.value[a.value]),t.preventDefault())}function he(){a.value?a.value--:a.value=d.value.length-1}function ye(){a.value===void 0||a.value===d.value.length-1?a.value=0:a.value++}function q(t=!1){if(!r.value?.length||l.value)return;const o=Math.min(...M.value,r.value.length)-1;r.value[o]?k(r.value[o],t):f()}function A(t=!1){if(!r.value?.length||l.value)return;const o=Math.max(...M.value,-1)+1;r.value[o]?k(r.value[o],t):f()}function ge(){m.value?m.value=!1:f()}function be(){i.allowCustom&&l.value&&x(l.value),m.value=!1,f()}function Be(){m.value=!0,f()}function Ee(){l.value&&x(l.value)}function L(){$.value&&(l.value=void 0,r.value=[])}function O(t){t.target&&(V.value==t.target||V.value?.contains(t.target)||f())}function j(t){switch(t.key){case"Backspace":c.value.length&&(P(),t.preventDefault());break;case"Escape":m.value||f()}}return e.onBeforeMount(()=>{document.addEventListener("click",O),document.addEventListener("keydown",j)}),e.onBeforeUnmount(()=>{document.removeEventListener("click",O),document.removeEventListener("keydown",j)}),(t,o)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapperEl",ref:V,class:e.normalizeClass(["tag-field",[e.unref(ae),{"has-clear-button":S.value}]])},[e.renderSlot(t.$slots,"label",{},()=>[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass(t.labelClass),for:e.unref(y).id},e.toDisplayString(t.label),11,H)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Q,[e.renderSlot(t.$slots,"control",e.normalizeProps(e.guardReactiveProps({controlAttributes:e.unref(y),listeners:e.unref(se)})),()=>[t.$slots.icon?(e.openBlock(),e.createElementBlock("div",{key:0,class:"form-control-inner-icon",onClick:o[0]||(o[0]=n=>E.value?.focus())},[e.renderSlot(t.$slots,"icon")])):e.createCommentVNode("",!0),e.createElementVNode("div",e.mergeProps(e.unref(y),{class:"form-control flex",onClick:o[8]||(o[8]=e.withModifiers(n=>E.value?.focus(),["self"]))}),[e.createElementVNode("div",X,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(n,u)=>(e.openBlock(),e.createBlock(e.unref(J.Badge),{ref_for:!0,ref_key:"tagEl",ref:N,key:`tag-${u}`,tabindex:"-1",size:"badge-[.95em]",class:e.normalizeClass(["badge-neutral-100 dark:badge-neutral-500",{"badge-blue-600!":w(n)}]),closeable:"",onMousedown:o[2]||(o[2]=e.withModifiers(()=>{},["prevent"])),onClose:p=>D(n),onFocus:p=>k(n),onBlur:p=>b(n),onClick:[e.withModifiers(p=>k(n,!0),["exact","meta"]),e.withModifiers(p=>k(n),["exact"]),e.withModifiers(p=>ue(n),["exact","shift"])]},{"close-icon":e.withCtx(()=>[e.createVNode(e.unref(z),{class:"size-[1.25em]",onMousedown:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))})]),default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{option:n,display:t.display},()=>[e.createTextVNode(e.toDisplayString(t.display?.(n)??n),1)])]),_:2},1032,["class","onClose","onFocus","onBlur","onClick"]))),128)),e.withDirectives(e.createElementVNode("input",{ref_key:"inputEl",ref:E,"onUpdate:modelValue":o[3]||(o[3]=n=>l.value=n),placeholder:t.placeholder,class:"bg-transparent outline-none flex-1 min-w-0",onKeydown:[e.withKeys(e.withModifiers(me,["exact"]),["delete"]),e.withKeys(e.withModifiers(pe,["exact","meta"]),["a"]),e.withKeys(e.withModifiers(ke,["exact"]),["enter"]),e.withKeys(e.withModifiers(we,["exact"]),["space"]),e.withKeys(e.withModifiers(he,["exact"]),["arrow-up"]),e.withKeys(e.withModifiers(ye,["exact"]),["arrow-down"]),o[4]||(o[4]=e.withKeys(e.withModifiers(n=>q(),["exact"]),["arrow-left"])),o[5]||(o[5]=e.withKeys(e.withModifiers(n=>q(!0),["exact","shift"]),["arrow-left"])),o[6]||(o[6]=e.withKeys(e.withModifiers(n=>A(),["exact"]),["arrow-right"])),o[7]||(o[7]=e.withKeys(e.withModifiers(n=>A(!0),["exact","shift"]),["arrow-right"])),e.withKeys(ge,["esc"])],onBlur:be,onFocus:Be},null,40,Y),[[e.vModelText,l.value]])])],16)]),e.createElementVNode("div",Z,[e.renderSlot(t.$slots,"activity",e.normalizeProps(e.guardReactiveProps({canClear:S.value,clear:L,isInteractive:$.value})),()=>[S.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"tag-field-clear-button",onClick:e.withModifiers(L,["stop"])},[e.createVNode(e.unref(z),{class:"size-[1.25em]"})])):(e.openBlock(),e.createBlock(e.Transition,{key:1,name:"tag-field-fade"},{default:e.withCtx(()=>[t.activity&&t.indicator?(e.openBlock(),e.createBlock(e.unref(U.ActivityIndicator),{key:"activity",type:t.indicator,size:t.indicatorSize},null,8,["type","size"])):e.createCommentVNode("",!0)]),_:1}))])])]),e.renderSlot(t.$slots,"errors",e.normalizeProps(e.guardReactiveProps({error:t.error,errors:t.errors,id:e.unref(y).id,name:t.name})),()=>[t.error||t.errors?(e.openBlock(),e.createBlock(e.unref(v.FormControlErrors),{key:0,id:e.unref(y).id,name:t.name,error:t.error,errors:t.errors},{default:e.withCtx(({error:n})=>[e.createElementVNode("div",_,e.toDisplayString(n),1)]),_:1},8,["id","name","error","errors"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"feedback",e.normalizeProps(e.guardReactiveProps({feedback:t.feedback})),()=>[e.createVNode(e.unref(v.FormControlFeedback),{feedback:t.feedback},{default:e.withCtx(({feedback:n})=>[e.createElementVNode("div",ee,e.toDisplayString(n),1)]),_:1},8,["feedback"])]),e.renderSlot(t.$slots,"help",e.normalizeProps(e.guardReactiveProps({helpText:t.helpText})),()=>[t.helpText?(e.openBlock(),e.createElementBlock("small",te,e.toDisplayString(t.helpText),1)):e.createCommentVNode("",!0)]),de.value?(e.openBlock(),e.createElementBlock("div",{key:0,tabindex:"-1",class:"tag-field-dropdown",onMousedown:o[11]||(o[11]=e.withModifiers(()=>{},["prevent","stop"]))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(n,u)=>(e.openBlock(),e.createElementBlock("button",{key:`option-${JSON.stringify(n)}`,type:"button",tabindex:"-1",class:e.normalizeClass({"bg-neutral-100 dark:bg-neutral-800":a.value===u}),onMousedown:o[9]||(o[9]=e.withModifiers(()=>{},["prevent"])),onMouseup:p=>g(n)},[e.createElementVNode("div",ne,e.toDisplayString(t.display?.(n)??n),1)],42,oe))),128)),t.allowCustom&&l.value?(e.openBlock(),e.createElementBlock("button",{key:0,class:"flex items-center gap-1",type:"button",onMousedown:o[10]||(o[10]=e.withModifiers(()=>{},["prevent"])),onMouseup:Ee},[e.createVNode(e.unref(W),{class:"size-4"}),e.createTextVNode(" "+e.toDisplayString(t.addTagLabel),1)],32)):e.createCommentVNode("",!0),t.showNoResults&&!d.value.length&&!t.allowCustom?(e.openBlock(),e.createElementBlock("div",re,[e.renderSlot(t.$slots,"no-results",{input:l.value},()=>[e.createTextVNode(e.toDisplayString(t.noResultsText),1)])])):e.createCommentVNode("",!0)],32)):e.createCommentVNode("",!0)],2))}});s.TagField=le,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(d,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@vue-interface/activity-indicator"),require("@vue-interface/badge"),require("@vue-interface/form-control"),require("fuse.js"),require("lodash-es")):typeof define=="function"&&define.amd?define(["exports","vue","@vue-interface/activity-indicator","@vue-interface/badge","@vue-interface/form-control","fuse.js","lodash-es"],e):(d=typeof globalThis<"u"?globalThis:d||self,e(d.TagField={},d.Vue,d.VueInterfaceActivityIndicator,d.VueInterfaceBadge,d.VueInterfaceFormControl,d.FuseJs,d.LodashEs))})(this,(function(d,e,J,G,E,W,g){"use strict";function H(n,M){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 4.5v15m7.5-7.5h-15"})])}function F(n,M){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18 18 6M6 6l12 12"})])}const Q=["for"],X={class:"form-control-inner"},Y={class:"flex flex-wrap gap-2 mr-2 flex-1"},Z=["placeholder","disabled","readonly","onKeydown"],_={class:"form-control-activity-indicator"},ee=["onMouseup"],te={class:"truncate"},oe={key:1,class:"py-2 px-4 text-neutral-400 dark:text-neutral-500"},le={invalid:"",class:"invalid-feedback"},ne={valid:"",class:"valid-feedback"},ae={key:0,class:"form-help"},re=e.defineComponent({inheritAttrs:!1,__name:"TagField",props:e.mergeModels({activity:{type:Boolean},disabled:{type:Boolean},error:{},errors:{},feedback:{},formControlClass:{default:"form-control"},helpText:{},id:{},indicator:{},indicatorSize:{},invalid:{type:Boolean},label:{},labelClass:{default:"form-label"},modelValue:{},name:{},plaintext:{type:Boolean},size:{default:"form-control-md"},color:{},readonly:{type:Boolean},valid:{type:Boolean},value:{},options:{default:()=>[]},fuseOptions:{},display:{},format:{},allowCustom:{type:Boolean,default:!1},addTagLabel:{default:"Add Tag"},noResultsText:{default:"No results found"},showNoResults:{type:Boolean,default:!0},clearable:{type:Boolean,default:!1},badgeClass:{default:"badge-neutral-100 dark:badge-neutral-500"},activeBadgeColor:{default:"badge-blue-100! dark:badge-blue-600!"},badgeSize:{default:"badge-[.95em]"},badgeCloseable:{type:Boolean,default:!0},badgeCloseLeft:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["blur","focus","focusin","focusout","click","doubleclick","contextmenu","mousedown","mouseup","mouseover","mouseout","mouseenter","mouseleave","mousemove","keydown","keyup","keypress","select","selectionchange","invalid","submit","reset","scroll","wheel","copy","cut","paste","touchstart","touchend","touchmove","touchcancel","change","input","beforeinput"],["update:modelValue"]),setup(n,{emit:M}){const i=n,a=e.useModel(n,"modelValue"),ie=M,{controlAttributes:T,formGroupClasses:se,listeners:V}=E.useFormControl({model:a,props:i,emit:ie}),$=e.useTemplateRef("wrapperEl"),C=e.useTemplateRef("inputEl"),N=e.useTemplateRef("tagEl"),r=e.ref(),c=e.ref([]),y=e.ref(!1),s=e.ref(),v=e.ref(i.options),f=e.computed(()=>!i.disabled&&!i.readonly),S=e.computed(()=>i.clearable&&(!!r.value||!!a.value?.length)&&f.value),de=e.computed(()=>typeof i.options=="object"&&i.options?.[0]?Object.keys(i.options?.[0]):[]),R=fe(i.options),ce=e.computed(()=>f.value&&y.value&&(u.value.length||r.value)),x=e.computed(()=>c.value.map(t=>(a.value??[]).findIndex(o=>g.isEqual(o,t))));e.watch(()=>i.options,()=>{v.value=i.options}),e.watch(r,()=>{y.value=!0,s.value=void 0,m()});function fe(t){return new W(t,i.fuseOptions??{includeScore:!0,threshold:.45,keys:de.value})}const u=e.computed(()=>{const t=v.value.filter(o=>!(a.value??[]).find(l=>g.isEqual(l,e.toRaw(e.unref(o)))));return r.value?(R.setCollection(t),R.search(r.value).map(({item:o})=>o)):t});function z(t){if(!f.value)return;const o=i.format?.(t)??t;v.value.find(l=>g.isEqual(l,o))||(v.value.push(o),b(o),r.value=void 0)}function b(t){f.value&&(a.value=[...a.value??[],t],r.value=void 0,s.value=void 0)}function D(t){if(!f.value)return;const o=[...a.value??[]];o.splice(o.indexOf(t),1),B(t),a.value=o}function k(t,o=!1){f.value&&(o||m(t),h(t)?B(t):A(t))}function ue(t){if(!f.value)return;const o=a.value??[],l=o.indexOf(t),p=x.value[x.value.length-1],w=h(t)?B:A;if(p===void 0){k(t);return}let K=[];l>p?K=o.slice(p,l+1):l<p&&(K=o.slice(l,p+1));for(const ve of K)w(ve)}function me(){r.value||(c.value=[...a.value??[]])}function m(t){if(!t)c.value=[];else{const o=c.value.filter(l=>!g.isEqual(l,t));for(const l of o)B(l)}I()}function I(){if(N.value)for(const t of N.value)t?.$el?.blur()}function h(t){return!!c.value.find(o=>g.isEqual(o,t))}function A(t){h(t)||c.value.push(t)}function B(t){h(t)&&c.value.splice(c.value.indexOf(t),1),I()}function L(){a.value=(a.value??[]).filter(t=>!h(t)),c.value=[]}function pe(){C.value?.focus(),!r.value&&(c.value.length?L():a.value?.length&&D(a.value[a.value.length-1]))}function we(t){s.value!==void 0?b(u.value[s.value]):u.value.length?b(u.value[0]):i.allowCustom&&r.value&&z(r.value),t.preventDefault()}function ye(t){s.value!==void 0&&(b(u.value[s.value]),t.preventDefault())}function ke(){s.value?s.value--:s.value=u.value.length-1}function he(){s.value===void 0||s.value===u.value.length-1?s.value=0:s.value++}function P(t=!1){if(!a.value?.length||r.value)return;const o=Math.min(...x.value,a.value.length)-1;a.value[o]?k(a.value[o],t):m()}function q(t=!1){if(!a.value?.length||r.value)return;const o=Math.max(...x.value,-1)+1;a.value[o]?k(a.value[o],t):m()}function ge(){y.value?y.value=!1:m()}function be(t){i.allowCustom&&r.value&&z(r.value),y.value=!1,m(),V.onBlur(t)}function Be(t){y.value=!0,m(),V.onFocus(t)}function Ce(){r.value&&z(r.value)}function O(){f.value&&(r.value=void 0,a.value=[])}function j(t){t.target&&($.value==t.target||$.value?.contains(t.target)||m())}function U(t){switch(t.key){case"Backspace":c.value.length&&(L(),t.preventDefault());break;case"Escape":y.value||m()}}return e.onBeforeMount(()=>{document.addEventListener("click",j),document.addEventListener("keydown",U)}),e.onBeforeUnmount(()=>{document.removeEventListener("click",j),document.removeEventListener("keydown",U)}),(t,o)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapperEl",ref:$,class:e.normalizeClass(["tag-field",[e.unref(se),{"has-clear-button":S.value}]])},[e.renderSlot(t.$slots,"label",{},()=>[n.label?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass(n.labelClass),for:e.unref(T).id},e.toDisplayString(n.label),11,Q)):e.createCommentVNode("",!0)]),e.createElementVNode("div",X,[e.renderSlot(t.$slots,"control",e.normalizeProps(e.guardReactiveProps({controlAttributes:e.unref(T),listeners:e.unref(V)})),()=>[t.$slots.icon?(e.openBlock(),e.createElementBlock("div",{key:0,class:"form-control-inner-icon",onClick:o[0]||(o[0]=l=>C.value?.focus())},[e.renderSlot(t.$slots,"icon")])):e.createCommentVNode("",!0),e.createElementVNode("div",e.mergeProps(e.unref(T),{class:["form-control flex",t.$attrs.class],onClick:o[8]||(o[8]=e.withModifiers(l=>C.value?.focus(),["self"]))}),[e.createElementVNode("div",Y,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(l,p)=>(e.openBlock(),e.createBlock(e.unref(G.Badge),{ref_for:!0,ref_key:"tagEl",ref:N,key:`tag-${p}`,tabindex:"-1",size:n.badgeSize,class:e.normalizeClass([n.badgeClass,{"pointer-events-none":!f.value},h(l)?n.activeBadgeColor:void 0]),closeable:n.badgeCloseable,"close-left":n.badgeCloseLeft,onMousedown:o[2]||(o[2]=e.withModifiers(()=>{},["prevent"])),onClose:w=>D(l),onFocus:w=>k(l),onBlur:w=>B(l),onClick:[e.withModifiers(w=>k(l,!0),["exact","meta"]),e.withModifiers(w=>k(l),["exact"]),e.withModifiers(w=>ue(l),["exact","shift"])]},{"close-icon":e.withCtx(()=>[e.createVNode(e.unref(F),{class:"size-[1.25em]",onMousedown:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))})]),default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{option:l,display:n.display},()=>[e.createTextVNode(e.toDisplayString(n.display?.(l)??l),1)])]),_:2},1032,["size","class","closeable","close-left","onClose","onFocus","onBlur","onClick"]))),128)),e.withDirectives(e.createElementVNode("input",{ref_key:"inputEl",ref:C,"onUpdate:modelValue":o[3]||(o[3]=l=>r.value=l),placeholder:a.value?.length?void 0:t.$attrs.placeholder,disabled:i.disabled,readonly:i.readonly,class:"bg-transparent outline-none flex-1 min-w-0",onKeydown:[e.withKeys(e.withModifiers(pe,["exact"]),["delete"]),e.withKeys(e.withModifiers(me,["exact","meta"]),["a"]),e.withKeys(e.withModifiers(we,["exact"]),["enter"]),e.withKeys(e.withModifiers(ye,["exact"]),["space"]),e.withKeys(e.withModifiers(ke,["exact"]),["arrow-up"]),e.withKeys(e.withModifiers(he,["exact"]),["arrow-down"]),o[4]||(o[4]=e.withKeys(e.withModifiers(l=>P(),["exact"]),["arrow-left"])),o[5]||(o[5]=e.withKeys(e.withModifiers(l=>P(!0),["exact","shift"]),["arrow-left"])),o[6]||(o[6]=e.withKeys(e.withModifiers(l=>q(),["exact"]),["arrow-right"])),o[7]||(o[7]=e.withKeys(e.withModifiers(l=>q(!0),["exact","shift"]),["arrow-right"])),e.withKeys(ge,["esc"])],onBlur:be,onFocus:Be},null,40,Z),[[e.vModelText,r.value]])])],16)]),e.createElementVNode("div",_,[e.renderSlot(t.$slots,"activity",e.normalizeProps(e.guardReactiveProps({canClear:S.value,clear:O,isInteractive:f.value})),()=>[S.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"tag-field-clear-button",onClick:e.withModifiers(O,["stop"])},[e.createVNode(e.unref(F),{class:"size-[1.25em]"})])):(e.openBlock(),e.createBlock(e.Transition,{key:1,name:"tag-field-fade"},{default:e.withCtx(()=>[i.activity&&i.indicator?(e.openBlock(),e.createBlock(e.unref(J.ActivityIndicator),{key:"activity",type:i.indicator,size:i.indicatorSize},null,8,["type","size"])):e.createCommentVNode("",!0)]),_:1}))])])]),ce.value?(e.openBlock(),e.createElementBlock("div",{key:0,tabindex:"-1",class:e.normalizeClass(["tag-field-dropdown",n.size]),onMousedown:o[11]||(o[11]=e.withModifiers(()=>{},["prevent","stop"]))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(l,p)=>(e.openBlock(),e.createElementBlock("button",{key:`option-${JSON.stringify(l)}`,type:"button",tabindex:"-1",class:e.normalizeClass({"bg-neutral-100 dark:bg-neutral-800":s.value===p}),onMousedown:o[9]||(o[9]=e.withModifiers(()=>{},["prevent"])),onMouseup:w=>b(l)},[e.createElementVNode("div",te,e.toDisplayString(n.display?.(l)??l),1)],42,ee))),128)),n.allowCustom&&r.value?(e.openBlock(),e.createElementBlock("button",{key:0,class:"flex items-center gap-1",type:"button",onMousedown:o[10]||(o[10]=e.withModifiers(()=>{},["prevent"])),onMouseup:Ce},[e.createVNode(e.unref(H),{class:"size-4"}),e.createTextVNode(" "+e.toDisplayString(n.addTagLabel),1)],32)):e.createCommentVNode("",!0),n.showNoResults&&!u.value.length&&!n.allowCustom?(e.openBlock(),e.createElementBlock("div",oe,[e.renderSlot(t.$slots,"no-results",{input:r.value},()=>[e.createTextVNode(e.toDisplayString(n.noResultsText),1)])])):e.createCommentVNode("",!0)],34)):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"errors",e.normalizeProps(e.guardReactiveProps({error:n.error,errors:n.errors,id:t.$attrs.id,name:t.$attrs.name})),()=>[n.error||n.errors?(e.openBlock(),e.createBlock(e.unref(E.FormControlErrors),{key:0,id:n.id,name:n.name,error:n.error,errors:n.errors},{default:e.withCtx(({error:l})=>[e.createElementVNode("div",le,e.toDisplayString(l),1)]),_:1},8,["id","name","error","errors"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"feedback",e.normalizeProps(e.guardReactiveProps({feedback:n.feedback})),()=>[e.createVNode(e.unref(E.FormControlFeedback),{feedback:n.feedback},{default:e.withCtx(({feedback:l})=>[e.createElementVNode("div",ne,e.toDisplayString(l),1)]),_:1},8,["feedback"])]),e.renderSlot(t.$slots,"help",e.normalizeProps(e.guardReactiveProps({helpText:n.helpText})),()=>[n.helpText?(e.openBlock(),e.createElementBlock("small",ae,e.toDisplayString(n.helpText),1)):e.createCommentVNode("",!0)])],2))}});d.TagField=re,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
|
|
2
2
|
//# sourceMappingURL=tag-field.umd.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag-field.umd.cjs","sources":["../../../node_modules/.pnpm/@heroicons+vue@2.2.0_vue@3.5.27_typescript@5.9.3_/node_modules/@heroicons/vue/24/outline/esm/PlusIcon.js","../../../node_modules/.pnpm/@heroicons+vue@2.2.0_vue@3.5.27_typescript@5.9.3_/node_modules/@heroicons/vue/24/outline/esm/XMarkIcon.js","../src/TagField.vue"],"sourcesContent":["import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nexport default function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n \"stroke-width\": \"1.5\",\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\"\n }, [\n _createElementVNode(\"path\", {\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n d: \"M12 4.5v15m7.5-7.5h-15\"\n })\n ]))\n}","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nexport default function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n \"stroke-width\": \"1.5\",\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\"\n }, [\n _createElementVNode(\"path\", {\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n d: \"M6 18 18 6M6 6l12 12\"\n })\n ]))\n}","<script setup lang=\"ts\" generic=\"T, Value\">\nimport { PlusIcon, XMarkIcon } from '@heroicons/vue/24/outline';\nimport { ActivityIndicator } from '@vue-interface/activity-indicator';\nimport { Badge } from '@vue-interface/badge';\nimport type { FormControlEvents, FormControlProps, FormControlSlots } from '@vue-interface/form-control';\nimport { FormControlErrors, FormControlFeedback, useFormControl } from '@vue-interface/form-control';\nimport type { IFuseOptions } from 'fuse.js';\nimport Fuse from 'fuse.js';\nimport { isEqual } from 'lodash-es';\nimport { type HTMLAttributes, computed, onBeforeMount, onBeforeUnmount, ref, toRaw, unref, useTemplateRef, watch, type Ref } from 'vue';\n\nexport type TagFieldSizePrefix = 'form-control';\n\nexport type TagFieldProps<T, Value> = /* @vue-ignore */ FormControlProps<\n HTMLAttributes,\n TagFieldSizePrefix,\n T[],\n Value[]\n> & {\n options?: T[];\n fuseOptions?: IFuseOptions<T>;\n display?: (option: T) => string;\n format?: (value: string) => T;\n allowCustom?: boolean;\n addTagLabel?: string;\n noResultsText?: string;\n showNoResults?: boolean;\n clearable?: boolean;\n};\n\nconst props = withDefaults(defineProps<TagFieldProps<T, Value>>(), {\n formControlClass: 'form-control',\n labelClass: 'form-label',\n size: 'form-control-md',\n allowCustom: false,\n addTagLabel: 'Add Tag',\n noResultsText: 'No results found',\n showNoResults: true,\n clearable: false,\n options: () => [],\n});\n\ndefineOptions({\n inheritAttrs: false\n});\n\nconst model = defineModel<T[]>();\n\ndefineSlots<FormControlSlots<TagFieldSizePrefix, T[]> & {\n default(props: { option: T; display?: (option: T) => string }): any;\n 'no-results'(props: { input: string | undefined }): any;\n}>();\n\nconst emit = defineEmits<FormControlEvents>();\n\nconst {\n controlAttributes,\n formGroupClasses,\n listeners\n} = useFormControl<HTMLAttributes, TagFieldSizePrefix, T[]|undefined, Value[]>({ model, props, emit });\n\nconst wrapperEl = useTemplateRef('wrapperEl');\nconst inputEl = useTemplateRef('inputEl');\nconst tagEl = useTemplateRef('tagEl');\n\nconst input = ref<string>();\nconst selected = ref<T[]>([]) as Ref<T[]>;\nconst hasFocus = ref(false);\nconst focusIndex = ref<number>();\nconst options = ref(props.options) as Ref<T[]>;\n\nconst isInteractive = computed(() => !props.disabled && !props.readonly);\n\nconst canClear = computed(() => {\n return props.clearable && (!!input.value || !!model.value?.length) && isInteractive.value;\n});\n\nconst keys = computed(() => {\n return typeof props.options === 'object' && props.options?.[0]\n ? Object.keys(props.options?.[0])\n : [];\n});\n\nconst fuse: Fuse<T> = createFuse(props.options);\n\nconst showOptions = computed(() => {\n return hasFocus.value && (filtered.value.length || input.value);\n});\n\nconst selectedIndexes = computed(() => {\n return selected.value.map(tag => {\n return (model.value ?? []).findIndex(item => isEqual(item, tag));\n });\n});\n\nwatch(() => props.options, () => {\n options.value = props.options;\n});\n\nwatch(input, () => {\n hasFocus.value = true;\n focusIndex.value = undefined;\n\n deactivateTags();\n});\n\nfunction createFuse(items: T[]) {\n return new Fuse(items, props.fuseOptions ?? {\n includeScore: true,\n threshold: .45,\n keys: keys.value\n });\n}\n\nconst filtered = computed<T[]>(() => {\n const items = options.value.filter(option => {\n return !(model.value ?? []).find(item => {\n return isEqual(item, toRaw(unref(option)));\n });\n });\n\n if(!input.value) {\n return items;\n }\n\n fuse.setCollection(items as T[]);\n\n return fuse.search(input.value).map(({ item }) => item);\n});\n\nfunction addCustomTag(value: string) {\n const tag = props.format?.(value) ?? value as T;\n\n if(!options.value.find(option => isEqual(option, tag))) {\n options.value.push(tag);\n\n addTag(tag);\n\n input.value = undefined;\n }\n}\n\nfunction addTag(tag: T) {\n model.value = [...(model.value ?? []), tag];\n input.value = undefined;\n focusIndex.value = undefined;\n}\n\nfunction removeTag(tag: T) {\n const value = [...(model.value ?? [])];\n\n value.splice(value.indexOf(tag), 1);\n\n deactivateTag(tag);\n\n model.value = value;\n}\n\nfunction toggleActiveTag(tag: T, multiple = false) {\n if(!multiple) {\n deactivateTags(tag);\n }\n\n if(!isTagActive(tag)) {\n activateTag(tag);\n }\n else {\n deactivateTag(tag);\n }\n}\n\nfunction toggleActiveTagRange(tag: T) {\n const items = model.value ?? [];\n const index = items.indexOf(tag);\n const lastSelectedIndex = selectedIndexes.value[selectedIndexes.value.length - 1];\n const fn = !isTagActive(tag) ? activateTag : deactivateTag;\n\n if(lastSelectedIndex === undefined) {\n toggleActiveTag(tag);\n\n return;\n }\n\n let range: T[] = [];\n\n if(index > lastSelectedIndex) {\n range = items.slice(lastSelectedIndex, index + 1);\n }\n else if(index < lastSelectedIndex) {\n range = items.slice(index, lastSelectedIndex + 1);\n }\n\n for(const tag of range) {\n fn(tag);\n }\n}\n\nfunction selectAllTags() {\n if(input.value) {\n return;\n }\n\n selected.value = [...(model.value ?? [])];\n}\n\nfunction deactivateTags(omit?: T) {\n if(!omit) {\n selected.value = [];\n }\n else {\n const tags = selected.value.filter(\n item => !isEqual(item, omit)\n );\n\n for(const tag of tags) {\n deactivateTag(tag);\n }\n }\n\n blurTags();\n}\n\nfunction blurTags() {\n if(!tagEl.value) {\n return;\n }\n\n for(const tag of tagEl.value) {\n (tag?.$el as HTMLElement | undefined)?.blur();\n }\n}\n\nfunction isTagActive(tag: T) {\n return !!selected.value.find(item => isEqual(item, tag));\n}\n\nfunction activateTag(tag: T) {\n if(!isTagActive(tag)) {\n selected.value.push(tag);\n }\n}\n\nfunction deactivateTag(tag: T) {\n if(isTagActive(tag)) {\n selected.value.splice(selected.value.indexOf(tag), 1);\n }\n\n blurTags();\n}\n\nfunction removeActiveTags() {\n model.value = (model.value ?? []).filter(tag => {\n return !isTagActive(tag);\n });\n\n selected.value = [];\n}\n\nfunction onBackspace() {\n inputEl.value?.focus();\n\n if(input.value) {\n return;\n }\n\n if(selected.value.length) {\n removeActiveTags();\n }\n else if(model.value?.length) {\n removeTag(model.value[model.value.length - 1]);\n }\n}\n\nfunction onKeydownEnter(e: KeyboardEvent) {\n if(focusIndex.value !== undefined) {\n addTag(filtered.value[focusIndex.value]);\n }\n else if(filtered.value.length) {\n addTag(filtered.value[0]);\n }\n else if(props.allowCustom && input.value) {\n addCustomTag(input.value);\n }\n\n e.preventDefault();\n}\n\nfunction onKeydownSpace(e: KeyboardEvent) {\n if(focusIndex.value === undefined) {\n return;\n }\n\n addTag(filtered.value[focusIndex.value]);\n\n e.preventDefault();\n}\n\nfunction onKeydownUp() {\n if(!focusIndex.value) {\n focusIndex.value = filtered.value.length - 1;\n }\n else {\n focusIndex.value--;\n }\n}\n\nfunction onKeydownDown() {\n if(focusIndex.value === undefined || focusIndex.value === filtered.value.length - 1) {\n focusIndex.value = 0;\n }\n else {\n focusIndex.value++;\n }\n}\n\nfunction onKeydownLeft(multiple: boolean = false) {\n if(!model.value?.length || input.value) {\n return;\n }\n\n const nextIndex = Math.min(...selectedIndexes.value, model.value.length) - 1;\n\n if(model.value[nextIndex]) {\n toggleActiveTag(model.value[nextIndex], multiple);\n }\n else {\n deactivateTags();\n }\n}\n\nfunction onKeydownRight(multiple: boolean = false) {\n if(!model.value?.length || input.value) {\n return;\n }\n\n const nextIndex = Math.max(...selectedIndexes.value, -1) + 1;\n\n if(model.value[nextIndex]) {\n toggleActiveTag(model.value[nextIndex], multiple);\n }\n else {\n deactivateTags();\n }\n}\n\nfunction onEscape() {\n if(hasFocus.value) {\n hasFocus.value = false;\n }\n else {\n deactivateTags();\n }\n}\n\nfunction onBlur() {\n if(props.allowCustom && input.value) {\n addCustomTag(input.value);\n }\n\n hasFocus.value = false;\n\n deactivateTags();\n}\n\nfunction onFocus() {\n hasFocus.value = true;\n\n deactivateTags();\n}\n\nfunction onClickAddTag() {\n if(input.value) {\n addCustomTag(input.value);\n }\n}\n\nfunction clear() {\n if (!isInteractive.value) return;\n input.value = undefined;\n model.value = [];\n}\n\nfunction onClickOutsideWrapper(e: MouseEvent) {\n if(!e.target) {\n return;\n }\n\n if(!(wrapperEl.value == e.target || wrapperEl.value?.contains(e.target as Element))) {\n deactivateTags();\n }\n}\n\nfunction onDocumentKeydown(e: KeyboardEvent) {\n switch (e.key) {\n case 'Backspace':\n if(selected.value.length) {\n removeActiveTags();\n e.preventDefault();\n }\n break;\n case 'Escape':\n if(!hasFocus.value) {\n deactivateTags();\n }\n }\n}\n\nonBeforeMount(() => {\n document.addEventListener('click', onClickOutsideWrapper);\n document.addEventListener('keydown', onDocumentKeydown);\n});\n\nonBeforeUnmount(() => {\n document.removeEventListener('click', onClickOutsideWrapper);\n document.removeEventListener('keydown', onDocumentKeydown);\n});\n</script>\n\n<template>\n <div\n ref=\"wrapperEl\"\n class=\"tag-field\"\n :class=\"[formGroupClasses, { 'has-clear-button': canClear }]\">\n <slot name=\"label\">\n <label\n v-if=\"label\"\n :class=\"labelClass\"\n :for=\"controlAttributes.id\">\n {{ label }}\n </label>\n </slot>\n\n <div class=\"form-control-inner\">\n <slot\n name=\"control\"\n v-bind=\"{ controlAttributes, listeners }\">\n <div\n v-if=\"$slots.icon\"\n class=\"form-control-inner-icon\"\n @click=\"inputEl?.focus()\">\n <slot name=\"icon\" />\n </div>\n <div\n v-bind=\"controlAttributes\"\n class=\"form-control flex\"\n @click.self=\"inputEl?.focus()\">\n <div class=\"flex flex-wrap gap-2 mr-2 flex-1\">\n <Badge\n v-for=\"(tag, i) in model\"\n ref=\"tagEl\"\n :key=\"`tag-${i}`\"\n tabindex=\"-1\"\n size=\"badge-[.95em]\"\n class=\"badge-neutral-100 dark:badge-neutral-500\"\n :class=\"{\n 'badge-blue-600!': isTagActive(tag),\n }\"\n closeable\n @mousedown.prevent\n @close=\"removeTag(tag)\"\n @focus=\"toggleActiveTag(tag)\"\n @blur=\"deactivateTag(tag)\"\n @click.exact.meta=\"toggleActiveTag(tag, true)\"\n @click.exact=\"toggleActiveTag(tag)\"\n @click.exact.shift=\"toggleActiveTagRange(tag)\">\n <slot :option=\"tag\" :display=\"display\">\n {{ display?.(tag) ?? tag }}\n </slot>\n <template #close-icon>\n <XMarkIcon class=\"size-[1.25em]\" @mousedown.prevent />\n </template>\n </Badge>\n\n <input\n ref=\"inputEl\"\n v-model=\"input\"\n :placeholder=\"placeholder\"\n class=\"bg-transparent outline-none flex-1 min-w-0\"\n @keydown.exact.delete=\"onBackspace\"\n @keydown.exact.meta.a=\"selectAllTags\"\n @keydown.exact.enter=\"onKeydownEnter\"\n @keydown.exact.space=\"onKeydownSpace\"\n @keydown.exact.arrow-up=\"onKeydownUp\"\n @keydown.exact.arrow-down=\"onKeydownDown\"\n @keydown.exact.arrow-left=\"onKeydownLeft()\"\n @keydown.exact.shift.arrow-left=\"onKeydownLeft(true)\"\n @keydown.exact.arrow-right=\"onKeydownRight()\"\n @keydown.exact.shift.arrow-right=\"onKeydownRight(true)\"\n @keydown.esc=\"onEscape\"\n @blur=\"onBlur\"\n @focus=\"onFocus\">\n </div>\n </div>\n </slot>\n\n <div class=\"form-control-activity-indicator\">\n <slot name=\"activity\" v-bind=\"{ canClear, clear, isInteractive }\">\n <button\n v-if=\"canClear\"\n type=\"button\"\n class=\"tag-field-clear-button\"\n @click.stop=\"clear\">\n <XMarkIcon class=\"size-[1.25em]\" />\n </button>\n <Transition name=\"tag-field-fade\" v-else>\n <ActivityIndicator\n v-if=\"activity && indicator\"\n key=\"activity\"\n :type=\"indicator\"\n :size=\"indicatorSize\" />\n </Transition>\n </slot>\n </div>\n </div>\n\n <slot\n name=\"errors\"\n v-bind=\"{ error, errors, id: controlAttributes.id, name }\">\n <FormControlErrors\n v-if=\"!!(error || errors)\"\n :id=\"controlAttributes.id\"\n v-slot=\"{ error: err }\"\n :name=\"name\"\n :error=\"error\"\n :errors=\"errors\">\n <div\n invalid\n class=\"invalid-feedback\">\n {{ err }}\n </div>\n </FormControlErrors>\n </slot>\n\n <slot\n name=\"feedback\"\n v-bind=\"{ feedback }\">\n <FormControlFeedback\n v-slot=\"{ feedback: fb }\"\n :feedback=\"feedback\">\n <div\n valid\n class=\"valid-feedback\">\n {{ fb }}\n </div>\n </FormControlFeedback>\n </slot>\n\n <slot\n name=\"help\"\n v-bind=\"{ helpText }\">\n <small\n v-if=\"helpText\"\n class=\"form-help\">\n {{ helpText }}\n </small>\n </slot>\n\n <div\n v-if=\"showOptions\"\n tabindex=\"-1\"\n class=\"tag-field-dropdown\"\n @mousedown.prevent.stop>\n <button\n v-for=\"(option, i) in filtered\"\n :key=\"`option-${JSON.stringify(option)}`\"\n type=\"button\"\n tabindex=\"-1\"\n :class=\"{\n ['bg-neutral-100 dark:bg-neutral-800']: focusIndex === i\n }\"\n @mousedown.prevent\n @mouseup=\"addTag(option)\">\n <div class=\"truncate\">\n {{ display?.(option) ?? option }}\n </div>\n </button>\n <button\n v-if=\"allowCustom && input\"\n class=\"flex items-center gap-1\"\n type=\"button\"\n @mousedown.prevent\n @mouseup=\"onClickAddTag\">\n <PlusIcon class=\"size-4\" /> {{ addTagLabel }}\n </button>\n <div\n v-if=\"showNoResults && !filtered.length && !allowCustom\"\n class=\"py-2 px-4 text-neutral-400 dark:text-neutral-500\">\n <slot name=\"no-results\" :input=\"input\">\n {{ noResultsText }}\n </slot>\n </div>\n </div>\n </div>\n</template>\n"],"names":["render","_ctx","_cache","_openBlock","_createElementBlock","_createElementVNode","props","__props","model","_useModel","emit","__emit","controlAttributes","formGroupClasses","listeners","useFormControl","wrapperEl","useTemplateRef","inputEl","tagEl","input","ref","selected","hasFocus","focusIndex","options","isInteractive","computed","canClear","keys","fuse","createFuse","showOptions","filtered","selectedIndexes","tag","item","isEqual","watch","deactivateTags","items","Fuse","option","toRaw","unref","addCustomTag","value","addTag","removeTag","deactivateTag","toggleActiveTag","multiple","isTagActive","activateTag","toggleActiveTagRange","index","lastSelectedIndex","fn","range","selectAllTags","omit","tags","blurTags","removeActiveTags","onBackspace","onKeydownEnter","e","onKeydownSpace","onKeydownUp","onKeydownDown","onKeydownLeft","nextIndex","onKeydownRight","onEscape","onBlur","onFocus","onClickAddTag","clear","onClickOutsideWrapper","onDocumentKeydown","onBeforeMount","onBeforeUnmount","_normalizeClass","_unref","_renderSlot","label","labelClass","_hoisted_1","_hoisted_2","_normalizeProps","_guardReactiveProps","$slots","$event","_mergeProps","_withModifiers","_hoisted_3","_Fragment","_renderList","i","_createBlock","Badge","_createVNode","XMarkIcon","display","placeholder","_hoisted_5","_Transition","activity","indicator","ActivityIndicator","indicatorSize","error","errors","name","FormControlErrors","_withCtx","err","_hoisted_6","_toDisplayString","feedback","FormControlFeedback","fb","_hoisted_7","helpText","_hoisted_8","_hoisted_10","allowCustom","PlusIcon","_createTextVNode","addTagLabel","showNoResults","_hoisted_11","noResultsText"],"mappings":"qnBAEe,SAASA,EAAOC,EAAMC,EAAQ,CAC3C,OAAQC,EAAAA,UAAU,EAAIC,EAAAA,mBAAoB,MAAO,CAC/C,MAAO,6BACP,KAAM,OACN,QAAS,YACT,eAAgB,MAChB,OAAQ,eACR,cAAe,OACf,YAAa,MACjB,EAAK,CACDC,EAAAA,mBAAoB,OAAQ,CAC1B,iBAAkB,QAClB,kBAAmB,QACnB,EAAG,wBACT,CAAK,CACL,CAAG,CACH,CChBe,SAASL,EAAOC,EAAMC,EAAQ,CAC3C,OAAQC,EAAAA,UAAU,EAAIC,EAAAA,mBAAoB,MAAO,CAC/C,MAAO,6BACP,KAAM,OACN,QAAS,YACT,eAAgB,MAChB,OAAQ,eACR,cAAe,OACf,YAAa,MACjB,EAAK,CACDC,EAAAA,mBAAoB,OAAQ,CAC1B,iBAAkB,QAClB,kBAAmB,QACnB,EAAG,sBACT,CAAK,CACL,CAAG,CACH,g4BCYA,MAAMC,EAAQC,EAgBRC,EAAQC,EAAAA,uBAAiB,EAOzBC,GAAOC,EAEP,CACF,kBAAAC,EACA,iBAAAC,GACA,UAAAC,EAAA,EACAC,EAAAA,eAA2E,CAAE,MAAAP,EAAO,MAAAF,EAAO,KAAAI,GAAM,EAE/FM,EAAYC,EAAAA,eAAe,WAAW,EACtCC,EAAUD,EAAAA,eAAe,SAAS,EAClCE,EAAQF,EAAAA,eAAe,OAAO,EAE9BG,EAAQC,EAAAA,IAAA,EACRC,EAAWD,EAAAA,IAAS,EAAE,EACtBE,EAAWF,EAAAA,IAAI,EAAK,EACpBG,EAAaH,EAAAA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aAEOnF,EAAA,OAAA,aAAA,CAFkB,MAAOmB,EAAA,KAAA,EAAhC,IAEO,qCADAgH,EAAAA,aAAa,EAAA,CAAA,CAAA","x_google_ignoreList":[0,1]}
|
|
1
|
+
{"version":3,"file":"tag-field.umd.cjs","sources":["../../../node_modules/.pnpm/@heroicons+vue@2.2.0_vue@3.5.27_typescript@5.9.3_/node_modules/@heroicons/vue/24/outline/esm/PlusIcon.js","../../../node_modules/.pnpm/@heroicons+vue@2.2.0_vue@3.5.27_typescript@5.9.3_/node_modules/@heroicons/vue/24/outline/esm/XMarkIcon.js","../src/TagField.vue"],"sourcesContent":["import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nexport default function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n \"stroke-width\": \"1.5\",\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\"\n }, [\n _createElementVNode(\"path\", {\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n d: \"M12 4.5v15m7.5-7.5h-15\"\n })\n ]))\n}","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nexport default function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n \"stroke-width\": \"1.5\",\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\"\n }, [\n _createElementVNode(\"path\", {\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n d: \"M6 18 18 6M6 6l12 12\"\n })\n ]))\n}","<script setup lang=\"ts\" generic=\"ModelValue, Value\">\nimport { PlusIcon, XMarkIcon } from '@heroicons/vue/24/outline';\nimport { ActivityIndicator } from '@vue-interface/activity-indicator';\nimport { Badge, type BadgeSize } from '@vue-interface/badge';\nimport type { FormControlEvents, FormControlProps, FormControlSlots } from '@vue-interface/form-control';\nimport { FormControlErrors, FormControlFeedback, useFormControl } from '@vue-interface/form-control';\nimport type { IFuseOptions } from 'fuse.js';\nimport Fuse from 'fuse.js';\nimport { isEqual } from 'lodash-es';\nimport { type HTMLAttributes, computed, onBeforeMount, onBeforeUnmount, ref, toRaw, unref, useTemplateRef, watch, type Ref } from 'vue';\n\nexport type TagFieldSizePrefix = 'form-control';\n\nexport type TagFieldProps<ModelValue, Value> = FormControlProps<\n HTMLAttributes,\n TagFieldSizePrefix,\n ModelValue[],\n Value[]\n> & {\n options?: ModelValue[];\n fuseOptions?: IFuseOptions<ModelValue>;\n display?: (option: ModelValue) => string;\n format?: (value: string) => ModelValue;\n allowCustom?: boolean;\n addTagLabel?: string;\n noResultsText?: string;\n showNoResults?: boolean;\n clearable?: boolean;\n badgeClass?: string | string[] | Record<string, boolean>;\n activeBadgeColor?: string | string[] | Record<string, boolean>;\n badgeSize?: BadgeSize;\n badgeCloseable?: boolean;\n badgeCloseLeft?: boolean;\n};\n\nconst props = withDefaults(defineProps<TagFieldProps<ModelValue, Value>>(), {\n formControlClass: 'form-control',\n labelClass: 'form-label',\n size: 'form-control-md',\n allowCustom: false,\n addTagLabel: 'Add Tag',\n noResultsText: 'No results found',\n showNoResults: true,\n clearable: false,\n options: () => [],\n badgeClass: 'badge-neutral-100 dark:badge-neutral-500',\n activeBadgeColor: 'badge-blue-100! dark:badge-blue-600!',\n badgeSize: 'badge-[.95em]',\n badgeCloseable: true,\n badgeCloseLeft: false,\n});\n\ndefineOptions({\n inheritAttrs: false\n});\n\nconst model = defineModel<ModelValue[]>();\n\ndefineSlots<FormControlSlots<TagFieldSizePrefix, ModelValue[]> & {\n default(props: { option: ModelValue; display?: (option: ModelValue) => string }): any;\n 'no-results'(props: { input: string | undefined }): any;\n}>();\n\nconst emit = defineEmits<FormControlEvents>();\n\nconst {\n controlAttributes,\n formGroupClasses,\n listeners\n} = useFormControl<HTMLAttributes, TagFieldSizePrefix, ModelValue[]|undefined, Value[]>({ model, props, emit });\n\nconst wrapperEl = useTemplateRef('wrapperEl');\nconst inputEl = useTemplateRef('inputEl');\nconst tagEl = useTemplateRef('tagEl');\n\nconst input = ref<string>();\nconst selected = ref<ModelValue[]>([]) as Ref<ModelValue[]>;\nconst hasFocus = ref(false);\nconst focusIndex = ref<number>();\nconst options = ref(props.options) as Ref<ModelValue[]>;\n\nconst isInteractive = computed(() => !props.disabled && !props.readonly);\n\nconst canClear = computed(() => {\n return props.clearable && (!!input.value || !!model.value?.length) && isInteractive.value;\n});\n\nconst keys = computed(() => {\n return typeof props.options === 'object' && props.options?.[0]\n ? Object.keys(props.options?.[0])\n : [];\n});\n\nconst fuse: Fuse<ModelValue> = createFuse(props.options);\n\nconst showOptions = computed(() => {\n return isInteractive.value && hasFocus.value && (filtered.value.length || input.value);\n});\n\nconst selectedIndexes = computed(() => {\n return selected.value.map(tag => {\n return (model.value ?? []).findIndex(item => isEqual(item, tag));\n });\n});\n\nwatch(() => props.options, () => {\n options.value = props.options;\n});\n\nwatch(input, () => {\n hasFocus.value = true;\n focusIndex.value = undefined;\n\n deactivateTags();\n});\n\nfunction createFuse(items: ModelValue[]) {\n return new Fuse(items, props.fuseOptions ?? {\n includeScore: true,\n threshold: .45,\n keys: keys.value\n });\n}\n\nconst filtered = computed<ModelValue[]>(() => {\n const items = options.value.filter(option => {\n return !(model.value ?? []).find(item => {\n return isEqual(item, toRaw(unref(option)));\n });\n });\n\n if(!input.value) {\n return items;\n }\n\n fuse.setCollection(items as ModelValue[]);\n\n return fuse.search(input.value).map(({ item }) => item);\n});\n\nfunction addCustomTag(value: string) {\n if(!isInteractive.value) return;\n\n const tag = props.format?.(value) ?? value as ModelValue;\n\n if(!options.value.find(option => isEqual(option, tag))) {\n options.value.push(tag);\n\n addTag(tag);\n\n input.value = undefined;\n }\n}\n\nfunction addTag(tag: ModelValue) {\n if(!isInteractive.value) return;\n\n model.value = [...(model.value ?? []), tag];\n input.value = undefined;\n focusIndex.value = undefined;\n}\n\nfunction removeTag(tag: ModelValue) {\n if(!isInteractive.value) return;\n\n const value = [...(model.value ?? [])];\n\n value.splice(value.indexOf(tag), 1);\n\n deactivateTag(tag);\n\n model.value = value;\n}\n\nfunction toggleActiveTag(tag: ModelValue, multiple = false) {\n if(!isInteractive.value) return;\n\n if(!multiple) {\n deactivateTags(tag);\n }\n\n if(!isTagActive(tag)) {\n activateTag(tag);\n }\n else {\n deactivateTag(tag);\n }\n}\n\nfunction toggleActiveTagRange(tag: ModelValue) {\n if(!isInteractive.value) return;\n\n const items = model.value ?? [];\n const index = items.indexOf(tag);\n const lastSelectedIndex = selectedIndexes.value[selectedIndexes.value.length - 1];\n const fn = !isTagActive(tag) ? activateTag : deactivateTag;\n\n if(lastSelectedIndex === undefined) {\n toggleActiveTag(tag);\n\n return;\n }\n\n let range: ModelValue[] = [];\n\n if(index > lastSelectedIndex) {\n range = items.slice(lastSelectedIndex, index + 1);\n }\n else if(index < lastSelectedIndex) {\n range = items.slice(index, lastSelectedIndex + 1);\n }\n\n for(const tag of range) {\n fn(tag);\n }\n}\n\nfunction selectAllTags() {\n if(input.value) {\n return;\n }\n\n selected.value = [...(model.value ?? [])];\n}\n\nfunction deactivateTags(omit?: ModelValue) {\n if(!omit) {\n selected.value = [];\n }\n else {\n const tags = selected.value.filter(\n item => !isEqual(item, omit)\n );\n\n for(const tag of tags) {\n deactivateTag(tag);\n }\n }\n\n blurTags();\n}\n\nfunction blurTags() {\n if(!tagEl.value) {\n return;\n }\n\n for(const tag of tagEl.value) {\n (tag?.$el as HTMLElement | undefined)?.blur();\n }\n}\n\nfunction isTagActive(tag: ModelValue) {\n return !!selected.value.find(item => isEqual(item, tag));\n}\n\nfunction activateTag(tag: ModelValue) {\n if(!isTagActive(tag)) {\n selected.value.push(tag);\n }\n}\n\nfunction deactivateTag(tag: ModelValue) {\n if(isTagActive(tag)) {\n selected.value.splice(selected.value.indexOf(tag), 1);\n }\n\n blurTags();\n}\n\nfunction removeActiveTags() {\n model.value = (model.value ?? []).filter(tag => {\n return !isTagActive(tag);\n });\n\n selected.value = [];\n}\n\nfunction onBackspace() {\n inputEl.value?.focus();\n\n if(input.value) {\n return;\n }\n\n if(selected.value.length) {\n removeActiveTags();\n }\n else if(model.value?.length) {\n removeTag(model.value[model.value.length - 1]);\n }\n}\n\nfunction onKeydownEnter(e: KeyboardEvent) {\n if(focusIndex.value !== undefined) {\n addTag(filtered.value[focusIndex.value]);\n }\n else if(filtered.value.length) {\n addTag(filtered.value[0]);\n }\n else if(props.allowCustom && input.value) {\n addCustomTag(input.value);\n }\n\n e.preventDefault();\n}\n\nfunction onKeydownSpace(e: KeyboardEvent) {\n if(focusIndex.value === undefined) {\n return;\n }\n\n addTag(filtered.value[focusIndex.value]);\n\n e.preventDefault();\n}\n\nfunction onKeydownUp() {\n if(!focusIndex.value) {\n focusIndex.value = filtered.value.length - 1;\n }\n else {\n focusIndex.value--;\n }\n}\n\nfunction onKeydownDown() {\n if(focusIndex.value === undefined || focusIndex.value === filtered.value.length - 1) {\n focusIndex.value = 0;\n }\n else {\n focusIndex.value++;\n }\n}\n\nfunction onKeydownLeft(multiple: boolean = false) {\n if(!model.value?.length || input.value) {\n return;\n }\n\n const nextIndex = Math.min(...selectedIndexes.value, model.value.length) - 1;\n\n if(model.value[nextIndex]) {\n toggleActiveTag(model.value[nextIndex], multiple);\n }\n else {\n deactivateTags();\n }\n}\n\nfunction onKeydownRight(multiple: boolean = false) {\n if(!model.value?.length || input.value) {\n return;\n }\n\n const nextIndex = Math.max(...selectedIndexes.value, -1) + 1;\n\n if(model.value[nextIndex]) {\n toggleActiveTag(model.value[nextIndex], multiple);\n }\n else {\n deactivateTags();\n }\n}\n\nfunction onEscape() {\n if(hasFocus.value) {\n hasFocus.value = false;\n }\n else {\n deactivateTags();\n }\n}\n\nfunction onBlur(e: FocusEvent) {\n if(props.allowCustom && input.value) {\n addCustomTag(input.value);\n }\n\n hasFocus.value = false;\n\n deactivateTags();\n\n listeners.onBlur(e);\n}\n\nfunction onFocus(e: FocusEvent) {\n hasFocus.value = true;\n\n deactivateTags();\n\n listeners.onFocus(e);\n}\n\nfunction onClickAddTag() {\n if(input.value) {\n addCustomTag(input.value);\n }\n}\n\nfunction clear() {\n if (!isInteractive.value) return;\n input.value = undefined;\n model.value = [];\n}\n\nfunction onClickOutsideWrapper(e: MouseEvent) {\n if(!e.target) {\n return;\n }\n\n if(!(wrapperEl.value == e.target || wrapperEl.value?.contains(e.target as Element))) {\n deactivateTags();\n }\n}\n\nfunction onDocumentKeydown(e: KeyboardEvent) {\n switch (e.key) {\n case 'Backspace':\n if(selected.value.length) {\n removeActiveTags();\n e.preventDefault();\n }\n break;\n case 'Escape':\n if(!hasFocus.value) {\n deactivateTags();\n }\n }\n}\n\nonBeforeMount(() => {\n document.addEventListener('click', onClickOutsideWrapper);\n document.addEventListener('keydown', onDocumentKeydown);\n});\n\nonBeforeUnmount(() => {\n document.removeEventListener('click', onClickOutsideWrapper);\n document.removeEventListener('keydown', onDocumentKeydown);\n});\n</script>\n\n<template>\n <div\n ref=\"wrapperEl\"\n class=\"tag-field\"\n :class=\"[formGroupClasses, { 'has-clear-button': canClear }]\">\n <slot name=\"label\">\n <label\n v-if=\"label\"\n :class=\"labelClass\"\n :for=\"controlAttributes.id\">\n {{ label }}\n </label>\n </slot>\n\n <div class=\"form-control-inner\">\n <slot\n name=\"control\"\n v-bind=\"{ controlAttributes, listeners }\">\n <div\n v-if=\"$slots.icon\"\n class=\"form-control-inner-icon\"\n @click=\"inputEl?.focus()\">\n <slot name=\"icon\" />\n </div>\n <div\n v-bind=\"controlAttributes\"\n class=\"form-control flex\"\n :class=\"$attrs.class\"\n @click.self=\"inputEl?.focus()\">\n <div class=\"flex flex-wrap gap-2 mr-2 flex-1\">\n <Badge\n v-for=\"(tag, i) in model\"\n ref=\"tagEl\"\n :key=\"`tag-${i}`\"\n tabindex=\"-1\"\n :size=\"badgeSize\"\n :class=\"[\n badgeClass,\n { 'pointer-events-none': !isInteractive },\n isTagActive(tag) ? activeBadgeColor : undefined\n ]\"\n :closeable=\"badgeCloseable\"\n :close-left=\"badgeCloseLeft\"\n @mousedown.prevent\n @close=\"removeTag(tag)\"\n @focus=\"toggleActiveTag(tag)\"\n @blur=\"deactivateTag(tag)\"\n @click.exact.meta=\"toggleActiveTag(tag, true)\"\n @click.exact=\"toggleActiveTag(tag)\"\n @click.exact.shift=\"toggleActiveTagRange(tag)\">\n <slot :option=\"tag\" :display=\"display\">\n {{ display?.(tag) ?? tag }}\n </slot>\n <template #close-icon>\n <XMarkIcon class=\"size-[1.25em]\" @mousedown.prevent />\n </template>\n </Badge>\n\n <input\n ref=\"inputEl\"\n v-model=\"input\"\n :placeholder=\"model?.length ? undefined : ($attrs.placeholder as string)\"\n :disabled=\"props.disabled\"\n :readonly=\"props.readonly\"\n class=\"bg-transparent outline-none flex-1 min-w-0\"\n @keydown.exact.delete=\"onBackspace\"\n @keydown.exact.meta.a=\"selectAllTags\"\n @keydown.exact.enter=\"onKeydownEnter\"\n @keydown.exact.space=\"onKeydownSpace\"\n @keydown.exact.arrow-up=\"onKeydownUp\"\n @keydown.exact.arrow-down=\"onKeydownDown\"\n @keydown.exact.arrow-left=\"onKeydownLeft()\"\n @keydown.exact.shift.arrow-left=\"onKeydownLeft(true)\"\n @keydown.exact.arrow-right=\"onKeydownRight()\"\n @keydown.exact.shift.arrow-right=\"onKeydownRight(true)\"\n @keydown.esc=\"onEscape\"\n @blur=\"onBlur\"\n @focus=\"onFocus\">\n </div>\n </div>\n </slot>\n\n <div class=\"form-control-activity-indicator\">\n <slot name=\"activity\" v-bind=\"{ canClear, clear, isInteractive }\">\n <button\n v-if=\"canClear\"\n type=\"button\"\n class=\"tag-field-clear-button\"\n @click.stop=\"clear\">\n <XMarkIcon class=\"size-[1.25em]\" />\n </button>\n <Transition name=\"tag-field-fade\" v-else>\n <ActivityIndicator\n v-if=\"props.activity && props.indicator\"\n key=\"activity\"\n :type=\"props.indicator\"\n :size=\"props.indicatorSize\" />\n </Transition>\n </slot>\n </div>\n </div>\n\n <div\n v-if=\"showOptions\"\n tabindex=\"-1\"\n class=\"tag-field-dropdown\"\n :class=\"size\"\n @mousedown.prevent.stop>\n <button\n v-for=\"(option, i) in filtered\"\n :key=\"`option-${JSON.stringify(option)}`\"\n type=\"button\"\n tabindex=\"-1\"\n :class=\"{\n ['bg-neutral-100 dark:bg-neutral-800']: focusIndex === i\n }\"\n @mousedown.prevent\n @mouseup=\"addTag(option)\">\n <div class=\"truncate\">\n {{ display?.(option) ?? option }}\n </div>\n </button>\n <button\n v-if=\"allowCustom && input\"\n class=\"flex items-center gap-1\"\n type=\"button\"\n @mousedown.prevent\n @mouseup=\"onClickAddTag\">\n <PlusIcon class=\"size-4\" /> {{ addTagLabel }}\n </button>\n <div\n v-if=\"showNoResults && !filtered.length && !allowCustom\"\n class=\"py-2 px-4 text-neutral-400 dark:text-neutral-500\">\n <slot name=\"no-results\" :input=\"input\">\n {{ noResultsText }}\n </slot>\n </div>\n </div>\n\n <slot\n name=\"errors\"\n v-bind=\"{ error, errors, id: $attrs.id, name: $attrs.name }\">\n <FormControlErrors\n v-if=\"!!(error || errors)\"\n :id=\"id\"\n v-slot=\"{ error }\"\n :name=\"name\"\n :error=\"error\"\n :errors=\"errors\">\n <div\n invalid\n class=\"invalid-feedback\">\n {{ error }}\n </div>\n </FormControlErrors>\n </slot>\n\n <slot\n name=\"feedback\"\n v-bind=\"{ feedback }\">\n <FormControlFeedback\n v-slot=\"{ feedback }\"\n :feedback=\"feedback\">\n <div\n valid\n class=\"valid-feedback\">\n {{ feedback }}\n </div>\n </FormControlFeedback>\n </slot>\n\n <slot\n name=\"help\"\n v-bind=\"{ helpText }\">\n <small\n v-if=\"helpText\"\n class=\"form-help\">\n {{ helpText }}\n </small>\n </slot>\n </div>\n</template>\n"],"names":["render","_ctx","_cache","_openBlock","_createElementBlock","_createElementVNode","props","__props","model","_useModel","emit","__emit","controlAttributes","formGroupClasses","listeners","useFormControl","wrapperEl","useTemplateRef","inputEl","tagEl","input","ref","selected","hasFocus","focusIndex","options","isInteractive","computed","canClear","keys","fuse","createFuse","showOptions","filtered","selectedIndexes","tag","item","isEqual","watch","deactivateTags","items","Fuse","option","toRaw","unref","addCustomTag","value","addTag","removeTag","deactivateTag","toggleActiveTag","multiple","isTagActive","activateTag","toggleActiveTagRange","index","lastSelectedIndex","fn","range","selectAllTags","omit","tags","blurTags","removeActiveTags","onBackspace","onKeydownEnter","e","onKeydownSpace","onKeydownUp","onKeydownDown","onKeydownLeft","nextIndex","onKeydownRight","onEscape","onBlur","onFocus","onClickAddTag","clear","onClickOutsideWrapper","onDocumentKeydown","onBeforeMount","onBeforeUnmount","_normalizeClass","_unref","_renderSlot","_hoisted_1","_hoisted_2","_normalizeProps","_guardReactiveProps","$slots","$event","_mergeProps","$attrs","_withModifiers","_hoisted_3","_Fragment","_renderList","i","_createBlock","Badge","_createVNode","XMarkIcon","_hoisted_5","_Transition","ActivityIndicator","_hoisted_7","_toDisplayString","PlusIcon","_createTextVNode","_hoisted_8","FormControlErrors","_withCtx","error","_hoisted_9","FormControlFeedback","feedback","_hoisted_10","_hoisted_11"],"mappings":"qnBAEe,SAASA,EAAOC,EAAMC,EAAQ,CAC3C,OAAQC,EAAAA,UAAU,EAAIC,EAAAA,mBAAoB,MAAO,CAC/C,MAAO,6BACP,KAAM,OACN,QAAS,YACT,eAAgB,MAChB,OAAQ,eACR,cAAe,OACf,YAAa,MACjB,EAAK,CACDC,EAAAA,mBAAoB,OAAQ,CAC1B,iBAAkB,QAClB,kBAAmB,QACnB,EAAG,wBACT,CAAK,CACL,CAAG,CACH,CChBe,SAASL,EAAOC,EAAMC,EAAQ,CAC3C,OAAQC,EAAAA,UAAU,EAAIC,EAAAA,mBAAoB,MAAO,CAC/C,MAAO,6BACP,KAAM,OACN,QAAS,YACT,eAAgB,MAChB,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AA,CAAA,CAAA,oEAK5B6E,EAAAA,WAgBOnF,EAAA,OAAA,SAAAsF,EAAAA,eAAAC,qBAAA,CAAA,MAdOjF,EAAA,MAAK,OAAEA,EAAA,OAAM,GAAMqF,EAAAA,OAAO,GAAE,KAAQA,EAAAA,OAAO,QAFzD,IAgBO,CAZUrF,EAAA,OAASA,EAAA,sBADtB2F,EAAAA,YAYoBf,QAAA2B,EAAAA,iBAAA,EAAA,OAVf,GAAIvG,EAAA,GAEJ,KAAMA,EAAA,KACN,MAAOA,EAAA,MACP,OAAQA,EAAA,MAAA,GACT,QAAAwG,EAAAA,QAAA,CAIM,CARI,MAAAC,KAAK,CAIf3G,EAAAA,mBAIM,MAJN4G,GAIMP,EAAAA,gBADCM,CAAK,EAAA,CAAA,CAAA,yEAKpB5B,EAAAA,WAYOnF,EAAA,OAAA,WAAAsF,EAAAA,eAAAC,EAAAA,mBAAA,CAAA,SAVOjF,EAAA,QAAA,CAAQ,CAAA,EAFtB,IAYO,CATH6F,EAAAA,YAQsBjB,EAAAA,MAAA+B,qBAAA,EAAA,CANjB,SAAU3G,EAAA,UAAQ,CACnB,QAAAwG,EAAAA,QAAA,CAIM,CANI,SAAAI,KAAQ,CAElB9G,EAAAA,mBAIM,MAJN+G,GAIMV,EAAAA,gBADCS,CAAQ,EAAA,CAAA,CAAA,0BAKvB/B,EAAAA,WAQOnF,EAAA,OAAA,OAAAsF,EAAAA,eAAAC,EAAAA,mBAAA,CAAA,SANOjF,EAAA,QAAA,CAAQ,CAAA,EAFtB,IAQO,CAJOA,EAAA,wBADVH,EAAAA,mBAIQ,QAJRiH,GAIQX,EAAAA,gBADDnG,EAAA,QAAQ,EAAA,CAAA","x_google_ignoreList":[0,1]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-interface/tag-field",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A Vue tag field component.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/tag-field.umd.cjs",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"style": "./index.css",
|
|
14
14
|
"import": "./dist/tag-field.js",
|
|
15
15
|
"require": "./dist/tag-field.umd.cjs"
|
|
16
|
-
}
|
|
16
|
+
},
|
|
17
|
+
"./css": "./index.css"
|
|
17
18
|
},
|
|
18
19
|
"browserslist": "last 2 versions, > 0.5%, ie >= 11",
|
|
19
20
|
"repository": {
|
|
@@ -47,9 +48,9 @@
|
|
|
47
48
|
"fuse.js": "^7.1.0",
|
|
48
49
|
"lodash-es": "^4.17.23",
|
|
49
50
|
"vue": "^3.3.4",
|
|
50
|
-
"@vue-interface/badge": "3.1.4",
|
|
51
|
-
"@vue-interface/sizeable": "2.0.0",
|
|
52
51
|
"@vue-interface/activity-indicator": "3.0.8",
|
|
52
|
+
"@vue-interface/badge": "3.1.5",
|
|
53
|
+
"@vue-interface/sizeable": "2.0.0",
|
|
53
54
|
"@vue-interface/form-control": "2.0.23"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|