briicks-selector
Advanced tools
Comparing version 0.0.5 to 0.0.7
@@ -1,2 +0,2 @@ | ||
import { openBlock as u, createBlock as c, withKeys as g, withModifiers as o, renderSlot as a, createVNode as r, withDirectives as w, Fragment as P, renderList as D, toDisplayString as f, vShow as $, createCommentVNode as b, Transition as T, withCtx as v, createTextVNode as S, createElementBlock as L, createElementVNode as h, resolveComponent as V, mergeProps as E, toHandlers as K, createSlots as N, normalizeProps as F, normalizeStyle as G } from "vue"; | ||
import { openBlock as u, createBlock as c, withKeys as b, withModifiers as o, renderSlot as h, createVNode as r, withDirectives as w, Fragment as P, renderList as D, toDisplayString as f, vShow as $, createCommentVNode as v, Transition as T, withCtx as m, createTextVNode as S, createElementBlock as L, createElementVNode as a, resolveComponent as V, mergeProps as E, toHandlers as K, createSlots as N, normalizeProps as F, normalizeStyle as G } from "vue"; | ||
function C(e) { | ||
@@ -11,3 +11,3 @@ return e === 0 ? !1 : Array.isArray(e) && e.length === 0 ? !0 : !e; | ||
} | ||
function A(e, t, i, l) { | ||
function H(e, t, i, l) { | ||
return t ? e.filter((d) => q(l(d, i), t)).sort((d, n) => l(d, i).length - l(n, i).length) : e; | ||
@@ -28,3 +28,3 @@ } | ||
return console.warn("Options passed to vue-multiselect do not contain groups, despite the config."), []; | ||
const p = A(s[i], e, t, d); | ||
const p = H(s[i], e, t, d); | ||
return p.length ? { | ||
@@ -36,3 +36,3 @@ [l]: s[l], | ||
} | ||
const H = (...e) => (t) => e.reduce((i, l) => l(i), t); | ||
const _ = (...e) => (t) => e.reduce((i, l) => l(i), t); | ||
var I = { | ||
@@ -158,3 +158,3 @@ data() { | ||
let i = this.options.concat(); | ||
return this.internalSearch ? i = this.groupValues ? this.filterAndFlat(i, t, this.label) : A(i, t, this.label, this.customLabel) : i = this.groupValues ? k(this.groupValues, this.groupLabel)(i) : i, i = this.hideSelected ? i.filter(R(this.isSelected)) : i, this.taggable && t.length && !this.isExistingOption(t) && (this.tagPosition === "bottom" ? i.push({ isTag: !0, label: e }) : i.unshift({ isTag: !0, label: e })), i.slice(0, this.optionsLimit); | ||
return this.internalSearch ? i = this.groupValues ? this.filterAndFlat(i, t, this.label) : H(i, t, this.label, this.customLabel) : i = this.groupValues ? k(this.groupValues, this.groupLabel)(i) : i, i = this.hideSelected ? i.filter(R(this.isSelected)) : i, this.taggable && t.length && !this.isExistingOption(t) && (this.tagPosition === "bottom" ? i.push({ isTag: !0, label: e }) : i.unshift({ isTag: !0, label: e })), i.slice(0, this.optionsLimit); | ||
}, | ||
@@ -185,3 +185,3 @@ valueKeys() { | ||
filterAndFlat(e, t, i) { | ||
return H( | ||
return _( | ||
j(t, i, this.groupValues, this.groupLabel, this.customLabel), | ||
@@ -192,3 +192,3 @@ k(this.groupValues, this.groupLabel) | ||
flatAndStrip(e) { | ||
return H( | ||
return _( | ||
k(this.groupValues, this.groupLabel), | ||
@@ -377,3 +377,3 @@ z | ||
} | ||
}, _ = { | ||
}, A = { | ||
name: "vue-multiselect", | ||
@@ -506,11 +506,11 @@ mixins: [I, Z], | ||
onKeydown: [ | ||
t[16] || (t[16] = g(o((s) => e.pointerForward(), ["self", "prevent"]), ["down"])), | ||
t[17] || (t[17] = g(o((s) => e.pointerBackward(), ["self", "prevent"]), ["up"])) | ||
t[16] || (t[16] = b(o((s) => e.pointerForward(), ["self", "prevent"]), ["down"])), | ||
t[17] || (t[17] = b(o((s) => e.pointerBackward(), ["self", "prevent"]), ["up"])) | ||
], | ||
onKeypress: t[18] || (t[18] = g(o((s) => e.addPointerElement(s), ["stop", "self"]), ["enter", "tab"])), | ||
onKeyup: t[19] || (t[19] = g((s) => e.deactivate(), ["esc"])), | ||
onKeypress: t[18] || (t[18] = b(o((s) => e.addPointerElement(s), ["stop", "self"]), ["enter", "tab"])), | ||
onKeyup: t[19] || (t[19] = b((s) => e.deactivate(), ["esc"])), | ||
role: "combobox", | ||
"aria-owns": "listbox-" + e.id | ||
}, [ | ||
a(e.$slots, "caret", { toggle: e.toggle }, () => [ | ||
h(e.$slots, "caret", { toggle: e.toggle }, () => [ | ||
r("div", { | ||
@@ -521,5 +521,5 @@ onMousedown: t[1] || (t[1] = o((s) => e.toggle(), ["prevent", "stop"])), | ||
]), | ||
a(e.$slots, "clear", { search: e.search }), | ||
h(e.$slots, "clear", { search: e.search }), | ||
r("div", U, [ | ||
a(e.$slots, "selection", { | ||
h(e.$slots, "selection", { | ||
search: e.search, | ||
@@ -531,3 +531,3 @@ remove: e.removeElement, | ||
w(r("div", W, [ | ||
(u(!0), c(P, null, D(n.visibleValues, (s, p) => a(e.$slots, "tag", { | ||
(u(!0), c(P, null, D(n.visibleValues, (s, p) => h(e.$slots, "tag", { | ||
option: s, | ||
@@ -546,3 +546,3 @@ search: e.search, | ||
tabindex: "1", | ||
onKeypress: g(o((y) => e.removeElement(s), ["prevent"]), ["enter"]), | ||
onKeypress: b(o((y) => e.removeElement(s), ["prevent"]), ["enter"]), | ||
onMousedown: o((y) => e.removeElement(s), ["prevent"]), | ||
@@ -556,3 +556,3 @@ class: "multiselect__tag-icon" | ||
]), | ||
e.internalValue && e.internalValue.length > i.limit ? a(e.$slots, "limit", { key: 0 }, () => [ | ||
e.internalValue && e.internalValue.length > i.limit ? h(e.$slots, "limit", { key: 0 }, () => [ | ||
r("strong", { | ||
@@ -562,7 +562,7 @@ class: "multiselect__strong", | ||
}, null, 8, ["textContent"]) | ||
]) : b("v-if", !0) | ||
]) : v("v-if", !0) | ||
]), | ||
r(T, { name: "multiselect__loading" }, { | ||
default: v(() => [ | ||
a(e.$slots, "loading", {}, () => [ | ||
default: m(() => [ | ||
h(e.$slots, "loading", {}, () => [ | ||
w(r("div", J, null, 512), [ | ||
@@ -591,12 +591,12 @@ [$, i.loading] | ||
onBlur: t[4] || (t[4] = o((s) => e.deactivate(), ["prevent"])), | ||
onKeyup: t[5] || (t[5] = g((s) => e.deactivate(), ["esc"])), | ||
onKeyup: t[5] || (t[5] = b((s) => e.deactivate(), ["esc"])), | ||
onKeydown: [ | ||
t[6] || (t[6] = g(o((s) => e.pointerForward(), ["prevent"]), ["down"])), | ||
t[7] || (t[7] = g(o((s) => e.pointerBackward(), ["prevent"]), ["up"])), | ||
t[9] || (t[9] = g(o((s) => e.removeLastElement(), ["stop"]), ["delete"])) | ||
t[6] || (t[6] = b(o((s) => e.pointerForward(), ["prevent"]), ["down"])), | ||
t[7] || (t[7] = b(o((s) => e.pointerBackward(), ["prevent"]), ["up"])), | ||
t[9] || (t[9] = b(o((s) => e.removeLastElement(), ["stop"]), ["delete"])) | ||
], | ||
onKeypress: t[8] || (t[8] = g(o((s) => e.addPointerElement(s), ["prevent", "stop", "self"]), ["enter"])), | ||
onKeypress: t[8] || (t[8] = b(o((s) => e.addPointerElement(s), ["prevent", "stop", "self"]), ["enter"])), | ||
class: "multiselect__input", | ||
"aria-controls": "listbox-" + e.id | ||
}, null, 44, ["name", "id", "placeholder", "value", "disabled", "tabindex", "aria-controls"])) : b("v-if", !0), | ||
}, null, 44, ["name", "id", "placeholder", "value", "disabled", "tabindex", "aria-controls"])) : v("v-if", !0), | ||
n.isSingleLabelVisible ? (u(), c("span", { | ||
@@ -607,6 +607,6 @@ key: 1, | ||
}, [ | ||
a(e.$slots, "singleLabel", { option: n.singleValue }, () => [ | ||
h(e.$slots, "singleLabel", { option: n.singleValue }, () => [ | ||
S(f(e.currentOptionLabel), 1) | ||
]) | ||
], 32)) : b("v-if", !0), | ||
], 32)) : v("v-if", !0), | ||
n.isPlaceholderVisible ? (u(), c("span", { | ||
@@ -617,9 +617,9 @@ key: 2, | ||
}, [ | ||
a(e.$slots, "placeholder", {}, () => [ | ||
h(e.$slots, "placeholder", {}, () => [ | ||
S(f(e.placeholder), 1) | ||
]) | ||
], 32)) : b("v-if", !0) | ||
], 32)) : v("v-if", !0) | ||
], 512), | ||
r(T, { name: "multiselect" }, { | ||
default: v(() => [ | ||
default: m(() => [ | ||
w(r("div", { | ||
@@ -640,10 +640,10 @@ class: "multiselect__content-wrapper", | ||
}, [ | ||
a(e.$slots, "beforeList"), | ||
h(e.$slots, "beforeList"), | ||
e.multiple && e.max === e.internalValue.length ? (u(), c("li", Q, [ | ||
r("span", X, [ | ||
a(e.$slots, "maxElements", {}, () => [ | ||
h(e.$slots, "maxElements", {}, () => [ | ||
S("Maximum of " + f(e.max) + " options selected. First remove a selected option to select another.", 1) | ||
]) | ||
]) | ||
])) : b("v-if", !0), | ||
])) : v("v-if", !0), | ||
!e.max || e.internalValue.length < e.max ? (u(!0), c(P, { key: 1 }, D(e.filteredOptions, (s, p) => (u(), c("li", { | ||
@@ -655,3 +655,3 @@ class: "multiselect__element", | ||
}, [ | ||
s && (s.$isLabel || s.$isDisabled) ? b("v-if", !0) : (u(), c("span", { | ||
s && (s.$isLabel || s.$isDisabled) ? v("v-if", !0) : (u(), c("span", { | ||
key: 0, | ||
@@ -665,3 +665,3 @@ class: [e.optionHighlight(p, s), "multiselect__option"], | ||
}, [ | ||
a(e.$slots, "option", { | ||
h(e.$slots, "option", { | ||
option: s, | ||
@@ -682,3 +682,3 @@ search: e.search, | ||
}, [ | ||
a(e.$slots, "option", { | ||
h(e.$slots, "option", { | ||
option: s, | ||
@@ -690,7 +690,7 @@ search: e.search, | ||
]) | ||
], 42, ["data-select", "data-deselect", "onMouseenter", "onMousedown"])) : b("v-if", !0) | ||
], 8, ["id", "role"]))), 128)) : b("v-if", !0), | ||
], 42, ["data-select", "data-deselect", "onMouseenter", "onMousedown"])) : v("v-if", !0) | ||
], 8, ["id", "role"]))), 128)) : v("v-if", !0), | ||
w(r("li", null, [ | ||
r("span", Y, [ | ||
a(e.$slots, "noResult", { search: e.search }, () => [ | ||
h(e.$slots, "noResult", { search: e.search }, () => [ | ||
x | ||
@@ -704,3 +704,3 @@ ]) | ||
r("span", ee, [ | ||
a(e.$slots, "noOptions", {}, () => [ | ||
h(e.$slots, "noOptions", {}, () => [ | ||
te | ||
@@ -712,3 +712,3 @@ ]) | ||
]), | ||
a(e.$slots, "afterList") | ||
h(e.$slots, "afterList") | ||
], 12, ["id"]) | ||
@@ -723,3 +723,3 @@ ], 36), [ | ||
} | ||
_.render = ie; | ||
A.render = ie; | ||
const B = (e, t) => { | ||
@@ -736,4 +736,4 @@ const i = e.__vccOpts || e; | ||
xmlns: "http://www.w3.org/2000/svg" | ||
}, ne = /* @__PURE__ */ h("g", { "clip-path": "url(#clip0_3229_23142)" }, [ | ||
/* @__PURE__ */ h("path", { | ||
}, ne = /* @__PURE__ */ a("g", { "clip-path": "url(#clip0_3229_23142)" }, [ | ||
/* @__PURE__ */ a("path", { | ||
"fill-rule": "evenodd", | ||
@@ -744,5 +744,5 @@ "clip-rule": "evenodd", | ||
}) | ||
], -1), re = /* @__PURE__ */ h("defs", null, [ | ||
/* @__PURE__ */ h("clipPath", { id: "clip0_3229_23142" }, [ | ||
/* @__PURE__ */ h("rect", { | ||
], -1), re = /* @__PURE__ */ a("defs", null, [ | ||
/* @__PURE__ */ a("clipPath", { id: "clip0_3229_23142" }, [ | ||
/* @__PURE__ */ a("rect", { | ||
width: "12", | ||
@@ -770,4 +770,4 @@ height: "12", | ||
xmlns: "http://www.w3.org/2000/svg" | ||
}, pe = /* @__PURE__ */ h("g", { "clip-path": "url(#clip0_2_10015)" }, [ | ||
/* @__PURE__ */ h("path", { | ||
}, pe = /* @__PURE__ */ a("g", { "clip-path": "url(#clip0_2_10015)" }, [ | ||
/* @__PURE__ */ a("path", { | ||
"fill-rule": "evenodd", | ||
@@ -777,5 +777,5 @@ "clip-rule": "evenodd", | ||
}) | ||
], -1), ce = /* @__PURE__ */ h("defs", null, [ | ||
/* @__PURE__ */ h("clipPath", { id: "clip0_2_10015" }, [ | ||
/* @__PURE__ */ h("rect", { | ||
], -1), ce = /* @__PURE__ */ a("defs", null, [ | ||
/* @__PURE__ */ a("clipPath", { id: "clip0_2_10015" }, [ | ||
/* @__PURE__ */ a("rect", { | ||
width: "16", | ||
@@ -833,3 +833,3 @@ height: "16", | ||
components: { | ||
Multiselect: _, | ||
Multiselect: A, | ||
Close12: he, | ||
@@ -932,4 +932,4 @@ Checkmark: ge | ||
class: "selected-icon" | ||
}, Oe = { class: "tag-limit" }, Ve = { class: "multiselect-caret" }, Ce = ["src"]; | ||
function ke(e, t, i, l, d, n) { | ||
}, Oe = { class: "tag-limit" }, Ve = { class: "multiselect-caret" }, Ce = ["src"], ke = /* @__PURE__ */ a("div", null, null, -1); | ||
function De(e, t, i, l, d, n) { | ||
const s = V("Close12"), p = V("Checkmark"), y = V("multiselect"); | ||
@@ -944,35 +944,38 @@ return u(), c(y, E({ | ||
}), N({ | ||
tag: v(({ option: m, remove: M }) => [ | ||
h("div", ve, [ | ||
h("span", null, f(m.label), 1), | ||
tag: m(({ option: g, remove: M }) => [ | ||
a("div", ve, [ | ||
a("span", null, f(g.label), 1), | ||
r(s, { | ||
onClick: (O) => M(m) | ||
onClick: (O) => M(g) | ||
}, null, 8, ["onClick"]) | ||
]) | ||
]), | ||
placeholder: v(() => [ | ||
h("div", ye, f(i.placeholder), 1) | ||
placeholder: m(() => [ | ||
a("div", ye, f(i.placeholder), 1) | ||
]), | ||
singleLabel: v(({ option: m }) => [ | ||
h("div", we, f((m ? m.label : "") || ""), 1) | ||
singleLabel: m(({ option: g }) => [ | ||
a("div", we, f((g ? g.label : "") || ""), 1) | ||
]), | ||
option: v(({ option: m }) => [ | ||
i.mode === "multi" ? (u(), L("div", $e)) : b("", !0), | ||
h("span", Se, f(m.label), 1), | ||
option: m(({ option: g }) => [ | ||
i.mode === "multi" ? (u(), L("div", $e)) : v("", !0), | ||
a("span", Se, f(g.label), 1), | ||
i.mode === "single" ? (u(), L("span", Le, [ | ||
r(p) | ||
])) : b("", !0) | ||
])) : v("", !0) | ||
]), | ||
limit: v(() => [ | ||
h("div", Oe, "+" + f(n.tagCount - this.limit), 1) | ||
limit: m(() => [ | ||
a("div", Oe, "+" + f(n.tagCount - this.limit), 1) | ||
]), | ||
clear: v(() => [ | ||
a(e.$slots, "prefix") | ||
noOptions: m(() => [ | ||
ke | ||
]), | ||
clear: m(() => [ | ||
h(e.$slots, "prefix") | ||
]), | ||
_: 2 | ||
}, [ | ||
D(Object.keys(e.$slots), (m, M) => ({ | ||
name: m, | ||
fn: v((O) => [ | ||
O ? a(e.$slots, m, F(E({ key: 0 }, O))) : a(e.$slots, e.name, { key: 1 }) | ||
D(Object.keys(e.$slots), (g, M) => ({ | ||
name: g, | ||
fn: m((O) => [ | ||
O ? h(e.$slots, g, F(E({ key: 0 }, O))) : h(e.$slots, e.name, { key: 1 }) | ||
]) | ||
@@ -982,5 +985,5 @@ })), | ||
name: "caret", | ||
fn: v(() => [ | ||
h("div", Ve, [ | ||
h("img", { | ||
fn: m(() => [ | ||
a("div", Ve, [ | ||
a("img", { | ||
style: G(n.caretStyle), | ||
@@ -995,5 +998,5 @@ src: require("./arrow-down-16.svg") | ||
} | ||
const Be = /* @__PURE__ */ B(be, [["render", ke]]); | ||
const Me = /* @__PURE__ */ B(be, [["render", De]]); | ||
export { | ||
Be as BriicksSelector | ||
Me as BriicksSelector | ||
}; |
@@ -1,1 +0,1 @@ | ||
(function(d,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(d=typeof globalThis<"u"?globalThis:d||self,t(d.BriicksSelector={},d.Vue))})(this,function(d,t){"use strict";function p(e){return e===0?!1:Array.isArray(e)&&e.length===0?!0:!e}function V(e){return(...i)=>!e(...i)}function S(e,i){return e===void 0&&(e="undefined"),e===null&&(e="null"),e===!1&&(e="false"),e.toString().toLowerCase().indexOf(i.trim())!==-1}function g(e,i,s,r){return i?e.filter(o=>S(r(o,s),i)).sort((o,n)=>r(o,s).length-r(n,s).length):e}function $(e){return e.filter(i=>!i.$isLabel)}function u(e,i){return s=>s.reduce((r,o)=>o[e]&&o[e].length?(r.push({$groupLabel:o[i],$isLabel:!0}),r.concat(o[e])):r,[])}function L(e,i,s,r,o){return n=>n.map(l=>{if(!l[s])return console.warn("Options passed to vue-multiselect do not contain groups, despite the config."),[];const a=g(l[s],e,i,o);return a.length?{[r]:l[r],[s]:a}:[]})}const b=(...e)=>i=>e.reduce((s,r)=>r(s),i);var O={data(){return{search:"",isOpen:!1,preferredOpenDirection:"below",optimizedHeight:this.maxHeight}},props:{internalSearch:{type:Boolean,default:!0},options:{type:Array,required:!0},multiple:{type:Boolean,default:!1},trackBy:{type:String},label:{type:String},searchable:{type:Boolean,default:!0},clearOnSelect:{type:Boolean,default:!0},hideSelected:{type:Boolean,default:!1},placeholder:{type:String,default:"Select option"},allowEmpty:{type:Boolean,default:!0},resetAfter:{type:Boolean,default:!1},closeOnSelect:{type:Boolean,default:!0},customLabel:{type:Function,default(e,i){return p(e)?"":i?e[i]:e}},taggable:{type:Boolean,default:!1},tagPlaceholder:{type:String,default:"Press enter to create a tag"},tagPosition:{type:String,default:"top"},max:{type:[Number,Boolean],default:!1},id:{default:null},optionsLimit:{type:Number,default:1e3},groupValues:{type:String},groupLabel:{type:String},groupSelect:{type:Boolean,default:!1},blockKeys:{type:Array,default(){return[]}},preserveSearch:{type:Boolean,default:!1},preselectFirst:{type:Boolean,default:!1}},mounted(){!this.multiple&&this.max&&console.warn("[Vue-Multiselect warn]: Max prop should not be used when prop Multiple equals false."),this.preselectFirst&&!this.internalValue.length&&this.options.length&&this.select(this.filteredOptions[0])},computed:{internalValue(){return this.modelValue||this.modelValue===0?Array.isArray(this.modelValue)?this.modelValue:[this.modelValue]:[]},filteredOptions(){const e=this.search||"",i=e.toLowerCase().trim();let s=this.options.concat();return this.internalSearch?s=this.groupValues?this.filterAndFlat(s,i,this.label):g(s,i,this.label,this.customLabel):s=this.groupValues?u(this.groupValues,this.groupLabel)(s):s,s=this.hideSelected?s.filter(V(this.isSelected)):s,this.taggable&&i.length&&!this.isExistingOption(i)&&(this.tagPosition==="bottom"?s.push({isTag:!0,label:e}):s.unshift({isTag:!0,label:e})),s.slice(0,this.optionsLimit)},valueKeys(){return this.trackBy?this.internalValue.map(e=>e[this.trackBy]):this.internalValue},optionKeys(){return(this.groupValues?this.flatAndStrip(this.options):this.options).map(i=>this.customLabel(i,this.label).toString().toLowerCase())},currentOptionLabel(){return this.multiple?this.searchable?"":this.placeholder:this.internalValue.length?this.getOptionLabel(this.internalValue[0]):this.searchable?"":this.placeholder}},watch:{internalValue(){this.resetAfter&&this.internalValue.length&&(this.search="",this.$emit("update:modelValue",this.multiple?[]:null))},search(){this.$emit("search-change",this.search)}},emits:["open","search-change","close","select","update:modelValue","remove","tag"],methods:{getValue(){return this.multiple?this.internalValue:this.internalValue.length===0?null:this.internalValue[0]},filterAndFlat(e,i,s){return b(L(i,s,this.groupValues,this.groupLabel,this.customLabel),u(this.groupValues,this.groupLabel))(e)},flatAndStrip(e){return b(u(this.groupValues,this.groupLabel),$)(e)},updateSearch(e){this.search=e},isExistingOption(e){return this.options?this.optionKeys.indexOf(e)>-1:!1},isSelected(e){const i=this.trackBy?e[this.trackBy]:e;return this.valueKeys.indexOf(i)>-1},isOptionDisabled(e){return!!e.$isDisabled},getOptionLabel(e){if(p(e))return"";if(e.isTag)return e.label;if(e.$isLabel)return e.$groupLabel;const i=this.customLabel(e,this.label);return p(i)?"":i},select(e,i){if(e.$isLabel&&this.groupSelect){this.selectGroup(e);return}if(!(this.blockKeys.indexOf(i)!==-1||this.disabled||e.$isDisabled||e.$isLabel)&&!(this.max&&this.multiple&&this.internalValue.length===this.max)&&!(i==="Tab"&&!this.pointerDirty)){if(e.isTag)this.$emit("tag",e.label,this.id),this.search="",this.closeOnSelect&&!this.multiple&&this.deactivate();else{if(this.isSelected(e)){i!=="Tab"&&this.removeElement(e);return}this.$emit("select",e,this.id),this.multiple?this.$emit("update:modelValue",this.internalValue.concat([e])):this.$emit("update:modelValue",e),this.clearOnSelect&&(this.search="")}this.closeOnSelect&&this.deactivate()}},selectGroup(e){const i=this.options.find(s=>s[this.groupLabel]===e.$groupLabel);if(!!i){if(this.wholeGroupSelected(i)){this.$emit("remove",i[this.groupValues],this.id);const s=this.internalValue.filter(r=>i[this.groupValues].indexOf(r)===-1);this.$emit("update:modelValue",s)}else{const s=i[this.groupValues].filter(r=>!(this.isOptionDisabled(r)||this.isSelected(r)));this.$emit("select",s,this.id),this.$emit("update:modelValue",this.internalValue.concat(s))}this.closeOnSelect&&this.deactivate()}},wholeGroupSelected(e){return e[this.groupValues].every(i=>this.isSelected(i)||this.isOptionDisabled(i))},wholeGroupDisabled(e){return e[this.groupValues].every(this.isOptionDisabled)},removeElement(e,i=!0){if(this.disabled||e.$isDisabled)return;if(!this.allowEmpty&&this.internalValue.length<=1){this.deactivate();return}const s=typeof e=="object"?this.valueKeys.indexOf(e[this.trackBy]):this.valueKeys.indexOf(e);if(this.$emit("remove",e,this.id),this.multiple){const r=this.internalValue.slice(0,s).concat(this.internalValue.slice(s+1));this.$emit("update:modelValue",r)}else this.$emit("update:modelValue",null);this.closeOnSelect&&i&&this.deactivate()},removeLastElement(){this.blockKeys.indexOf("Delete")===-1&&this.search.length===0&&Array.isArray(this.internalValue)&&this.internalValue.length&&this.removeElement(this.internalValue[this.internalValue.length-1],!1)},activate(){this.isOpen||this.disabled||(this.adjustPosition(),this.groupValues&&this.pointer===0&&this.filteredOptions.length&&(this.pointer=1),this.isOpen=!0,this.searchable?(this.preserveSearch||(this.search=""),this.$nextTick(()=>this.$refs.search&&this.$refs.search.focus())):this.$el.focus(),this.$emit("open",this.id))},deactivate(){!this.isOpen||(this.isOpen=!1,this.searchable?this.$refs.search&&this.$refs.search.blur():this.$el.blur(),this.preserveSearch||(this.search=""),this.$emit("close",this.getValue(),this.id))},toggle(){this.isOpen?this.deactivate():this.activate()},adjustPosition(){if(typeof window>"u")return;const e=this.$el.getBoundingClientRect().top,i=window.innerHeight-this.$el.getBoundingClientRect().bottom;i>this.maxHeight||i>e||this.openDirection==="below"||this.openDirection==="bottom"?(this.preferredOpenDirection="below",this.optimizedHeight=Math.min(i-40,this.maxHeight)):(this.preferredOpenDirection="above",this.optimizedHeight=Math.min(e-40,this.maxHeight))}}},k={data(){return{pointer:0,pointerDirty:!1}},props:{showPointer:{type:Boolean,default:!0},optionHeight:{type:Number,default:40}},computed:{pointerPosition(){return this.pointer*this.optionHeight},visibleElements(){return this.optimizedHeight/this.optionHeight}},watch:{filteredOptions(){this.pointerAdjust()},isOpen(){this.pointerDirty=!1},pointer(){this.$refs.search&&this.$refs.search.setAttribute("aria-activedescendant",this.id+"-"+this.pointer.toString())}},methods:{optionHighlight(e,i){return{"multiselect__option--highlight":e===this.pointer&&this.showPointer,"multiselect__option--selected":this.isSelected(i)}},groupHighlight(e,i){if(!this.groupSelect)return["multiselect__option--disabled",{"multiselect__option--group":i.$isLabel}];const s=this.options.find(r=>r[this.groupLabel]===i.$groupLabel);return s&&!this.wholeGroupDisabled(s)?["multiselect__option--group",{"multiselect__option--highlight":e===this.pointer&&this.showPointer},{"multiselect__option--group-selected":this.wholeGroupSelected(s)}]:"multiselect__option--disabled"},addPointerElement({key:e}="Enter"){this.filteredOptions.length>0&&this.select(this.filteredOptions[this.pointer],e),this.pointerReset()},pointerForward(){this.pointer<this.filteredOptions.length-1&&(this.pointer++,this.$refs.list.scrollTop<=this.pointerPosition-(this.visibleElements-1)*this.optionHeight&&(this.$refs.list.scrollTop=this.pointerPosition-(this.visibleElements-1)*this.optionHeight),this.filteredOptions[this.pointer]&&this.filteredOptions[this.pointer].$isLabel&&!this.groupSelect&&this.pointerForward()),this.pointerDirty=!0},pointerBackward(){this.pointer>0?(this.pointer--,this.$refs.list.scrollTop>=this.pointerPosition&&(this.$refs.list.scrollTop=this.pointerPosition),this.filteredOptions[this.pointer]&&this.filteredOptions[this.pointer].$isLabel&&!this.groupSelect&&this.pointerBackward()):this.filteredOptions[this.pointer]&&this.filteredOptions[0].$isLabel&&!this.groupSelect&&this.pointerForward(),this.pointerDirty=!0},pointerReset(){!this.closeOnSelect||(this.pointer=0,this.$refs.list&&(this.$refs.list.scrollTop=0))},pointerAdjust(){this.pointer>=this.filteredOptions.length-1&&(this.pointer=this.filteredOptions.length?this.filteredOptions.length-1:0),this.filteredOptions.length>0&&this.filteredOptions[this.pointer].$isLabel&&!this.groupSelect&&this.pointerForward()},pointerSet(e){this.pointer=e,this.pointerDirty=!0}}},y={name:"vue-multiselect",mixins:[O,k],props:{name:{type:String,default:""},modelValue:{type:null,default(){return[]}},selectLabel:{type:String,default:"Press enter to select"},selectGroupLabel:{type:String,default:"Press enter to select group"},selectedLabel:{type:String,default:"Selected"},deselectLabel:{type:String,default:"Press enter to remove"},deselectGroupLabel:{type:String,default:"Press enter to deselect group"},showLabels:{type:Boolean,default:!0},limit:{type:Number,default:99999},maxHeight:{type:Number,default:300},limitText:{type:Function,default:e=>`and ${e} more`},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},openDirection:{type:String,default:""},showNoOptions:{type:Boolean,default:!0},showNoResults:{type:Boolean,default:!0},tabindex:{type:Number,default:0}},computed:{isSingleLabelVisible(){return(this.singleValue||this.singleValue===0)&&(!this.isOpen||!this.searchable)&&!this.visibleValues.length},isPlaceholderVisible(){return!this.internalValue.length&&(!this.searchable||!this.isOpen)},visibleValues(){return this.multiple?this.internalValue.slice(0,this.limit):[]},singleValue(){return this.internalValue[0]},deselectLabelText(){return this.showLabels?this.deselectLabel:""},deselectGroupLabelText(){return this.showLabels?this.deselectGroupLabel:""},selectLabelText(){return this.showLabels?this.selectLabel:""},selectGroupLabelText(){return this.showLabels?this.selectGroupLabel:""},selectedLabelText(){return this.showLabels?this.selectedLabel:""},inputStyle(){return this.searchable||this.multiple&&this.modelValue&&this.modelValue.length?this.isOpen?{width:"100%"}:{width:"0",position:"absolute",padding:"0"}:""},contentStyle(){return this.options.length?{display:"inline-block"}:{display:"block"}},isAbove(){return this.openDirection==="above"||this.openDirection==="top"?!0:this.openDirection==="below"||this.openDirection==="bottom"?!1:this.preferredOpenDirection==="above"},showSearchInput(){return this.searchable&&(this.hasSingleSelectedSlot&&(this.visibleSingleValue||this.visibleSingleValue===0)?this.isOpen:!0)}}};const B={ref:"tags",class:"multiselect__tags"},C={class:"multiselect__tags-wrap"},N={class:"multiselect__spinner"},D={key:0},M={class:"multiselect__option"},E={class:"multiselect__option"},T=t.createTextVNode("No elements found. Consider changing the search query."),_={class:"multiselect__option"},P=t.createTextVNode("List is empty.");function K(e,i,s,r,o,n){return t.openBlock(),t.createBlock("div",{tabindex:e.searchable?-1:s.tabindex,class:[{"multiselect--active":e.isOpen,"multiselect--disabled":s.disabled,"multiselect--above":n.isAbove},"multiselect"],onFocus:i[14]||(i[14]=l=>e.activate()),onBlur:i[15]||(i[15]=l=>e.searchable?!1:e.deactivate()),onKeydown:[i[16]||(i[16]=t.withKeys(t.withModifiers(l=>e.pointerForward(),["self","prevent"]),["down"])),i[17]||(i[17]=t.withKeys(t.withModifiers(l=>e.pointerBackward(),["self","prevent"]),["up"]))],onKeypress:i[18]||(i[18]=t.withKeys(t.withModifiers(l=>e.addPointerElement(l),["stop","self"]),["enter","tab"])),onKeyup:i[19]||(i[19]=t.withKeys(l=>e.deactivate(),["esc"])),role:"combobox","aria-owns":"listbox-"+e.id},[t.renderSlot(e.$slots,"caret",{toggle:e.toggle},()=>[t.createVNode("div",{onMousedown:i[1]||(i[1]=t.withModifiers(l=>e.toggle(),["prevent","stop"])),class:"multiselect__select"},null,32)]),t.renderSlot(e.$slots,"clear",{search:e.search}),t.createVNode("div",B,[t.renderSlot(e.$slots,"selection",{search:e.search,remove:e.removeElement,values:n.visibleValues,isOpen:e.isOpen},()=>[t.withDirectives(t.createVNode("div",C,[(t.openBlock(!0),t.createBlock(t.Fragment,null,t.renderList(n.visibleValues,(l,a)=>t.renderSlot(e.$slots,"tag",{option:l,search:e.search,remove:e.removeElement},()=>[(t.openBlock(),t.createBlock("span",{class:"multiselect__tag",key:a},[t.createVNode("span",{textContent:t.toDisplayString(e.getOptionLabel(l))},null,8,["textContent"]),t.createVNode("i",{tabindex:"1",onKeypress:t.withKeys(t.withModifiers(c=>e.removeElement(l),["prevent"]),["enter"]),onMousedown:t.withModifiers(c=>e.removeElement(l),["prevent"]),class:"multiselect__tag-icon"},null,40,["onKeypress","onMousedown"])]))])),256))],512),[[t.vShow,n.visibleValues.length>0]]),e.internalValue&&e.internalValue.length>s.limit?t.renderSlot(e.$slots,"limit",{key:0},()=>[t.createVNode("strong",{class:"multiselect__strong",textContent:t.toDisplayString(s.limitText(e.internalValue.length-s.limit))},null,8,["textContent"])]):t.createCommentVNode("v-if",!0)]),t.createVNode(t.Transition,{name:"multiselect__loading"},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"loading",{},()=>[t.withDirectives(t.createVNode("div",N,null,512),[[t.vShow,s.loading]])])]),_:3}),e.searchable?(t.openBlock(),t.createBlock("input",{key:0,ref:"search",name:s.name,id:e.id,type:"text",autocomplete:"off",spellcheck:"false",placeholder:e.placeholder,style:n.inputStyle,value:e.search,disabled:s.disabled,tabindex:s.tabindex,onInput:i[2]||(i[2]=l=>e.updateSearch(l.target.value)),onFocus:i[3]||(i[3]=t.withModifiers(l=>e.activate(),["prevent"])),onBlur:i[4]||(i[4]=t.withModifiers(l=>e.deactivate(),["prevent"])),onKeyup:i[5]||(i[5]=t.withKeys(l=>e.deactivate(),["esc"])),onKeydown:[i[6]||(i[6]=t.withKeys(t.withModifiers(l=>e.pointerForward(),["prevent"]),["down"])),i[7]||(i[7]=t.withKeys(t.withModifiers(l=>e.pointerBackward(),["prevent"]),["up"])),i[9]||(i[9]=t.withKeys(t.withModifiers(l=>e.removeLastElement(),["stop"]),["delete"]))],onKeypress:i[8]||(i[8]=t.withKeys(t.withModifiers(l=>e.addPointerElement(l),["prevent","stop","self"]),["enter"])),class:"multiselect__input","aria-controls":"listbox-"+e.id},null,44,["name","id","placeholder","value","disabled","tabindex","aria-controls"])):t.createCommentVNode("v-if",!0),n.isSingleLabelVisible?(t.openBlock(),t.createBlock("span",{key:1,class:"multiselect__single",onMousedown:i[10]||(i[10]=t.withModifiers((...l)=>e.toggle&&e.toggle(...l),["prevent"]))},[t.renderSlot(e.$slots,"singleLabel",{option:n.singleValue},()=>[t.createTextVNode(t.toDisplayString(e.currentOptionLabel),1)])],32)):t.createCommentVNode("v-if",!0),n.isPlaceholderVisible?(t.openBlock(),t.createBlock("span",{key:2,class:"multiselect__placeholder",onMousedown:i[11]||(i[11]=t.withModifiers((...l)=>e.toggle&&e.toggle(...l),["prevent"]))},[t.renderSlot(e.$slots,"placeholder",{},()=>[t.createTextVNode(t.toDisplayString(e.placeholder),1)])],32)):t.createCommentVNode("v-if",!0)],512),t.createVNode(t.Transition,{name:"multiselect"},{default:t.withCtx(()=>[t.withDirectives(t.createVNode("div",{class:"multiselect__content-wrapper",onFocus:i[12]||(i[12]=(...l)=>e.activate&&e.activate(...l)),tabindex:"-1",onMousedown:i[13]||(i[13]=t.withModifiers(()=>{},["prevent"])),style:{maxHeight:e.optimizedHeight+"px"},ref:"list"},[t.createVNode("ul",{class:"multiselect__content",style:n.contentStyle,role:"listbox",id:"listbox-"+e.id},[t.renderSlot(e.$slots,"beforeList"),e.multiple&&e.max===e.internalValue.length?(t.openBlock(),t.createBlock("li",D,[t.createVNode("span",M,[t.renderSlot(e.$slots,"maxElements",{},()=>[t.createTextVNode("Maximum of "+t.toDisplayString(e.max)+" options selected. First remove a selected option to select another.",1)])])])):t.createCommentVNode("v-if",!0),!e.max||e.internalValue.length<e.max?(t.openBlock(!0),t.createBlock(t.Fragment,{key:1},t.renderList(e.filteredOptions,(l,a)=>(t.openBlock(),t.createBlock("li",{class:"multiselect__element",key:a,id:e.id+"-"+a,role:l&&(l.$isLabel||l.$isDisabled)?null:"option"},[l&&(l.$isLabel||l.$isDisabled)?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createBlock("span",{key:0,class:[e.optionHighlight(a,l),"multiselect__option"],onClick:t.withModifiers(c=>e.select(l),["stop"]),onMouseenter:t.withModifiers(c=>e.pointerSet(a),["self"]),"data-select":l&&l.isTag?e.tagPlaceholder:n.selectLabelText,"data-selected":n.selectedLabelText,"data-deselect":n.deselectLabelText},[t.renderSlot(e.$slots,"option",{option:l,search:e.search,index:a},()=>[t.createVNode("span",null,t.toDisplayString(e.getOptionLabel(l)),1)])],42,["onClick","onMouseenter","data-select","data-selected","data-deselect"])),l&&(l.$isLabel||l.$isDisabled)?(t.openBlock(),t.createBlock("span",{key:1,"data-select":e.groupSelect&&n.selectGroupLabelText,"data-deselect":e.groupSelect&&n.deselectGroupLabelText,class:[e.groupHighlight(a,l),"multiselect__option"],onMouseenter:t.withModifiers(c=>e.groupSelect&&e.pointerSet(a),["self"]),onMousedown:t.withModifiers(c=>e.selectGroup(l),["prevent"])},[t.renderSlot(e.$slots,"option",{option:l,search:e.search,index:a},()=>[t.createVNode("span",null,t.toDisplayString(e.getOptionLabel(l)),1)])],42,["data-select","data-deselect","onMouseenter","onMousedown"])):t.createCommentVNode("v-if",!0)],8,["id","role"]))),128)):t.createCommentVNode("v-if",!0),t.withDirectives(t.createVNode("li",null,[t.createVNode("span",E,[t.renderSlot(e.$slots,"noResult",{search:e.search},()=>[T])])],512),[[t.vShow,s.showNoResults&&e.filteredOptions.length===0&&e.search&&!s.loading]]),t.withDirectives(t.createVNode("li",null,[t.createVNode("span",_,[t.renderSlot(e.$slots,"noOptions",{},()=>[P])])],512),[[t.vShow,s.showNoOptions&&e.options.length===0&&!e.search&&!s.loading]]),t.renderSlot(e.$slots,"afterList")],12,["id"])],36),[[t.vShow,e.isOpen]])]),_:3})],42,["tabindex","aria-owns"])}y.render=K;const f=(e,i)=>{const s=e.__vccOpts||e;for(const[r,o]of i)s[r]=o;return s},H={},A={width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},F=[t.createElementVNode("g",{"clip-path":"url(#clip0_3229_23142)"},[t.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.20711 0.792893C1.81658 0.402369 1.18342 0.402369 0.792893 0.792893C0.402369 1.18342 0.402369 1.81658 0.792893 2.20711L4.58579 6L0.792893 9.79289C0.402369 10.1834 0.402369 10.8166 0.792893 11.2071C1.18342 11.5976 1.81658 11.5976 2.20711 11.2071L6 7.41421L9.79289 11.2071C10.1834 11.5976 10.8166 11.5976 11.2071 11.2071C11.5976 10.8166 11.5976 10.1834 11.2071 9.79289L7.41421 6L11.2071 2.20711C11.5976 1.81658 11.5976 1.18342 11.2071 0.792893C10.8166 0.402369 10.1834 0.402369 9.79289 0.792893L6 4.58579L2.20711 0.792893Z",fill:"#121826"})],-1),t.createElementVNode("defs",null,[t.createElementVNode("clipPath",{id:"clip0_3229_23142"},[t.createElementVNode("rect",{width:"12",height:"12",fill:"white"})])],-1)];function G(e,i){return t.openBlock(),t.createElementBlock("svg",A,F)}const R=f(H,[["render",G]]),q={props:{color:String}},j={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},z=[t.createElementVNode("g",{"clip-path":"url(#clip0_2_10015)"},[t.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.6051 0.703831C16.0448 1.03801 16.1303 1.66537 15.7962 2.10508L6.29616 14.6051C6.12143 14.835 5.85583 14.9781 5.56771 14.9977C5.27959 15.0173 4.99709 14.9113 4.79289 14.7071L0.292893 10.2071C-0.0976311 9.81658 -0.0976311 9.18341 0.292893 8.79289C0.683417 8.40236 1.31658 8.40236 1.70711 8.79289L5.39703 12.4828L14.2038 0.89491C14.538 0.455202 15.1654 0.369653 15.6051 0.703831Z"})],-1),t.createElementVNode("defs",null,[t.createElementVNode("clipPath",{id:"clip0_2_10015"},[t.createElementVNode("rect",{width:"16",height:"16",fill:"white"})])],-1)];function x(e,i,s,r,o,n){return t.openBlock(),t.createElementBlock("svg",j,z)}const I=f(q,[["render",x]]),ae="",Z={inheritAttrs:!1,props:{limit:Number,scrollableContainerSelector:{type:[Boolean,String],default:!1},preferredOpenDirection:{type:String,validate(e){return["up","down"].includes(e)},default:"down"},offset:{type:Number,default:0},placeholder:String,canClear:Boolean,mode:{required:!0,type:String,validate(e){return["single","multi"].includes(e)}},brand:{type:String,validate(e){return["sndq","struqta","nuvoni","immogeste"].includes(e)},default:"sndq"},caret:Boolean},emits:["remove","select","input","search-change","tag","open","close"],components:{Multiselect:y,Close12:R,Checkmark:I},computed:{listeners(){return{...this.$listeners,open:this.onOpen,close:this.onClose,remove:this.onRemove,select:this.onSelect}},caretStyle(){return{width:"16px",height:"16px",transform:this.preferredOpenDirection==="up"?"rotate(180deg)":""}},tagCount(){return this.$refs.originalMultiselect.internalValue.length}},data(){return{scrollableContainer:null,target:null,isOpen:!1}},methods:{onRemove(e,i){this.$emit("remove",e,i),this.repositionDropDown()},onSelect(e,i){this.$emit("select",e,i),this.repositionDropDown()},onOpen(e){this.isOpen=!0,this.$emit("open",e),this.repositionDropDown()},onClose(e){this.$emit("close",e),this.isOpen=!1},repositionDropDown(){setTimeout(()=>{const e=this.$el.getBoundingClientRect(),i=this.$refs.originalMultiselect;if(!i)return;const s=i.$refs.list;let r=this.preferredOpenDirection;r==="down"&&e.bottom+this.offset<this.$attrs.dropdownMaxHeight&&(r="up"),s.style.width=`${this.$el.clientWidth}px`,s.style.position="fixed",s.style.left=`${e.left}px`,r==="down"?(s.style.top=`${e.bottom+this.offset}px`,s.style.bottom="auto"):(s.style.bottom=`calc(100vh - ${e.bottom}px + ${e.height+this.offset}px)`,s.style.top="auto")})},open(){this.$refs.originalMultiselect.activate(),this.repositionDropDown()},close(){this.$refs.originalMultiselect.deactivate()},toggle(){this.isOpen?this.open():this.close()}},mounted(){this.scrollableContainer=this.scrollableContainerSelector&&document.querySelector(this.scrollableContainerSelector)||window,this.scrollableContainer.addEventListener("scroll",this.repositionDropDown,{passive:!0});const e=this.$refs.originalMultiselect;if(!e)return;const i=e.$refs.list;i.classList.add("briicks-select-body",this.brand);const s=i.parentNode;if(!s)return;const r=s.closest("body");!r||(this.target=r,s.removeChild(i),r.appendChild(i))},beforeUnmount(){const i=this.$refs.originalMultiselect.$refs.list;!this.target||this.target.removeChild(i)},unmounted(){!this.scrollableContainer||this.scrollableContainer.removeEventListener("scroll",this.repositionDropDown)}},U={class:"multiselect__custom-tag"},W={class:"multiselect-placeholder-el"},J={class:"multiselect-single-label"},Q={key:0,class:"checkbox"},X={class:"option-label"},Y={key:1,class:"selected-icon"},v={class:"tag-limit"},ee={class:"multiselect-caret"},te=["src"];function ie(e,i,s,r,o,n){const l=t.resolveComponent("Close12"),a=t.resolveComponent("Checkmark"),c=t.resolveComponent("multiselect");return t.openBlock(),t.createBlock(c,t.mergeProps({class:["briicks_selector",this.brand],ref:"originalMultiselect",multiple:s.mode==="multi"},e.$attrs,t.toHandlers(n.listeners),{placeholder:s.placeholder,limit:s.limit}),t.createSlots({tag:t.withCtx(({option:h,remove:w})=>[t.createElementVNode("div",U,[t.createElementVNode("span",null,t.toDisplayString(h.label),1),t.createVNode(l,{onClick:m=>w(h)},null,8,["onClick"])])]),placeholder:t.withCtx(()=>[t.createElementVNode("div",W,t.toDisplayString(s.placeholder),1)]),singleLabel:t.withCtx(({option:h})=>[t.createElementVNode("div",J,t.toDisplayString((h?h.label:"")||""),1)]),option:t.withCtx(({option:h})=>[s.mode==="multi"?(t.openBlock(),t.createElementBlock("div",Q)):t.createCommentVNode("",!0),t.createElementVNode("span",X,t.toDisplayString(h.label),1),s.mode==="single"?(t.openBlock(),t.createElementBlock("span",Y,[t.createVNode(a)])):t.createCommentVNode("",!0)]),limit:t.withCtx(()=>[t.createElementVNode("div",v,"+"+t.toDisplayString(n.tagCount-this.limit),1)]),clear:t.withCtx(()=>[t.renderSlot(e.$slots,"prefix")]),_:2},[t.renderList(Object.keys(e.$slots),(h,w)=>({name:h,fn:t.withCtx(m=>[m?t.renderSlot(e.$slots,h,t.normalizeProps(t.mergeProps({key:0},m))):t.renderSlot(e.$slots,e.name,{key:1})])})),s.caret?{name:"caret",fn:t.withCtx(()=>[t.createElementVNode("div",ee,[t.createElementVNode("img",{style:t.normalizeStyle(n.caretStyle),src:require("./arrow-down-16.svg")},null,12,te)])]),key:"0"}:void 0]),1040,["class","multiple","placeholder","limit"])}const se=f(Z,[["render",ie]]);d.BriicksSelector=se,Object.defineProperties(d,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
(function(d,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(d=typeof globalThis<"u"?globalThis:d||self,t(d.BriicksSelector={},d.Vue))})(this,function(d,t){"use strict";function p(e){return e===0?!1:Array.isArray(e)&&e.length===0?!0:!e}function V(e){return(...i)=>!e(...i)}function S(e,i){return e===void 0&&(e="undefined"),e===null&&(e="null"),e===!1&&(e="false"),e.toString().toLowerCase().indexOf(i.trim())!==-1}function g(e,i,s,r){return i?e.filter(o=>S(r(o,s),i)).sort((o,n)=>r(o,s).length-r(n,s).length):e}function $(e){return e.filter(i=>!i.$isLabel)}function u(e,i){return s=>s.reduce((r,o)=>o[e]&&o[e].length?(r.push({$groupLabel:o[i],$isLabel:!0}),r.concat(o[e])):r,[])}function L(e,i,s,r,o){return n=>n.map(l=>{if(!l[s])return console.warn("Options passed to vue-multiselect do not contain groups, despite the config."),[];const a=g(l[s],e,i,o);return a.length?{[r]:l[r],[s]:a}:[]})}const b=(...e)=>i=>e.reduce((s,r)=>r(s),i);var O={data(){return{search:"",isOpen:!1,preferredOpenDirection:"below",optimizedHeight:this.maxHeight}},props:{internalSearch:{type:Boolean,default:!0},options:{type:Array,required:!0},multiple:{type:Boolean,default:!1},trackBy:{type:String},label:{type:String},searchable:{type:Boolean,default:!0},clearOnSelect:{type:Boolean,default:!0},hideSelected:{type:Boolean,default:!1},placeholder:{type:String,default:"Select option"},allowEmpty:{type:Boolean,default:!0},resetAfter:{type:Boolean,default:!1},closeOnSelect:{type:Boolean,default:!0},customLabel:{type:Function,default(e,i){return p(e)?"":i?e[i]:e}},taggable:{type:Boolean,default:!1},tagPlaceholder:{type:String,default:"Press enter to create a tag"},tagPosition:{type:String,default:"top"},max:{type:[Number,Boolean],default:!1},id:{default:null},optionsLimit:{type:Number,default:1e3},groupValues:{type:String},groupLabel:{type:String},groupSelect:{type:Boolean,default:!1},blockKeys:{type:Array,default(){return[]}},preserveSearch:{type:Boolean,default:!1},preselectFirst:{type:Boolean,default:!1}},mounted(){!this.multiple&&this.max&&console.warn("[Vue-Multiselect warn]: Max prop should not be used when prop Multiple equals false."),this.preselectFirst&&!this.internalValue.length&&this.options.length&&this.select(this.filteredOptions[0])},computed:{internalValue(){return this.modelValue||this.modelValue===0?Array.isArray(this.modelValue)?this.modelValue:[this.modelValue]:[]},filteredOptions(){const e=this.search||"",i=e.toLowerCase().trim();let s=this.options.concat();return this.internalSearch?s=this.groupValues?this.filterAndFlat(s,i,this.label):g(s,i,this.label,this.customLabel):s=this.groupValues?u(this.groupValues,this.groupLabel)(s):s,s=this.hideSelected?s.filter(V(this.isSelected)):s,this.taggable&&i.length&&!this.isExistingOption(i)&&(this.tagPosition==="bottom"?s.push({isTag:!0,label:e}):s.unshift({isTag:!0,label:e})),s.slice(0,this.optionsLimit)},valueKeys(){return this.trackBy?this.internalValue.map(e=>e[this.trackBy]):this.internalValue},optionKeys(){return(this.groupValues?this.flatAndStrip(this.options):this.options).map(i=>this.customLabel(i,this.label).toString().toLowerCase())},currentOptionLabel(){return this.multiple?this.searchable?"":this.placeholder:this.internalValue.length?this.getOptionLabel(this.internalValue[0]):this.searchable?"":this.placeholder}},watch:{internalValue(){this.resetAfter&&this.internalValue.length&&(this.search="",this.$emit("update:modelValue",this.multiple?[]:null))},search(){this.$emit("search-change",this.search)}},emits:["open","search-change","close","select","update:modelValue","remove","tag"],methods:{getValue(){return this.multiple?this.internalValue:this.internalValue.length===0?null:this.internalValue[0]},filterAndFlat(e,i,s){return b(L(i,s,this.groupValues,this.groupLabel,this.customLabel),u(this.groupValues,this.groupLabel))(e)},flatAndStrip(e){return b(u(this.groupValues,this.groupLabel),$)(e)},updateSearch(e){this.search=e},isExistingOption(e){return this.options?this.optionKeys.indexOf(e)>-1:!1},isSelected(e){const i=this.trackBy?e[this.trackBy]:e;return this.valueKeys.indexOf(i)>-1},isOptionDisabled(e){return!!e.$isDisabled},getOptionLabel(e){if(p(e))return"";if(e.isTag)return e.label;if(e.$isLabel)return e.$groupLabel;const i=this.customLabel(e,this.label);return p(i)?"":i},select(e,i){if(e.$isLabel&&this.groupSelect){this.selectGroup(e);return}if(!(this.blockKeys.indexOf(i)!==-1||this.disabled||e.$isDisabled||e.$isLabel)&&!(this.max&&this.multiple&&this.internalValue.length===this.max)&&!(i==="Tab"&&!this.pointerDirty)){if(e.isTag)this.$emit("tag",e.label,this.id),this.search="",this.closeOnSelect&&!this.multiple&&this.deactivate();else{if(this.isSelected(e)){i!=="Tab"&&this.removeElement(e);return}this.$emit("select",e,this.id),this.multiple?this.$emit("update:modelValue",this.internalValue.concat([e])):this.$emit("update:modelValue",e),this.clearOnSelect&&(this.search="")}this.closeOnSelect&&this.deactivate()}},selectGroup(e){const i=this.options.find(s=>s[this.groupLabel]===e.$groupLabel);if(!!i){if(this.wholeGroupSelected(i)){this.$emit("remove",i[this.groupValues],this.id);const s=this.internalValue.filter(r=>i[this.groupValues].indexOf(r)===-1);this.$emit("update:modelValue",s)}else{const s=i[this.groupValues].filter(r=>!(this.isOptionDisabled(r)||this.isSelected(r)));this.$emit("select",s,this.id),this.$emit("update:modelValue",this.internalValue.concat(s))}this.closeOnSelect&&this.deactivate()}},wholeGroupSelected(e){return e[this.groupValues].every(i=>this.isSelected(i)||this.isOptionDisabled(i))},wholeGroupDisabled(e){return e[this.groupValues].every(this.isOptionDisabled)},removeElement(e,i=!0){if(this.disabled||e.$isDisabled)return;if(!this.allowEmpty&&this.internalValue.length<=1){this.deactivate();return}const s=typeof e=="object"?this.valueKeys.indexOf(e[this.trackBy]):this.valueKeys.indexOf(e);if(this.$emit("remove",e,this.id),this.multiple){const r=this.internalValue.slice(0,s).concat(this.internalValue.slice(s+1));this.$emit("update:modelValue",r)}else this.$emit("update:modelValue",null);this.closeOnSelect&&i&&this.deactivate()},removeLastElement(){this.blockKeys.indexOf("Delete")===-1&&this.search.length===0&&Array.isArray(this.internalValue)&&this.internalValue.length&&this.removeElement(this.internalValue[this.internalValue.length-1],!1)},activate(){this.isOpen||this.disabled||(this.adjustPosition(),this.groupValues&&this.pointer===0&&this.filteredOptions.length&&(this.pointer=1),this.isOpen=!0,this.searchable?(this.preserveSearch||(this.search=""),this.$nextTick(()=>this.$refs.search&&this.$refs.search.focus())):this.$el.focus(),this.$emit("open",this.id))},deactivate(){!this.isOpen||(this.isOpen=!1,this.searchable?this.$refs.search&&this.$refs.search.blur():this.$el.blur(),this.preserveSearch||(this.search=""),this.$emit("close",this.getValue(),this.id))},toggle(){this.isOpen?this.deactivate():this.activate()},adjustPosition(){if(typeof window>"u")return;const e=this.$el.getBoundingClientRect().top,i=window.innerHeight-this.$el.getBoundingClientRect().bottom;i>this.maxHeight||i>e||this.openDirection==="below"||this.openDirection==="bottom"?(this.preferredOpenDirection="below",this.optimizedHeight=Math.min(i-40,this.maxHeight)):(this.preferredOpenDirection="above",this.optimizedHeight=Math.min(e-40,this.maxHeight))}}},k={data(){return{pointer:0,pointerDirty:!1}},props:{showPointer:{type:Boolean,default:!0},optionHeight:{type:Number,default:40}},computed:{pointerPosition(){return this.pointer*this.optionHeight},visibleElements(){return this.optimizedHeight/this.optionHeight}},watch:{filteredOptions(){this.pointerAdjust()},isOpen(){this.pointerDirty=!1},pointer(){this.$refs.search&&this.$refs.search.setAttribute("aria-activedescendant",this.id+"-"+this.pointer.toString())}},methods:{optionHighlight(e,i){return{"multiselect__option--highlight":e===this.pointer&&this.showPointer,"multiselect__option--selected":this.isSelected(i)}},groupHighlight(e,i){if(!this.groupSelect)return["multiselect__option--disabled",{"multiselect__option--group":i.$isLabel}];const s=this.options.find(r=>r[this.groupLabel]===i.$groupLabel);return s&&!this.wholeGroupDisabled(s)?["multiselect__option--group",{"multiselect__option--highlight":e===this.pointer&&this.showPointer},{"multiselect__option--group-selected":this.wholeGroupSelected(s)}]:"multiselect__option--disabled"},addPointerElement({key:e}="Enter"){this.filteredOptions.length>0&&this.select(this.filteredOptions[this.pointer],e),this.pointerReset()},pointerForward(){this.pointer<this.filteredOptions.length-1&&(this.pointer++,this.$refs.list.scrollTop<=this.pointerPosition-(this.visibleElements-1)*this.optionHeight&&(this.$refs.list.scrollTop=this.pointerPosition-(this.visibleElements-1)*this.optionHeight),this.filteredOptions[this.pointer]&&this.filteredOptions[this.pointer].$isLabel&&!this.groupSelect&&this.pointerForward()),this.pointerDirty=!0},pointerBackward(){this.pointer>0?(this.pointer--,this.$refs.list.scrollTop>=this.pointerPosition&&(this.$refs.list.scrollTop=this.pointerPosition),this.filteredOptions[this.pointer]&&this.filteredOptions[this.pointer].$isLabel&&!this.groupSelect&&this.pointerBackward()):this.filteredOptions[this.pointer]&&this.filteredOptions[0].$isLabel&&!this.groupSelect&&this.pointerForward(),this.pointerDirty=!0},pointerReset(){!this.closeOnSelect||(this.pointer=0,this.$refs.list&&(this.$refs.list.scrollTop=0))},pointerAdjust(){this.pointer>=this.filteredOptions.length-1&&(this.pointer=this.filteredOptions.length?this.filteredOptions.length-1:0),this.filteredOptions.length>0&&this.filteredOptions[this.pointer].$isLabel&&!this.groupSelect&&this.pointerForward()},pointerSet(e){this.pointer=e,this.pointerDirty=!0}}},w={name:"vue-multiselect",mixins:[O,k],props:{name:{type:String,default:""},modelValue:{type:null,default(){return[]}},selectLabel:{type:String,default:"Press enter to select"},selectGroupLabel:{type:String,default:"Press enter to select group"},selectedLabel:{type:String,default:"Selected"},deselectLabel:{type:String,default:"Press enter to remove"},deselectGroupLabel:{type:String,default:"Press enter to deselect group"},showLabels:{type:Boolean,default:!0},limit:{type:Number,default:99999},maxHeight:{type:Number,default:300},limitText:{type:Function,default:e=>`and ${e} more`},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},openDirection:{type:String,default:""},showNoOptions:{type:Boolean,default:!0},showNoResults:{type:Boolean,default:!0},tabindex:{type:Number,default:0}},computed:{isSingleLabelVisible(){return(this.singleValue||this.singleValue===0)&&(!this.isOpen||!this.searchable)&&!this.visibleValues.length},isPlaceholderVisible(){return!this.internalValue.length&&(!this.searchable||!this.isOpen)},visibleValues(){return this.multiple?this.internalValue.slice(0,this.limit):[]},singleValue(){return this.internalValue[0]},deselectLabelText(){return this.showLabels?this.deselectLabel:""},deselectGroupLabelText(){return this.showLabels?this.deselectGroupLabel:""},selectLabelText(){return this.showLabels?this.selectLabel:""},selectGroupLabelText(){return this.showLabels?this.selectGroupLabel:""},selectedLabelText(){return this.showLabels?this.selectedLabel:""},inputStyle(){return this.searchable||this.multiple&&this.modelValue&&this.modelValue.length?this.isOpen?{width:"100%"}:{width:"0",position:"absolute",padding:"0"}:""},contentStyle(){return this.options.length?{display:"inline-block"}:{display:"block"}},isAbove(){return this.openDirection==="above"||this.openDirection==="top"?!0:this.openDirection==="below"||this.openDirection==="bottom"?!1:this.preferredOpenDirection==="above"},showSearchInput(){return this.searchable&&(this.hasSingleSelectedSlot&&(this.visibleSingleValue||this.visibleSingleValue===0)?this.isOpen:!0)}}};const B={ref:"tags",class:"multiselect__tags"},C={class:"multiselect__tags-wrap"},N={class:"multiselect__spinner"},D={key:0},M={class:"multiselect__option"},E={class:"multiselect__option"},T=t.createTextVNode("No elements found. Consider changing the search query."),_={class:"multiselect__option"},P=t.createTextVNode("List is empty.");function K(e,i,s,r,o,n){return t.openBlock(),t.createBlock("div",{tabindex:e.searchable?-1:s.tabindex,class:[{"multiselect--active":e.isOpen,"multiselect--disabled":s.disabled,"multiselect--above":n.isAbove},"multiselect"],onFocus:i[14]||(i[14]=l=>e.activate()),onBlur:i[15]||(i[15]=l=>e.searchable?!1:e.deactivate()),onKeydown:[i[16]||(i[16]=t.withKeys(t.withModifiers(l=>e.pointerForward(),["self","prevent"]),["down"])),i[17]||(i[17]=t.withKeys(t.withModifiers(l=>e.pointerBackward(),["self","prevent"]),["up"]))],onKeypress:i[18]||(i[18]=t.withKeys(t.withModifiers(l=>e.addPointerElement(l),["stop","self"]),["enter","tab"])),onKeyup:i[19]||(i[19]=t.withKeys(l=>e.deactivate(),["esc"])),role:"combobox","aria-owns":"listbox-"+e.id},[t.renderSlot(e.$slots,"caret",{toggle:e.toggle},()=>[t.createVNode("div",{onMousedown:i[1]||(i[1]=t.withModifiers(l=>e.toggle(),["prevent","stop"])),class:"multiselect__select"},null,32)]),t.renderSlot(e.$slots,"clear",{search:e.search}),t.createVNode("div",B,[t.renderSlot(e.$slots,"selection",{search:e.search,remove:e.removeElement,values:n.visibleValues,isOpen:e.isOpen},()=>[t.withDirectives(t.createVNode("div",C,[(t.openBlock(!0),t.createBlock(t.Fragment,null,t.renderList(n.visibleValues,(l,a)=>t.renderSlot(e.$slots,"tag",{option:l,search:e.search,remove:e.removeElement},()=>[(t.openBlock(),t.createBlock("span",{class:"multiselect__tag",key:a},[t.createVNode("span",{textContent:t.toDisplayString(e.getOptionLabel(l))},null,8,["textContent"]),t.createVNode("i",{tabindex:"1",onKeypress:t.withKeys(t.withModifiers(c=>e.removeElement(l),["prevent"]),["enter"]),onMousedown:t.withModifiers(c=>e.removeElement(l),["prevent"]),class:"multiselect__tag-icon"},null,40,["onKeypress","onMousedown"])]))])),256))],512),[[t.vShow,n.visibleValues.length>0]]),e.internalValue&&e.internalValue.length>s.limit?t.renderSlot(e.$slots,"limit",{key:0},()=>[t.createVNode("strong",{class:"multiselect__strong",textContent:t.toDisplayString(s.limitText(e.internalValue.length-s.limit))},null,8,["textContent"])]):t.createCommentVNode("v-if",!0)]),t.createVNode(t.Transition,{name:"multiselect__loading"},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"loading",{},()=>[t.withDirectives(t.createVNode("div",N,null,512),[[t.vShow,s.loading]])])]),_:3}),e.searchable?(t.openBlock(),t.createBlock("input",{key:0,ref:"search",name:s.name,id:e.id,type:"text",autocomplete:"off",spellcheck:"false",placeholder:e.placeholder,style:n.inputStyle,value:e.search,disabled:s.disabled,tabindex:s.tabindex,onInput:i[2]||(i[2]=l=>e.updateSearch(l.target.value)),onFocus:i[3]||(i[3]=t.withModifiers(l=>e.activate(),["prevent"])),onBlur:i[4]||(i[4]=t.withModifiers(l=>e.deactivate(),["prevent"])),onKeyup:i[5]||(i[5]=t.withKeys(l=>e.deactivate(),["esc"])),onKeydown:[i[6]||(i[6]=t.withKeys(t.withModifiers(l=>e.pointerForward(),["prevent"]),["down"])),i[7]||(i[7]=t.withKeys(t.withModifiers(l=>e.pointerBackward(),["prevent"]),["up"])),i[9]||(i[9]=t.withKeys(t.withModifiers(l=>e.removeLastElement(),["stop"]),["delete"]))],onKeypress:i[8]||(i[8]=t.withKeys(t.withModifiers(l=>e.addPointerElement(l),["prevent","stop","self"]),["enter"])),class:"multiselect__input","aria-controls":"listbox-"+e.id},null,44,["name","id","placeholder","value","disabled","tabindex","aria-controls"])):t.createCommentVNode("v-if",!0),n.isSingleLabelVisible?(t.openBlock(),t.createBlock("span",{key:1,class:"multiselect__single",onMousedown:i[10]||(i[10]=t.withModifiers((...l)=>e.toggle&&e.toggle(...l),["prevent"]))},[t.renderSlot(e.$slots,"singleLabel",{option:n.singleValue},()=>[t.createTextVNode(t.toDisplayString(e.currentOptionLabel),1)])],32)):t.createCommentVNode("v-if",!0),n.isPlaceholderVisible?(t.openBlock(),t.createBlock("span",{key:2,class:"multiselect__placeholder",onMousedown:i[11]||(i[11]=t.withModifiers((...l)=>e.toggle&&e.toggle(...l),["prevent"]))},[t.renderSlot(e.$slots,"placeholder",{},()=>[t.createTextVNode(t.toDisplayString(e.placeholder),1)])],32)):t.createCommentVNode("v-if",!0)],512),t.createVNode(t.Transition,{name:"multiselect"},{default:t.withCtx(()=>[t.withDirectives(t.createVNode("div",{class:"multiselect__content-wrapper",onFocus:i[12]||(i[12]=(...l)=>e.activate&&e.activate(...l)),tabindex:"-1",onMousedown:i[13]||(i[13]=t.withModifiers(()=>{},["prevent"])),style:{maxHeight:e.optimizedHeight+"px"},ref:"list"},[t.createVNode("ul",{class:"multiselect__content",style:n.contentStyle,role:"listbox",id:"listbox-"+e.id},[t.renderSlot(e.$slots,"beforeList"),e.multiple&&e.max===e.internalValue.length?(t.openBlock(),t.createBlock("li",D,[t.createVNode("span",M,[t.renderSlot(e.$slots,"maxElements",{},()=>[t.createTextVNode("Maximum of "+t.toDisplayString(e.max)+" options selected. First remove a selected option to select another.",1)])])])):t.createCommentVNode("v-if",!0),!e.max||e.internalValue.length<e.max?(t.openBlock(!0),t.createBlock(t.Fragment,{key:1},t.renderList(e.filteredOptions,(l,a)=>(t.openBlock(),t.createBlock("li",{class:"multiselect__element",key:a,id:e.id+"-"+a,role:l&&(l.$isLabel||l.$isDisabled)?null:"option"},[l&&(l.$isLabel||l.$isDisabled)?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createBlock("span",{key:0,class:[e.optionHighlight(a,l),"multiselect__option"],onClick:t.withModifiers(c=>e.select(l),["stop"]),onMouseenter:t.withModifiers(c=>e.pointerSet(a),["self"]),"data-select":l&&l.isTag?e.tagPlaceholder:n.selectLabelText,"data-selected":n.selectedLabelText,"data-deselect":n.deselectLabelText},[t.renderSlot(e.$slots,"option",{option:l,search:e.search,index:a},()=>[t.createVNode("span",null,t.toDisplayString(e.getOptionLabel(l)),1)])],42,["onClick","onMouseenter","data-select","data-selected","data-deselect"])),l&&(l.$isLabel||l.$isDisabled)?(t.openBlock(),t.createBlock("span",{key:1,"data-select":e.groupSelect&&n.selectGroupLabelText,"data-deselect":e.groupSelect&&n.deselectGroupLabelText,class:[e.groupHighlight(a,l),"multiselect__option"],onMouseenter:t.withModifiers(c=>e.groupSelect&&e.pointerSet(a),["self"]),onMousedown:t.withModifiers(c=>e.selectGroup(l),["prevent"])},[t.renderSlot(e.$slots,"option",{option:l,search:e.search,index:a},()=>[t.createVNode("span",null,t.toDisplayString(e.getOptionLabel(l)),1)])],42,["data-select","data-deselect","onMouseenter","onMousedown"])):t.createCommentVNode("v-if",!0)],8,["id","role"]))),128)):t.createCommentVNode("v-if",!0),t.withDirectives(t.createVNode("li",null,[t.createVNode("span",E,[t.renderSlot(e.$slots,"noResult",{search:e.search},()=>[T])])],512),[[t.vShow,s.showNoResults&&e.filteredOptions.length===0&&e.search&&!s.loading]]),t.withDirectives(t.createVNode("li",null,[t.createVNode("span",_,[t.renderSlot(e.$slots,"noOptions",{},()=>[P])])],512),[[t.vShow,s.showNoOptions&&e.options.length===0&&!e.search&&!s.loading]]),t.renderSlot(e.$slots,"afterList")],12,["id"])],36),[[t.vShow,e.isOpen]])]),_:3})],42,["tabindex","aria-owns"])}w.render=K;const f=(e,i)=>{const s=e.__vccOpts||e;for(const[r,o]of i)s[r]=o;return s},H={},A={width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},F=[t.createElementVNode("g",{"clip-path":"url(#clip0_3229_23142)"},[t.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.20711 0.792893C1.81658 0.402369 1.18342 0.402369 0.792893 0.792893C0.402369 1.18342 0.402369 1.81658 0.792893 2.20711L4.58579 6L0.792893 9.79289C0.402369 10.1834 0.402369 10.8166 0.792893 11.2071C1.18342 11.5976 1.81658 11.5976 2.20711 11.2071L6 7.41421L9.79289 11.2071C10.1834 11.5976 10.8166 11.5976 11.2071 11.2071C11.5976 10.8166 11.5976 10.1834 11.2071 9.79289L7.41421 6L11.2071 2.20711C11.5976 1.81658 11.5976 1.18342 11.2071 0.792893C10.8166 0.402369 10.1834 0.402369 9.79289 0.792893L6 4.58579L2.20711 0.792893Z",fill:"#121826"})],-1),t.createElementVNode("defs",null,[t.createElementVNode("clipPath",{id:"clip0_3229_23142"},[t.createElementVNode("rect",{width:"12",height:"12",fill:"white"})])],-1)];function G(e,i){return t.openBlock(),t.createElementBlock("svg",A,F)}const R=f(H,[["render",G]]),q={props:{color:String}},j={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},z=[t.createElementVNode("g",{"clip-path":"url(#clip0_2_10015)"},[t.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.6051 0.703831C16.0448 1.03801 16.1303 1.66537 15.7962 2.10508L6.29616 14.6051C6.12143 14.835 5.85583 14.9781 5.56771 14.9977C5.27959 15.0173 4.99709 14.9113 4.79289 14.7071L0.292893 10.2071C-0.0976311 9.81658 -0.0976311 9.18341 0.292893 8.79289C0.683417 8.40236 1.31658 8.40236 1.70711 8.79289L5.39703 12.4828L14.2038 0.89491C14.538 0.455202 15.1654 0.369653 15.6051 0.703831Z"})],-1),t.createElementVNode("defs",null,[t.createElementVNode("clipPath",{id:"clip0_2_10015"},[t.createElementVNode("rect",{width:"16",height:"16",fill:"white"})])],-1)];function x(e,i,s,r,o,n){return t.openBlock(),t.createElementBlock("svg",j,z)}const I=f(q,[["render",x]]),he="",Z={inheritAttrs:!1,props:{limit:Number,scrollableContainerSelector:{type:[Boolean,String],default:!1},preferredOpenDirection:{type:String,validate(e){return["up","down"].includes(e)},default:"down"},offset:{type:Number,default:0},placeholder:String,canClear:Boolean,mode:{required:!0,type:String,validate(e){return["single","multi"].includes(e)}},brand:{type:String,validate(e){return["sndq","struqta","nuvoni","immogeste"].includes(e)},default:"sndq"},caret:Boolean},emits:["remove","select","input","search-change","tag","open","close"],components:{Multiselect:w,Close12:R,Checkmark:I},computed:{listeners(){return{...this.$listeners,open:this.onOpen,close:this.onClose,remove:this.onRemove,select:this.onSelect}},caretStyle(){return{width:"16px",height:"16px",transform:this.preferredOpenDirection==="up"?"rotate(180deg)":""}},tagCount(){return this.$refs.originalMultiselect.internalValue.length}},data(){return{scrollableContainer:null,target:null,isOpen:!1}},methods:{onRemove(e,i){this.$emit("remove",e,i),this.repositionDropDown()},onSelect(e,i){this.$emit("select",e,i),this.repositionDropDown()},onOpen(e){this.isOpen=!0,this.$emit("open",e),this.repositionDropDown()},onClose(e){this.$emit("close",e),this.isOpen=!1},repositionDropDown(){setTimeout(()=>{const e=this.$el.getBoundingClientRect(),i=this.$refs.originalMultiselect;if(!i)return;const s=i.$refs.list;let r=this.preferredOpenDirection;r==="down"&&e.bottom+this.offset<this.$attrs.dropdownMaxHeight&&(r="up"),s.style.width=`${this.$el.clientWidth}px`,s.style.position="fixed",s.style.left=`${e.left}px`,r==="down"?(s.style.top=`${e.bottom+this.offset}px`,s.style.bottom="auto"):(s.style.bottom=`calc(100vh - ${e.bottom}px + ${e.height+this.offset}px)`,s.style.top="auto")})},open(){this.$refs.originalMultiselect.activate(),this.repositionDropDown()},close(){this.$refs.originalMultiselect.deactivate()},toggle(){this.isOpen?this.open():this.close()}},mounted(){this.scrollableContainer=this.scrollableContainerSelector&&document.querySelector(this.scrollableContainerSelector)||window,this.scrollableContainer.addEventListener("scroll",this.repositionDropDown,{passive:!0});const e=this.$refs.originalMultiselect;if(!e)return;const i=e.$refs.list;i.classList.add("briicks-select-body",this.brand);const s=i.parentNode;if(!s)return;const r=s.closest("body");!r||(this.target=r,s.removeChild(i),r.appendChild(i))},beforeUnmount(){const i=this.$refs.originalMultiselect.$refs.list;!this.target||this.target.removeChild(i)},unmounted(){!this.scrollableContainer||this.scrollableContainer.removeEventListener("scroll",this.repositionDropDown)}},U={class:"multiselect__custom-tag"},W={class:"multiselect-placeholder-el"},J={class:"multiselect-single-label"},Q={key:0,class:"checkbox"},X={class:"option-label"},Y={key:1,class:"selected-icon"},v={class:"tag-limit"},ee={class:"multiselect-caret"},te=["src"],ie=t.createElementVNode("div",null,null,-1);function se(e,i,s,r,o,n){const l=t.resolveComponent("Close12"),a=t.resolveComponent("Checkmark"),c=t.resolveComponent("multiselect");return t.openBlock(),t.createBlock(c,t.mergeProps({class:["briicks_selector",this.brand],ref:"originalMultiselect",multiple:s.mode==="multi"},e.$attrs,t.toHandlers(n.listeners),{placeholder:s.placeholder,limit:s.limit}),t.createSlots({tag:t.withCtx(({option:h,remove:y})=>[t.createElementVNode("div",U,[t.createElementVNode("span",null,t.toDisplayString(h.label),1),t.createVNode(l,{onClick:m=>y(h)},null,8,["onClick"])])]),placeholder:t.withCtx(()=>[t.createElementVNode("div",W,t.toDisplayString(s.placeholder),1)]),singleLabel:t.withCtx(({option:h})=>[t.createElementVNode("div",J,t.toDisplayString((h?h.label:"")||""),1)]),option:t.withCtx(({option:h})=>[s.mode==="multi"?(t.openBlock(),t.createElementBlock("div",Q)):t.createCommentVNode("",!0),t.createElementVNode("span",X,t.toDisplayString(h.label),1),s.mode==="single"?(t.openBlock(),t.createElementBlock("span",Y,[t.createVNode(a)])):t.createCommentVNode("",!0)]),limit:t.withCtx(()=>[t.createElementVNode("div",v,"+"+t.toDisplayString(n.tagCount-this.limit),1)]),noOptions:t.withCtx(()=>[ie]),clear:t.withCtx(()=>[t.renderSlot(e.$slots,"prefix")]),_:2},[t.renderList(Object.keys(e.$slots),(h,y)=>({name:h,fn:t.withCtx(m=>[m?t.renderSlot(e.$slots,h,t.normalizeProps(t.mergeProps({key:0},m))):t.renderSlot(e.$slots,e.name,{key:1})])})),s.caret?{name:"caret",fn:t.withCtx(()=>[t.createElementVNode("div",ee,[t.createElementVNode("img",{style:t.normalizeStyle(n.caretStyle),src:require("./arrow-down-16.svg")},null,12,te)])]),key:"0"}:void 0]),1040,["class","multiple","placeholder","limit"])}const le=f(Z,[["render",se]]);d.BriicksSelector=le,Object.defineProperties(d,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
{ | ||
"name": "briicks-selector", | ||
"version": "0.0.5", | ||
"version": "0.0.7", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
90254
1180