@leaflink/stash 53.4.7 → 53.4.8
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/dist/AppSidebar.js +43 -41
- package/dist/AppSidebar.js.map +1 -1
- package/dist/Modal.js +33 -31
- package/dist/Modal.js.map +1 -1
- package/dist/Modals.js +30 -26
- package/dist/Modals.js.map +1 -1
- package/dist/SearchBar.js +27 -25
- package/dist/SearchBar.js.map +1 -1
- package/dist/Select.js +22 -20
- package/dist/Select.js.map +1 -1
- package/dist/ThumbnailGroup.js +24 -22
- package/dist/ThumbnailGroup.js.map +1 -1
- package/dist/Timeline.js +15 -13
- package/dist/Timeline.js.map +1 -1
- package/dist/components.css +1 -1
- package/dist/useValidation.d.ts +11 -1
- package/dist/useValidation.js +240 -198
- package/dist/useValidation.js.map +1 -1
- package/package.json +1 -2
package/dist/SearchBar.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as C, useSlots as S, ref as i, computed as V, createBlock as h, openBlock as
|
|
1
|
+
import { defineComponent as C, useSlots as S, ref as i, computed as V, createBlock as h, openBlock as m, withKeys as s, normalizeClass as p, createSlots as I, withCtx as r, createCommentVNode as T, createVNode as u, unref as K, renderSlot as L } from "vue";
|
|
2
2
|
import { t as f } from "./locale.js";
|
|
3
3
|
import b from "./Button.js";
|
|
4
4
|
import v from "./Icon.js";
|
|
5
5
|
import W from "./Input.js";
|
|
6
6
|
import { _ as w } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
7
|
-
const
|
|
7
|
+
const M = /* @__PURE__ */ C({
|
|
8
8
|
name: "ll-search-bar",
|
|
9
9
|
__name: "SearchBar",
|
|
10
10
|
props: {
|
|
@@ -16,35 +16,35 @@ const N = /* @__PURE__ */ C({
|
|
|
16
16
|
hintText: { default: void 0 }
|
|
17
17
|
},
|
|
18
18
|
emits: ["search", "update:model-value"],
|
|
19
|
-
setup(_, { emit:
|
|
20
|
-
const e = _, l =
|
|
19
|
+
setup(_, { emit: y }) {
|
|
20
|
+
const e = _, l = y, k = S(), a = i(e.modelValue), d = i(), g = V(() => a.value ? 0 : -1);
|
|
21
21
|
function o() {
|
|
22
22
|
e.isLoading || e.isWorking || l("search", a.value);
|
|
23
23
|
}
|
|
24
24
|
function c() {
|
|
25
|
-
var
|
|
26
|
-
a.value = "", l("search", ""), l("update:model-value", ""), (t = (
|
|
25
|
+
var n, t;
|
|
26
|
+
a.value = "", l("search", ""), l("update:model-value", ""), (t = (n = d.value) == null ? void 0 : n.inputEl) == null || t.focus();
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function x() {
|
|
29
29
|
l("update:model-value", a.value);
|
|
30
30
|
}
|
|
31
|
-
return (
|
|
31
|
+
return (n, t) => (m(), h(W, {
|
|
32
32
|
ref_key: "stashInputRef",
|
|
33
|
-
ref:
|
|
33
|
+
ref: d,
|
|
34
34
|
modelValue: a.value,
|
|
35
35
|
"onUpdate:modelValue": [
|
|
36
36
|
t[0] || (t[0] = (B) => a.value = B),
|
|
37
|
-
|
|
37
|
+
x
|
|
38
38
|
],
|
|
39
|
-
class:
|
|
39
|
+
class: p(["stash-search-bar", [{ "stash-search-bar--value": !!a.value }]]),
|
|
40
40
|
label: e.label,
|
|
41
41
|
placeholder: e.placeholder,
|
|
42
42
|
"hint-text": e.hintText,
|
|
43
43
|
"data-test": "stash-search-bar",
|
|
44
44
|
onKeyup: s(o, ["enter"])
|
|
45
45
|
}, I({
|
|
46
|
-
append:
|
|
47
|
-
a.value ? (
|
|
46
|
+
append: r(() => [
|
|
47
|
+
a.value ? (m(), h(b, {
|
|
48
48
|
key: 0,
|
|
49
49
|
class: "stash-search-bar__clear-button",
|
|
50
50
|
disabled: e.isLoading,
|
|
@@ -55,13 +55,13 @@ const N = /* @__PURE__ */ C({
|
|
|
55
55
|
s(c, ["space"])
|
|
56
56
|
]
|
|
57
57
|
}, {
|
|
58
|
-
default:
|
|
59
|
-
|
|
58
|
+
default: r(() => [
|
|
59
|
+
u(v, { name: "close" })
|
|
60
60
|
]),
|
|
61
61
|
_: 1
|
|
62
62
|
}, 8, ["disabled"])) : T("", !0),
|
|
63
|
-
|
|
64
|
-
tabindex:
|
|
63
|
+
u(b, {
|
|
64
|
+
tabindex: g.value,
|
|
65
65
|
"data-test": "stash-search-bar|search-button",
|
|
66
66
|
disabled: e.isLoading,
|
|
67
67
|
class: "stash-search-bar__search-button",
|
|
@@ -71,9 +71,9 @@ const N = /* @__PURE__ */ C({
|
|
|
71
71
|
s(o, ["space"])
|
|
72
72
|
]
|
|
73
73
|
}, {
|
|
74
|
-
default:
|
|
75
|
-
|
|
76
|
-
class:
|
|
74
|
+
default: r(() => [
|
|
75
|
+
u(v, {
|
|
76
|
+
class: p({ "animate-spin": e.isWorking }),
|
|
77
77
|
name: e.isWorking ? "loading-empty" : "search"
|
|
78
78
|
}, null, 8, ["class", "name"])
|
|
79
79
|
]),
|
|
@@ -82,17 +82,19 @@ const N = /* @__PURE__ */ C({
|
|
|
82
82
|
]),
|
|
83
83
|
_: 2
|
|
84
84
|
}, [
|
|
85
|
-
K(
|
|
85
|
+
K(k).hint ? {
|
|
86
86
|
name: "hint",
|
|
87
|
-
fn:
|
|
88
|
-
L(
|
|
87
|
+
fn: r(() => [
|
|
88
|
+
L(n.$slots, "hint")
|
|
89
89
|
]),
|
|
90
90
|
key: "0"
|
|
91
91
|
} : void 0
|
|
92
92
|
]), 1032, ["modelValue", "class", "label", "placeholder", "hint-text"]));
|
|
93
93
|
}
|
|
94
|
-
}),
|
|
94
|
+
}), N = {}, R = {
|
|
95
|
+
$style: N
|
|
96
|
+
}, A = /* @__PURE__ */ w(M, [["__cssModules", R]]);
|
|
95
97
|
export {
|
|
96
|
-
|
|
98
|
+
A as default
|
|
97
99
|
};
|
|
98
100
|
//# sourceMappingURL=SearchBar.js.map
|
package/dist/SearchBar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.js","sources":["../src/components/SearchBar/SearchBar.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import { computed, ref, useSlots } from 'vue';\n\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Icon from '../Icon/Icon.vue';\n import Input from '../Input/Input.vue';\n\n export interface SearchBarProps {\n /**\n * Indicates loading activity (for example async request) that should prevent search\n */\n isLoading?: boolean;\n\n /**\n * Sets a visual indicator that the search is active\n */\n isWorking?: boolean;\n\n /**\n * The search term\n */\n modelValue?: string;\n\n /**\n * Placeholder text for the input\n */\n placeholder?: string;\n\n /**\n * Label for search bar\n */\n label?: string;\n\n /**\n * Text below the input\n */\n hintText?: string;\n }\n\n defineOptions({\n name: 'll-search-bar',\n });\n\n const props = withDefaults(defineProps<SearchBarProps>(), {\n isLoading: false,\n isWorking: false,\n modelValue: '',\n placeholder: t('ll.search'),\n label: t('ll.search'),\n hintText: undefined,\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when searching or clearing the search input\n */\n (e: 'search', searchTerm: string): void;\n\n /**\n * Emitted when the search term changes\n */\n (e: 'update:model-value', searchTerm: string): void;\n }>();\n\n const slots = useSlots();\n const searchTerm = ref(props.modelValue);\n const stashInputRef = ref<InstanceType<typeof Input>>();\n\n const searchTabIndex = computed(() => (searchTerm.value ? 0 : -1));\n\n function onSearch() {\n if (props.isLoading || props.isWorking) {\n return;\n }\n emit('search', searchTerm.value);\n }\n\n function clearSearchTerm() {\n searchTerm.value = '';\n emit('search', '');\n emit('update:model-value', '');\n\n stashInputRef.value?.inputEl?.focus();\n }\n\n function handleChange() {\n emit('update:model-value', searchTerm.value);\n }\n</script>\n\n<template>\n <Input\n ref=\"stashInputRef\"\n v-model=\"searchTerm\"\n class=\"stash-search-bar\"\n :class=\"[{ 'stash-search-bar--value': !!searchTerm }]\"\n :label=\"props.label\"\n :placeholder=\"props.placeholder\"\n :hint-text=\"props.hintText\"\n data-test=\"stash-search-bar\"\n @update:model-value=\"handleChange\"\n @keyup.enter=\"onSearch\"\n >\n <template #append>\n <Button\n v-if=\"searchTerm\"\n class=\"stash-search-bar__clear-button\"\n :disabled=\"props.isLoading\"\n data-test=\"stash-search-bar|clear-button\"\n @click=\"clearSearchTerm\"\n @keyup.enter=\"clearSearchTerm\"\n @keyup.space=\"clearSearchTerm\"\n >\n <Icon name=\"close\" />\n </Button>\n <Button\n :tabindex=\"searchTabIndex\"\n data-test=\"stash-search-bar|search-button\"\n :disabled=\"props.isLoading\"\n class=\"stash-search-bar__search-button\"\n @click=\"onSearch\"\n @keyup.enter=\"onSearch\"\n @keyup.space=\"onSearch\"\n >\n <Icon :class=\"{ 'animate-spin': props.isWorking }\" :name=\"props.isWorking ? 'loading-empty' : 'search'\" />\n </Button>\n </template>\n <template v-if=\"slots.hint\" #hint>\n <!-- @slot Overrides the Input hint-text prop -->\n <slot name=\"hint\"></slot>\n </template>\n </Input>\n</template>\n\n<style
|
|
1
|
+
{"version":3,"file":"SearchBar.js","sources":["../src/components/SearchBar/SearchBar.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import { computed, ref, useSlots } from 'vue';\n\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Icon from '../Icon/Icon.vue';\n import Input from '../Input/Input.vue';\n\n export interface SearchBarProps {\n /**\n * Indicates loading activity (for example async request) that should prevent search\n */\n isLoading?: boolean;\n\n /**\n * Sets a visual indicator that the search is active\n */\n isWorking?: boolean;\n\n /**\n * The search term\n */\n modelValue?: string;\n\n /**\n * Placeholder text for the input\n */\n placeholder?: string;\n\n /**\n * Label for search bar\n */\n label?: string;\n\n /**\n * Text below the input\n */\n hintText?: string;\n }\n\n defineOptions({\n name: 'll-search-bar',\n });\n\n const props = withDefaults(defineProps<SearchBarProps>(), {\n isLoading: false,\n isWorking: false,\n modelValue: '',\n placeholder: t('ll.search'),\n label: t('ll.search'),\n hintText: undefined,\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when searching or clearing the search input\n */\n (e: 'search', searchTerm: string): void;\n\n /**\n * Emitted when the search term changes\n */\n (e: 'update:model-value', searchTerm: string): void;\n }>();\n\n const slots = useSlots();\n const searchTerm = ref(props.modelValue);\n const stashInputRef = ref<InstanceType<typeof Input>>();\n\n const searchTabIndex = computed(() => (searchTerm.value ? 0 : -1));\n\n function onSearch() {\n if (props.isLoading || props.isWorking) {\n return;\n }\n emit('search', searchTerm.value);\n }\n\n function clearSearchTerm() {\n searchTerm.value = '';\n emit('search', '');\n emit('update:model-value', '');\n\n stashInputRef.value?.inputEl?.focus();\n }\n\n function handleChange() {\n emit('update:model-value', searchTerm.value);\n }\n</script>\n\n<template>\n <Input\n ref=\"stashInputRef\"\n v-model=\"searchTerm\"\n class=\"stash-search-bar\"\n :class=\"[{ 'stash-search-bar--value': !!searchTerm }]\"\n :label=\"props.label\"\n :placeholder=\"props.placeholder\"\n :hint-text=\"props.hintText\"\n data-test=\"stash-search-bar\"\n @update:model-value=\"handleChange\"\n @keyup.enter=\"onSearch\"\n >\n <template #append>\n <Button\n v-if=\"searchTerm\"\n class=\"stash-search-bar__clear-button\"\n :disabled=\"props.isLoading\"\n data-test=\"stash-search-bar|clear-button\"\n @click=\"clearSearchTerm\"\n @keyup.enter=\"clearSearchTerm\"\n @keyup.space=\"clearSearchTerm\"\n >\n <Icon name=\"close\" />\n </Button>\n <Button\n :tabindex=\"searchTabIndex\"\n data-test=\"stash-search-bar|search-button\"\n :disabled=\"props.isLoading\"\n class=\"stash-search-bar__search-button\"\n @click=\"onSearch\"\n @keyup.enter=\"onSearch\"\n @keyup.space=\"onSearch\"\n >\n <Icon :class=\"{ 'animate-spin': props.isWorking }\" :name=\"props.isWorking ? 'loading-empty' : 'search'\" />\n </Button>\n </template>\n <template v-if=\"slots.hint\" #hint>\n <!-- @slot Overrides the Input hint-text prop -->\n <slot name=\"hint\"></slot>\n </template>\n </Input>\n</template>\n\n<style module>\n @reference \"../../../styles/main.css\";\n\n @layer utilities {\n :global(:where(.stash-search-bar) input) {\n text-overflow: ellipsis;\n }\n\n :global(:where(.stash-search-bar).stash-search-bar--value input) {\n padding-right: 72px;\n }\n\n :global(:where(.stash-search-bar) input:hover) {\n border: 1px solid var(--color-blue-500);\n }\n\n :global(:where(.stash-search-bar) .stash-input-append) {\n display: flex;\n justify-content: flex-end;\n width: 72px; /* double the the default width of 36px */\n overflow: visible;\n }\n\n :global(:where(.stash-search-bar) .stash-search-bar__clear-button) {\n color: var(--color-ice-700);\n height: --spacing(9);\n min-width: --spacing(9);\n width: --spacing(9);\n background: none;\n display: flex;\n align-items: center;\n justify-content: center;\n\n &:focus-visible {\n outline: none;\n box-shadow: none;\n\n & svg {\n border-radius: var(--radius-sm);\n\n @apply ring-4 ring-blue-500/15;\n }\n }\n }\n\n :global(:where(.stash-search-bar) .stash-search-bar__clear-button:disabled) {\n color: var(--color-ice-500);\n cursor: default;\n }\n\n :global(:where(.stash-search-bar) .stash-search-bar__search-button) {\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n height: --spacing(9);\n min-width: --spacing(9);\n width: --spacing(9);\n display: flex;\n align-items: center;\n justify-content: center;\n\n &:focus {\n box-shadow: none;\n }\n\n &:disabled {\n border-color: var(--color-ice-500);\n }\n\n &:hover {\n background-color: var(--color-blue-600);\n }\n\n &:active {\n background-color: var(--color-blue-700);\n }\n\n &:focus-visible {\n outline: none;\n border: 1px solid var(--color-blue-900);\n /* Simulating a bigger border so the design does not break */\n box-shadow:\n inset 0 0 0 1px var(--color-blue-900),\n 0 0 0 4px rgb(0 114 240 / 15%); /* Unfortunatelly, we have to use RGBA to make the shadow transparent, this is blue-500 */\n }\n }\n }\n</style>\n"],"names":["props","__props","emit","__emit","slots","useSlots","searchTerm","ref","stashInputRef","searchTabIndex","computed","onSearch","clearSearchTerm","_b","_a","handleChange","_createBlock","Input","$event","_normalizeClass","Button","_createVNode","Icon","_unref","_renderSlot","_ctx"],"mappings":";;;;;;;;;;;;;;;;;;;AA4CE,UAAMA,IAAQC,GASRC,IAAOC,GAYPC,IAAQC,EAAA,GACRC,IAAaC,EAA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AA,UACjB,OAAM;AAAA,UACL,SAAOW;AAAA,UACP,SAAK;AAAA,cAAQA,GAAQ,CAAA,OAAA,CAAA;AAAA,cACRA,GAAQ,CAAA,OAAA,CAAA;AAAA,UAAA;AAAA;qBAEtB,MAA0G;AAAA,YAA1GU,EAA0GC,GAAA;AAAA,cAAnG,OAAKH,EAAA,EAAA,gBAAoBnB,EAAM,WAAS;AAAA,cAAK,MAAMA,EAAM,YAAS,kBAAA;AAAA,YAAA;;;;;;;MAG7DuB,EAAAnB,CAAA,EAAM;cAAO;AAAA,cAE3B,MAAyB;AAAA,UAAzBoB,EAAyBC,EAAA,QAAA,MAAA;AAAA,QAAA;;;;;;;;"}
|
package/dist/Select.js
CHANGED
|
@@ -76,12 +76,12 @@ const rt = { class: "flex h-input items-center text-sm" }, it = ["id", "aria-lab
|
|
|
76
76
|
},
|
|
77
77
|
emits: ["update:model-value", "clear", "add", "remove", "opened", "closed"],
|
|
78
78
|
setup(ve, { emit: me }) {
|
|
79
|
-
const t = ve, v = me, V = He(), X = Pe(), se = c(null), m = c(null), O = c(null), I = c(null), ae = c(null), R = c(0),
|
|
79
|
+
const t = ve, v = me, V = He(), X = Pe(), se = c(null), m = c(null), O = c(null), I = c(null), ae = c(null), R = c(0), M = c(0), a = c([]), ne = c(() => []), y = c(""), p = c(-1), u = c(!1), Y = c({}), oe = c(!1), { floatingStyles: ye, update: _e } = qe(se, O, {
|
|
80
80
|
whileElementsMounted: je,
|
|
81
81
|
placement: t.menuPlacement,
|
|
82
82
|
middleware: [
|
|
83
83
|
We(),
|
|
84
|
-
Xe(({ rects: e, placement: l }) => l.split("-")[0] === "bottom" && R.value >
|
|
84
|
+
Xe(({ rects: e, placement: l }) => l.split("-")[0] === "bottom" && R.value > M.value ? R.value - e.reference.height + 6 : 6),
|
|
85
85
|
Ye({
|
|
86
86
|
apply({ availableHeight: e, elements: l, rects: n }) {
|
|
87
87
|
t.enableTeleport && Object.assign(l.floating.style, {
|
|
@@ -91,10 +91,10 @@ const rt = { class: "flex h-input items-center text-sm" }, it = ["id", "aria-lab
|
|
|
91
91
|
}
|
|
92
92
|
})
|
|
93
93
|
]
|
|
94
|
-
}),
|
|
94
|
+
}), F = typeof ResizeObserver < "u" ? new ResizeObserver(() => w()) : null, J = h(() => !t.hideSearch && t.searchable !== "false" && t.searchable !== !1), K = h(() => {
|
|
95
95
|
let e = (oe.value && t.lazy ? t.lazy() : t.options).filter(Boolean);
|
|
96
96
|
return Ze(e[0]) || (e = e.map((l, n) => ({ name: l, id: n }))), e;
|
|
97
|
-
}), ge = h(() => a.value.length ? a.value.map((e) => e[t.displayBy] || e).join(", ") : ""), re = h(() => t.searchLoading || Object.keys(Y.value).length > 0), $ = h(() => t.disableFiltering || !(y.value || "").trim() ? K.value : ne.value(y.value)), be = h(() => R.value <=
|
|
97
|
+
}), ge = h(() => a.value.length ? a.value.map((e) => e[t.displayBy] || e).join(", ") : ""), re = h(() => t.searchLoading || Object.keys(Y.value).length > 0), $ = h(() => t.disableFiltering || !(y.value || "").trim() ? K.value : ne.value(y.value)), be = h(() => R.value <= M.value), Be = h(
|
|
98
98
|
() => !u.value && !t.single && !be.value && a.value.length
|
|
99
99
|
), ke = h(() => [a.value.length, t.selectItemType, "selected"].filter(Boolean).join(" ")), Se = h(() => t.preventEmpty || t.allowEmpty === "false" || t.allowEmpty === !1);
|
|
100
100
|
z(y, (e, l) => l !== e && q(-1)), z(a, () => w(), { deep: !0 }), z(
|
|
@@ -229,25 +229,25 @@ const rt = { class: "flex h-input items-center text-sm" }, it = ["id", "aria-lab
|
|
|
229
229
|
const l = e.relatedTarget;
|
|
230
230
|
!ue(l) && l && E();
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function Me(e) {
|
|
233
233
|
const l = e.target;
|
|
234
234
|
ue(l) || E();
|
|
235
235
|
}
|
|
236
|
-
const
|
|
236
|
+
const Fe = () => {
|
|
237
237
|
q(-1);
|
|
238
238
|
}, de = async () => {
|
|
239
|
-
await Z(), I.value && m.value && (
|
|
239
|
+
await Z(), I.value && m.value && (M.value = M.value === 0 ? m.value.clientHeight : M.value, R.value = I.value.clientHeight);
|
|
240
240
|
};
|
|
241
241
|
return Ne(() => {
|
|
242
242
|
if (V.onInput)
|
|
243
243
|
throw new Error("ll-select: use the @update:model-value event instead of @input.");
|
|
244
|
-
|
|
244
|
+
F && I.value && F.observe(I.value), window.addEventListener("resize", w), w();
|
|
245
245
|
}), Ae(() => {
|
|
246
|
-
window.removeEventListener("resize", de),
|
|
246
|
+
window.removeEventListener("resize", de), F == null || F.disconnect(), w.cancel();
|
|
247
247
|
}), (e, l) => {
|
|
248
248
|
var n;
|
|
249
249
|
return i(), ee(nt, De(t, {
|
|
250
|
-
class: ["input ll-select stash-select", B(V).class],
|
|
250
|
+
class: ["input ll-select stash-select relative", B(V).class],
|
|
251
251
|
"data-test": "stash-select",
|
|
252
252
|
"error-text": t.errorText || t.error,
|
|
253
253
|
"hint-text": t.hintText || t.hint
|
|
@@ -323,7 +323,7 @@ const rt = { class: "flex h-input items-center text-sm" }, it = ["id", "aria-lab
|
|
|
323
323
|
onFocusinOnce: l[4] || (l[4] = (s) => oe.value = !0),
|
|
324
324
|
onFocusout: Re,
|
|
325
325
|
onKeydown: ie,
|
|
326
|
-
onMouseleave:
|
|
326
|
+
onMouseleave: Fe
|
|
327
327
|
}, [
|
|
328
328
|
f("ul", {
|
|
329
329
|
ref_key: "chipsRef",
|
|
@@ -356,7 +356,7 @@ const rt = { class: "flex h-input items-center text-sm" }, it = ["id", "aria-lab
|
|
|
356
356
|
size: "small"
|
|
357
357
|
})
|
|
358
358
|
], 40, pt)
|
|
359
|
-
]
|
|
359
|
+
])
|
|
360
360
|
], 2))), 128)) : (i(!0), d(j, { key: 2 }, W(a.value, (s) => (i(), d("li", {
|
|
361
361
|
key: `chip-${s[t.trackBy]}`,
|
|
362
362
|
class: "inline-block"
|
|
@@ -378,7 +378,7 @@ const rt = { class: "flex h-input items-center text-sm" }, it = ["id", "aria-lab
|
|
|
378
378
|
]),
|
|
379
379
|
_: 2
|
|
380
380
|
}, 1032, ["onRemove"])
|
|
381
|
-
]
|
|
381
|
+
])
|
|
382
382
|
]))), 128))
|
|
383
383
|
], 512),
|
|
384
384
|
Be.value ? (i(), d("div", ht, [
|
|
@@ -411,7 +411,7 @@ const rt = { class: "flex h-input items-center text-sm" }, it = ["id", "aria-lab
|
|
|
411
411
|
H(f("div", {
|
|
412
412
|
ref_key: "optionsWrapperRef",
|
|
413
413
|
ref: O,
|
|
414
|
-
class: "stash-select__border-selector w-full shadow-2xl",
|
|
414
|
+
class: "stash-select stash-select__border-selector w-full shadow-2xl",
|
|
415
415
|
style: Ke(B(ye)),
|
|
416
416
|
onClick: l[3] || (l[3] = U(() => {
|
|
417
417
|
}, ["stop"]))
|
|
@@ -447,7 +447,7 @@ const rt = { class: "flex h-input items-center text-sm" }, it = ["id", "aria-lab
|
|
|
447
447
|
}, [
|
|
448
448
|
A(e.$slots, "option", { option: s }, () => [
|
|
449
449
|
D(k(s[t.displayBy] || s), 1)
|
|
450
|
-
]
|
|
450
|
+
]),
|
|
451
451
|
T(s) && !t.hideCheck ? (i(), d("span", gt, [
|
|
452
452
|
S(L, {
|
|
453
453
|
class: "text-blue-500",
|
|
@@ -467,7 +467,7 @@ const rt = { class: "flex h-input items-center text-sm" }, it = ["id", "aria-lab
|
|
|
467
467
|
H(f("li", Bt, [
|
|
468
468
|
A(e.$slots, "no-options", {}, () => [
|
|
469
469
|
l[6] || (l[6] = D(" No options ", -1))
|
|
470
|
-
]
|
|
470
|
+
])
|
|
471
471
|
], 512), [
|
|
472
472
|
[te, !t.loading && !re.value && !$.value.length]
|
|
473
473
|
])
|
|
@@ -481,7 +481,7 @@ const rt = { class: "flex h-input items-center text-sm" }, it = ["id", "aria-lab
|
|
|
481
481
|
], 8, ["to", "disabled"]))
|
|
482
482
|
], 40, ft)
|
|
483
483
|
], 42, dt)), [
|
|
484
|
-
[B(st),
|
|
484
|
+
[B(st), Me]
|
|
485
485
|
])
|
|
486
486
|
]),
|
|
487
487
|
key: "1"
|
|
@@ -489,15 +489,17 @@ const rt = { class: "flex h-input items-center text-sm" }, it = ["id", "aria-lab
|
|
|
489
489
|
(n = X.hint) != null && n.call(X) ? {
|
|
490
490
|
name: "hint",
|
|
491
491
|
fn: x(() => [
|
|
492
|
-
A(e.$slots, "hint"
|
|
492
|
+
A(e.$slots, "hint")
|
|
493
493
|
]),
|
|
494
494
|
key: "2"
|
|
495
495
|
} : void 0
|
|
496
496
|
]), 1040, ["class", "error-text", "hint-text"]);
|
|
497
497
|
};
|
|
498
498
|
}
|
|
499
|
-
}),
|
|
499
|
+
}), St = {}, wt = {
|
|
500
|
+
$style: St
|
|
501
|
+
}, Vt = /* @__PURE__ */ ot(kt, [["__cssModules", wt]]);
|
|
500
502
|
export {
|
|
501
|
-
|
|
503
|
+
Vt as default
|
|
502
504
|
};
|
|
503
505
|
//# sourceMappingURL=Select.js.map
|
package/dist/Select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sources":["../src/components/Select/Select.vue"],"sourcesContent":["<script lang=\"ts\">\n import { FieldProps } from '../Field/Field.types';\n\n // Note: the `trackBy` prop, the `single` prop, and the fact that options can be strings prevents us from knowing the type of the selected options\n\n type Option = any;\n\n type SelectedOptions = Option | Option[];\n\n export interface SelectProps extends FieldProps {\n /**\n * If there is only 1 option selected, it prevents that option from being de-selected\n */\n preventEmpty?: boolean;\n\n /**\n * @deprecated The `allowEmpty` prop is no longer supported; use `preventEmpty` instead.\n */\n allowEmpty?: string | boolean | null;\n\n /**\n * If `options` are an object, this is what prop to use for display.\n */\n displayBy?: string;\n\n /**\n * List of one or more fields to search on. When empty, displayBy will be used\n */\n searchBy?: string[];\n\n /**\n * Default field to track selected options by.\n */\n trackBy?: string;\n\n /**\n * Placeholder text.\n */\n placeholder?: string;\n\n /**\n * @deprecated Use the `error-text` prop instead\n */\n error?: string;\n\n /**\n * @deprecated Use the `hint-text` prop instead\n */\n hint?: string;\n\n /**\n * Sets a custom icon.\n */\n icon?: string | boolean;\n\n /**\n * Sets a name attribute on the native (hidden) select element\n *\n * Setting the default value to `undefined` so the attribute isn't rendered if not explicitly provided to ensure backwards compatibility with MP django forms\n */\n name?: string;\n\n /**\n * The list of all options to select from.\n */\n options?: Option[] | readonly Option[];\n\n /**\n * Lazily evaluate and set component `options`. Will execute upon user mouseover.\n */\n lazy?: () => Option[];\n\n /**\n * Sets the currently-selected value(s) for the component.\n * Accepts an array of Objects, or a single Object (if `single` is true), or a string\n */\n modelValue?: SelectedOptions;\n\n /**\n * @deprecated Use :model-value or v-model instead of :value.\n */\n value?: SelectedOptions | null;\n\n /**\n * Hides the search input\n */\n hideSearch?: boolean;\n\n /**\n * @deprecated The `searchable` prop is no longer supported; Use `hideSearch` instead.\n */\n searchable?: string | boolean | null;\n\n /**\n * If true, prevents the search term from being cleared when the drawer is dismissed.\n */\n preserveSearchTerm?: boolean;\n\n /**\n * Prevents the options from being filtered when the search term changes.\n * Allows the parent to filter the options.\n */\n disableFiltering?: boolean;\n\n /**\n * Functions as a single select, if true\n */\n single?: boolean;\n\n /**\n * Prevents the Selected Option from being truncated, if true\n */\n noTruncate?: boolean;\n\n /**\n * On an ajaxed request when the dropdown is open, we may be experiencing slower load times.\n * This flag will drop a loader into the dropdown. Note: This has never been design reviewed.\n */\n loading?: boolean;\n\n /**\n * @deprecated Instead, use the `@search` event (the onSearch prop) and ensure its event handler returns a Promise that resolves after the search is complete.\n */\n searchLoading?: boolean;\n\n /**\n * In the selection text we use this to give more visual distinction to what type of item(s) are selected\n * E.g. 2 customers selected. An empty string will result in `2 selected`.\n */\n selectItemType?: string;\n\n /**\n * Hides the \"check\" icon if truthy\n */\n hideCheck?: boolean;\n\n searchPlaceholder?: string;\n\n /**\n * Equivalent to emitting a \"search\" event, except this prop can be used to populate the list of `options` using an HTTP request because a prop's return value can be received and awaited, unlike an event.\n *\n * **Tip:** to show a loading indicator while searching, return a Promise that resolves after the search is complete.\n *\n * **Warning:** the search input is debounced so there is no need to debounce this function.\n */\n onSearch?: (searchTerm: string) => Promise<void> | void;\n\n /**\n * Uses the \"fuzzy search\" algorithm when searching, if true\n */\n useFuzzySearch?: boolean;\n\n /**\n * Sets the placement of the dropdown\n * @default 'bottom-start'\n */\n menuPlacement?: Placement;\n\n /**\n * Enables teleporting the dropdown\n * @default false\n */\n enableTeleport?: boolean;\n\n /**\n * The selector or element to which the dropdown should be teleported\n * @default `'#stash-menus-mount-node'`\n */\n teleportTo?: string | HTMLElement;\n }\n</script>\n\n<script setup lang=\"ts\">\n import { autoUpdate, flip, offset, type Placement, type Side, size, useFloating } from '@floating-ui/vue';\n import logger from '@leaflink/snitch';\n import debounce from 'lodash-es/debounce';\n import isEmpty from 'lodash-es/isEmpty';\n import isEqual from 'lodash-es/isEqual';\n import isPlainObject from 'lodash-es/isPlainObject';\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, nextTick, onMounted, onUnmounted, type Ref, ref, useAttrs, watch } from 'vue';\n\n import useSearch from '../../composables/useSearch/useSearch';\n import { DEBOUNCE, KEY_CODES } from '../../constants';\n import vClickoutside from '../../directives/clickoutside/clickoutside';\n import { DEFAULT_MENUS_PLUGIN_NODE_ID } from '../../plugins/MenusPlugin';\n import Chip from '../Chip/Chip.vue';\n import Field from '../Field/Field.vue';\n import Icon, { IconName } from '../Icon/Icon.vue';\n\n const GAP_HEIGHT = 6;\n\n const MENU_MAX_HEIGHT_PX = 300;\n\n defineOptions({\n name: 'll-select',\n });\n\n const props = withDefaults(defineProps<SelectProps>(), {\n preventEmpty: false,\n allowEmpty: null,\n displayBy: 'name',\n searchBy: () => [],\n trackBy: 'id',\n placeholder: 'Select option',\n error: '',\n hint: '',\n icon: 'caret-down',\n name: undefined,\n options: () => [],\n lazy: undefined,\n modelValue: () => [],\n value: null,\n hideSearch: false,\n searchable: null,\n preserveSearchTerm: false,\n disableFiltering: false,\n single: false,\n noTruncate: false,\n loading: false,\n searchLoading: false,\n selectItemType: '',\n hideCheck: false,\n searchPlaceholder: 'Search',\n onSearch: undefined,\n useFuzzySearch: false,\n menuPlacement: 'bottom-start',\n enableTeleport: false,\n teleportTo: `#${DEFAULT_MENUS_PLUGIN_NODE_ID}`,\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the model value changes.\n */\n (e: 'update:model-value', selectedOptions: SelectedOptions): void;\n /**\n * Emitted the selected value(s) a cleared.\n */\n (e: 'clear'): void;\n /**\n * Emitted when an option is added.\n */\n (e: 'add', optionAdded: Option): void;\n /**\n * Emitted when an option is removed.\n */\n (e: 'remove', optionRemoved: Option, index: number): void;\n /**\n * Emitted when the select is opened.\n */\n (e: 'opened'): void;\n /**\n * Emitted when the select is closed.\n */\n (e: 'closed', selectedOptions: SelectedOptions): void;\n }>();\n\n const attrs = useAttrs();\n const slots = defineSlots<{\n /**\n * Selected value(s) custom text. Exposes the option object and remove function.\n */\n selected(props: {\n /**\n * The selected option object.\n */\n option: Option;\n /**\n * Function to remove the selected option from the selection.\n */\n onRemove: () => void;\n /**\n * Class to apply to the selected chip.\n */\n chipSelectedClass: string;\n }): unknown;\n /**\n * Select custom option text. Exposes the option object\n */\n option(props: {\n /**\n * Option The option instance for this list item.\n */\n option: Option;\n }): unknown;\n /**\n * Slot for when there are no options available.\n */\n 'no-options'(): unknown;\n /**\n * Slot to display a helpful hint message below the select field.\n */\n hint(): unknown;\n }>();\n\n const selectRef = ref<HTMLDivElement | null>(null);\n const contentRef = ref<HTMLDivElement | null>(null);\n const optionsWrapperRef = ref<HTMLDivElement | null>(null);\n const chipsRef = ref<HTMLUListElement | null>(null);\n const searchRef = ref<HTMLInputElement | null>(null);\n\n const chipsHeight = ref(0);\n const contentHeight = ref(0);\n const internalValue = ref<Option[]>([]) as Ref<Option[]>;\n const searchFor = ref<(searchTerm: string) => Option[]>(() => []); // initialized in the watch handler for options\n const searchTerm = ref('');\n const activeIndex = ref(-1);\n const isActive = ref(false);\n const pendingSearchRequests = ref({});\n const shouldUseLazyOptions = ref(false);\n\n const { floatingStyles, update: updateFloating } = useFloating(selectRef, optionsWrapperRef, {\n whileElementsMounted: autoUpdate,\n placement: props.menuPlacement,\n middleware: [\n flip(),\n offset(({ rects, placement }) => {\n // gets the current placement side, especially after flip() is run\n const placementSide = placement.split('-')[0] as Side;\n const isBottom = placementSide === ('bottom' satisfies Side);\n\n // if the placement is at the bottom, we need to adjust the offset\n if (isBottom && chipsHeight.value > contentHeight.value) {\n return chipsHeight.value - rects.reference.height + GAP_HEIGHT;\n } else {\n return GAP_HEIGHT;\n }\n }),\n size({\n apply({ availableHeight, elements, rects }) {\n if (props.enableTeleport) {\n Object.assign(elements.floating.style, {\n maxWidth: `${rects.reference.width}px`,\n maxHeight: `${Math.min(availableHeight, MENU_MAX_HEIGHT_PX)}px`,\n });\n }\n },\n }),\n ],\n });\n // ResizeObserver is a browser API and is undefined in Node (SSR). Only create the observer when available\n // so this component remains SSR-safe (e.g. VitePress, Nuxt). Use optional chaining where we observe/disconnect.\n const resizeObserverChips =\n typeof ResizeObserver !== 'undefined' ? new ResizeObserver(() => debouncedUpdateChipsHeight()) : null;\n\n const isSearchable = computed(() => !props.hideSearch && props.searchable !== 'false' && props.searchable !== false);\n\n const internalOptions = computed(() => {\n let OPTIONS = (shouldUseLazyOptions.value && props.lazy ? props.lazy() : props.options).filter(Boolean); // prevent [undefined]\n\n // if `options` is an array... but not an array of objects\n if (!isPlainObject(OPTIONS[0])) {\n OPTIONS = OPTIONS.map((name, id) => ({ name, id }) as unknown as Option);\n }\n\n return OPTIONS;\n });\n\n const readOnlyValue = computed(() => {\n if (!internalValue.value.length) {\n return '';\n }\n\n return internalValue.value.map((option) => option[props.displayBy] || option).join(', ');\n });\n\n const isSearching = computed(() => props.searchLoading || Object.keys(pendingSearchRequests.value).length > 0);\n\n const filteredOptions = computed(() => {\n if (props.disableFiltering || !(searchTerm.value || '').trim()) {\n return internalOptions.value;\n }\n\n return searchFor.value(searchTerm.value);\n });\n\n const isChipsOneLine = computed(() => chipsHeight.value <= contentHeight.value);\n\n const shouldShowTotal = computed(\n () => !isActive.value && !props.single && !isChipsOneLine.value && internalValue.value.length,\n );\n\n const clearSelectionText = computed(() => {\n return [internalValue.value.length, props.selectItemType, 'selected'].filter(Boolean).join(' ');\n });\n\n const shouldPreventEmpty = computed(() => {\n return props.preventEmpty || props.allowEmpty === 'false' || props.allowEmpty === false;\n });\n\n watch(searchTerm, (currentValue, oldValue) => oldValue !== currentValue && setIndex(-1));\n\n watch(internalValue, () => debouncedUpdateChipsHeight(), { deep: true });\n\n watch(\n () => props.modelValue,\n (value) => {\n // multiple\n if (Array.isArray(value)) {\n const newValue = value.filter(Boolean); // sometimes modelValue is [undefined]\n\n if (!isEqual(newValue, internalValue.value)) {\n internalValue.value = newValue;\n }\n\n return;\n }\n\n // single; if value is a non-empty string or a non-empty object\n if (!isEmpty(value)) {\n if (!isEqual(value, internalValue.value[0])) {\n internalValue.value[0] = value;\n }\n\n return;\n }\n\n // if value is an empty object or falsy\n internalValue.value = [];\n },\n { immediate: true },\n );\n\n watch(\n () => props.options,\n () => {\n const { searchFor: searchForFn } = useSearch<Option>({\n items: computed(() => internalOptions.value),\n fieldNames: props.searchBy.length ? props.searchBy : [props.displayBy],\n trackBy: props.trackBy,\n });\n\n searchFor.value = (searchTerm) => searchForFn(searchTerm, { fuzzy: props.useFuzzySearch });\n },\n { immediate: true },\n );\n\n watch(chipsHeight, () => debouncedUpdateFloating());\n\n const debouncedUpdateFloating = debounce(() => updateFloating(), 50);\n const debouncedUpdateChipsHeight = debounce(() => updateChipsHeight(), 50);\n\n const isOptionDisabled = (option: Option) => {\n return option && typeof option === 'object' && 'disabled' in option && option?.disabled;\n };\n\n const clear = () => {\n internalValue.value = [];\n emit('update:model-value', props.single ? undefined : internalValue.value);\n emit('clear');\n };\n\n /**\n * Adds (or selects) an option.\n * @param {Option} option The selected option\n */\n const handleSelect = (option?: Option) => {\n if (props.disabled || !option || isOptionDisabled(option)) {\n return;\n }\n\n if (!isSelected(option)) {\n if (props.single) {\n internalValue.value = [];\n }\n\n internalValue.value.push(option);\n emit('update:model-value', props.single ? internalValue.value[0] : internalValue.value);\n emit('add', option);\n } else {\n remove(option);\n }\n\n if (props.single) {\n dismiss();\n }\n };\n\n const handleSelectChange = (evt) => {\n // If this is a single select, just pass along the option\n // This short-circuit is purely for readability, as the iterations for multi would also work for single selects\n if (props.single) {\n const selectedOption = internalOptions.value.find((opt) => opt[props.trackBy]?.toString() === evt.target.value);\n handleSelect(selectedOption);\n return;\n }\n\n // Spread the HTMLCollection (https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection) to array so we can invoke `find`\n const selectedOptions = [...evt.target.selectedOptions];\n\n // If it's a multiselect, the HTML select used for the screen reader can have multiple items\n // deselected and a new one selected in one change event.\n // We need to reconcile the new selected options with our internal state\n\n // 1. remove all the items in our internal state that are no longer present\n // (Spread this array so we can remove items from it while iterating)\n for (const internalOption of [...internalValue.value]) {\n const selectedOption = selectedOptions.find((opt) => opt.value === internalOption[props.trackBy]?.toString());\n\n if (!selectedOption) {\n remove(internalOption);\n }\n }\n\n // 2. add all the items that are now selected if needed\n for (const selectedOption of selectedOptions) {\n const internalOption = internalOptions.value.find(\n (opt) => opt[props.trackBy]?.toString() === selectedOption.value,\n );\n\n if (isSelected(internalOption)) {\n continue;\n } else {\n handleSelect(internalOption);\n }\n }\n };\n\n /**\n * Removes (or un-selects) an option.\n * @param {Option} option The option to be removed\n */\n const remove = (option: Option) => {\n if (props.disabled || (shouldPreventEmpty.value && internalValue.value.length === 1)) {\n return;\n }\n\n const index = internalValue.value.findIndex((opt) => opt[props.trackBy] === option[props.trackBy]);\n\n if (index === -1) {\n logger.warn('ll-select: could not find option to remove', option);\n return;\n }\n\n internalValue.value.splice(index, 1);\n emit('update:model-value', props.single ? internalValue.value[0] : internalValue.value);\n emit('remove', option, index);\n };\n\n /**\n * Opens the `options` drawer and provides focus.\n */\n const open = () => {\n if (isActive.value) {\n return;\n }\n\n debouncedUpdateChipsHeight();\n\n isActive.value = true;\n emit('opened');\n\n if (isSearchable.value) {\n nextTick(() => {\n searchRef.value?.focus({ preventScroll: true });\n });\n }\n };\n\n /**\n * Closes the drawer and cleans up a few settings.\n */\n const dismiss = () => {\n if (isActive.value) {\n emit('closed', internalValue.value);\n }\n\n setIndex(-1);\n isActive.value = false;\n\n if (!props.preserveSearchTerm) {\n searchTerm.value = '';\n }\n\n // The optional chaining here is required.\n // There are cases when the component is removed from the DOM and the ref is lost.\n // .ie when the component is used in a modal and the modal is dismissed.\n // Tracked in this ticket: F-1893\n contentRef.value?.blur(); // if the component remains in focus, clicking it again will not open the options list\n };\n\n /**\n * Scroll list items when up and down keys are pressed\n * @param {KeyboardEvent} e The native keydown event.\n */\n const scrollItems = async (e: KeyboardEvent) => {\n await nextTick();\n\n if (!contentRef.value) {\n return;\n }\n\n const allowedKeyCodes = [KEY_CODES.ENTER, KEY_CODES.ESCAPE] as number[];\n\n // Wait for highlighted item update after using keyboard (`onKeyDown`)\n if (!allowedKeyCodes.includes(e.keyCode)) {\n const el = contentRef.value.querySelector('.stash-select__option--highlighted');\n const elBCR = el?.getBoundingClientRect();\n const parentBCR = contentRef.value.getBoundingClientRect();\n\n if (!elBCR || !parentBCR) {\n return;\n }\n\n if (elBCR.bottom >= parentBCR.bottom || elBCR.top <= parentBCR.top + elBCR.height) {\n el?.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n }\n }\n };\n\n /**\n * Sets the `activeIndex` on hover, so that the user may then fine-tune\n * their selection with the arrow keys.\n */\n const setIndex = (index: number) => {\n activeIndex.value = index;\n };\n\n /**\n * Handles all user keyboard input on the Dropdown.\n * @param {KeyboardEvent} e The native keydown event.\n */\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.keyCode === KEY_CODES.ESCAPE) {\n dismiss();\n } else if (e.keyCode === KEY_CODES.DOWN && activeIndex.value < filteredOptions.value.length - 1 && isActive.value) {\n activeIndex.value++;\n } else if (e.keyCode === KEY_CODES.UP && activeIndex.value > 0) {\n if (isActive.value) {\n activeIndex.value--;\n }\n\n // Scroll to top when search is available and first element is highlighted (Using 100 to be sure that it'll be sure that search is visible)\n if (optionsWrapperRef.value && isSearchable.value && activeIndex.value === 0) {\n optionsWrapperRef.value.scrollTop -= 100;\n }\n } else if (e.keyCode === KEY_CODES.ENTER && activeIndex.value !== -1 && isActive.value) {\n handleSelect(filteredOptions.value[activeIndex.value]);\n } else {\n return;\n }\n\n e.preventDefault(); // if keyDown did something / we didn't return\n scrollItems(e);\n };\n\n const handleSearchInput = debounce(function () {\n search();\n }, DEBOUNCE.FAST);\n\n const search = async function () {\n if (!props.onSearch) {\n return;\n }\n\n const requestId = uniqueId('search-request-');\n\n try {\n pendingSearchRequests.value[requestId] = true;\n await props.onSearch(searchTerm.value);\n } finally {\n delete pendingSearchRequests.value[requestId];\n }\n };\n\n /**\n * Dynamically sets classes on an `option` in the drawer.\n * @param {Option} option The `option` for which to generate classes\n * @param {number} index The index of the `option` in the list of `options`\n */\n const optionClass = (option: Option, index: number) => {\n return [\n {\n 'stash-select__option': true,\n 'stash-select__option--disabled': isOptionDisabled(option),\n 'stash-select__option--highlighted': activeIndex.value === index,\n 'stash-select__option--selected': isSelected(option),\n },\n\n // @deprecated\n // backwards compatibility\n {\n 'is-selected': activeIndex.value === index,\n 'bg-ice-200': activeIndex.value === index,\n 'bg-blue-100 text-ice-700': isSelected(option),\n },\n ];\n };\n\n /**\n * Finds out if the given item is already present in the selected options\n * @param {Option} option The item to check\n * @returns {boolean} Returns true if element is selected\n */\n const isSelected = (option?: Option | null): boolean => {\n if (option === undefined || option === null) {\n return false;\n }\n\n return internalValue.value.some((value) => value?.[props.trackBy] === option[props.trackBy]);\n };\n\n /**\n * Checks if the element is within the Select menu by checking both the content and the teleportTo element\n */\n function isElementWithinSelectMenu(element: Node | null) {\n if (!element) {\n return false;\n }\n\n const isElementInMenu = contentRef.value?.contains(element);\n const isElementInTeleportedMenu = optionsWrapperRef.value?.contains(element);\n\n return isElementInMenu || isElementInTeleportedMenu;\n }\n\n function handleFocusOut(focusEvent: FocusEvent) {\n const nextFocusedElement = focusEvent.relatedTarget as Node | null;\n const isFocusedElementInMenu = isElementWithinSelectMenu(nextFocusedElement);\n\n if (!isFocusedElementInMenu && nextFocusedElement) {\n dismiss();\n }\n }\n\n function handleOutsideClick(event: MouseEvent) {\n const target = event.target as Node | null;\n const isFocusedElementInMenu = isElementWithinSelectMenu(target);\n\n if (!isFocusedElementInMenu) {\n dismiss();\n }\n }\n\n /**\n * Handles the mouse leave of the select and clears item highlight\n */\n const handleMouseLeave = () => {\n setIndex(-1);\n };\n\n /**\n * Update height of chips container\n */\n const updateChipsHeight = async () => {\n // Wait for the DOM to update so we can get an accurate value for chips' clientHeight\n await nextTick();\n\n if (chipsRef.value && contentRef.value) {\n contentHeight.value = contentHeight.value === 0 ? contentRef.value.clientHeight : contentHeight.value;\n chipsHeight.value = chipsRef.value.clientHeight;\n }\n };\n\n onMounted(() => {\n if (attrs.onInput) {\n throw new Error('ll-select: use the @update:model-value event instead of @input.');\n }\n\n if (resizeObserverChips && chipsRef.value) {\n resizeObserverChips.observe(chipsRef.value); // no-op when null (SSR)\n }\n\n window.addEventListener('resize', debouncedUpdateChipsHeight);\n\n debouncedUpdateChipsHeight();\n });\n\n /**\n * Remove event listener to handle component width when resizing window\n */\n onUnmounted(() => {\n window.removeEventListener('resize', updateChipsHeight);\n resizeObserverChips?.disconnect(); // null during SSR\n debouncedUpdateChipsHeight.cancel();\n });\n</script>\n\n<template>\n <Field\n v-bind=\"props\"\n class=\"input ll-select stash-select\"\n data-test=\"stash-select\"\n :class=\"attrs.class\"\n :error-text=\"props.errorText || props.error\"\n :hint-text=\"props.hintText || props.hint\"\n >\n <template v-if=\"props.isReadOnly\" #default=\"{ fieldId, labelId }\">\n <div class=\"flex h-input items-center text-sm\">\n <span :id=\"fieldId\" :aria-labelledby=\"labelId\" class=\"show-empty h-min\">\n {{ readOnlyValue }}\n </span>\n </div>\n </template>\n <template v-else #default=\"{ fieldId, fieldErrorId, hasError }\">\n <!-- SCREEN READER ONLY -->\n <select\n :id=\"fieldId\"\n :aria-errormessage=\"fieldErrorId\"\n :aria-invalid=\"hasError\"\n class=\"sr-only\"\n :disabled=\"props.disabled\"\n :multiple=\"!props.single\"\n :name=\"props.name\"\n @change=\"handleSelectChange\"\n >\n <option\n v-for=\"(option, index) in filteredOptions\"\n :key=\"`srOnlyOption-${index}`\"\n :selected=\"isSelected(option)\"\n :value=\"option[props.trackBy]\"\n :disabled=\"isOptionDisabled(option)\"\n >\n {{ option[props.displayBy] || '' }}\n </option>\n\n <!-- Empty option to allow deselecting non-multiselects -->\n <option value=\"\"></option>\n </select>\n\n <!-- SELECT -->\n <div\n ref=\"selectRef\"\n v-clickoutside=\"handleOutsideClick\"\n role=\"listbox\"\n aria-hidden=\"true\"\n class=\"stash-select__content-wrapper\"\n :aria-controls=\"'listbox-' + fieldId\"\n :aria-expanded=\"isActive\"\n :aria-label=\"props.placeholder\"\n :aria-disabled=\"props.disabled || undefined\"\n :class=\"[\n {\n 'stash-select--disabled': !!props.disabled,\n 'stash-select--error': !!(props.errorText || props.error),\n 'stash-select--active': isActive,\n 'stash-select--single': props.single,\n },\n\n // @deprecated\n // backwards compatibility\n {\n 'is-active': isActive,\n 'is-single': props.single,\n 'is-disabled': props.disabled,\n },\n ]\"\n @keydown=\"onKeyDown\"\n @keyup.esc=\"dismiss\"\n >\n <!-- CONTENT -->\n <div\n :id=\"'listbox-' + fieldId\"\n ref=\"contentRef\"\n class=\"input-field stash-select__content\"\n tabindex=\"0\"\n data-test=\"stash-select|dropdown-trigger\"\n @focusin=\"open\"\n @focusin.once=\"shouldUseLazyOptions = true\"\n @focusout=\"handleFocusOut\"\n @keydown=\"open\"\n @mouseleave=\"handleMouseLeave\"\n >\n <!-- CHIPS -->\n <ul ref=\"chipsRef\" class=\"stash-select__chips\">\n <!-- PLACEHOLDER -->\n <li\n v-if=\"!internalValue.length\"\n class=\"stash-select__placeholder mr-0 pl-1.5\"\n :class=\"{ truncate: !props.noTruncate }\"\n >\n {{ props.placeholder }}\n </li>\n\n <template v-if=\"props.single\">\n <li\n v-for=\"option of internalValue\"\n :key=\"`chip-${option[props.trackBy]}`\"\n class=\"stash-select__selected mr-0 pl-1.5\"\n :class=\"{ truncate: !props.noTruncate }\"\n >\n <slot\n name=\"selected\"\n :option=\"option\"\n :on-remove=\"() => remove(option)\"\n chip-selected-class=\"stash-select__chip\"\n >\n {{ option[props.displayBy] || option }}\n <button\n tabindex=\"-1\"\n class=\"stash-select__remove\"\n @keypress.enter.prevent=\"remove(option)\"\n @mousedown.prevent.stop=\"remove(option)\"\n >\n <Icon icon=\"close\" name=\"close\" size=\"small\" />\n </button>\n </slot>\n </li>\n </template>\n\n <template v-else>\n <li v-for=\"option of internalValue\" :key=\"`chip-${option[props.trackBy]}`\" class=\"inline-block\">\n <slot\n name=\"selected\"\n :option=\"option\"\n :on-remove=\"() => remove(option)\"\n chip-selected-class=\"stash-select__chip\"\n >\n <Chip\n bg-color=\"blue-500\"\n is-removable\n text-color=\"white\"\n class=\"stash-select__chip\"\n @remove=\"remove(option)\"\n >\n {{ option[props.displayBy] || option }}\n </Chip>\n </slot>\n </li>\n </template>\n </ul>\n\n <!-- TOTAL -->\n <div v-if=\"shouldShowTotal\" class=\"stash-select__total\">\n <Chip bg-color=\"blue-500\" is-removable text-color=\"white\" class=\"stash-select__chip\" @remove=\"clear\">\n {{ clearSelectionText }}\n </Chip>\n </div>\n\n <!-- TOGGLE -->\n <Icon\n v-if=\"props.icon\"\n class=\"stash-select__icon\"\n data-test=\"stash-select|toggle-icon\"\n :name=\"props.icon as IconName\"\n :class=\"{ 'text-ice-500': props.disabled }\"\n @mousedown.prevent=\"isActive && dismiss()\"\n />\n <!-- DRAWER -->\n <Teleport :to=\"props.teleportTo\" :disabled=\"!props.enableTeleport\">\n <transition name=\"fade\">\n <div\n v-show=\"isActive && !props.disabled\"\n ref=\"optionsWrapperRef\"\n class=\"stash-select__border-selector w-full shadow-2xl\"\n :style=\"floatingStyles\"\n @click.stop\n >\n <!-- SEARCH -->\n <div v-if=\"isSearchable\" class=\"flex items-center border-b border-blue-500 pr-1.5\">\n <input\n ref=\"searchRef\"\n v-model=\"searchTerm\"\n type=\"text\"\n autocomplete=\"off\"\n class=\"stash-select__search\"\n :data-test=\"attrs['data-test'] ? attrs['data-test'] + '-search' : 'stash-select|search'\"\n :placeholder=\"props.searchPlaceholder\"\n :spellcheck=\"false\"\n @input=\"handleSearchInput\"\n />\n <Icon name=\"search\" class=\"text-ice-500\" />\n </div>\n\n <!-- OPTIONS -->\n <ul class=\"stash-select__options options my-1.5 w-full border-white bg-white\">\n <li\n v-for=\"(option, index) in filteredOptions\"\n :key=\"`option-${option[props.trackBy]}`\"\n :data-test=\"option[props.trackBy]\"\n :class=\"optionClass(option, index)\"\n @click=\"handleSelect(option)\"\n @mouseenter.self=\"setIndex(index)\"\n >\n <slot name=\"option\" :option=\"option\">\n {{ option[props.displayBy] || option }}\n </slot>\n\n <span v-if=\"isSelected(option) && !props.hideCheck\" class=\"ml-auto pl-1.5\">\n <Icon class=\"text-blue-500\" name=\"check\" />\n </span>\n </li>\n <li v-show=\"props.loading || isSearching\" class=\"m-1.5 cursor-default p-1.5\">\n <Icon data-test=\"stash-select|options-loading\" name=\"working\" class=\"animate-spin text-ice-500\" />\n </li>\n <li\n v-show=\"!props.loading && !isSearching && !filteredOptions.length\"\n class=\"m-1.5 cursor-default p-1.5\"\n data-test=\"stash-select|no-options\"\n >\n <slot name=\"no-options\"> No options </slot>\n </li>\n </ul>\n </div>\n </transition>\n </Teleport>\n </div>\n </div>\n </template>\n <template v-if=\"slots.hint?.()\" #hint>\n <slot name=\"hint\"></slot>\n </template>\n </Field>\n</template>\n\n<style scoped>\n @reference \"../../../styles/main.css\";\n\n @layer utilities {\n .stash-select {\n position: relative;\n }\n\n .stash-select__content,\n .stash-select__content-wrapper {\n height: var(--height-input);\n }\n\n .stash-select__content {\n cursor: pointer;\n overflow: hidden;\n position: absolute;\n background: var(--color-white);\n border: 1px solid var(--color-ice-500);\n border-radius: var(--radius-sm);\n color: var(--color-ice-700);\n display: block;\n font-family: var(--font-family-sofia);\n font-size: var(--text-sm);\n font-weight: normal;\n outline: none;\n padding: 0 !important;\n width: 100%;\n\n &:hover {\n border-color: var(--color-ice-500);\n }\n\n &:focus-within {\n border-color: var(--color-blue-500) !important;\n }\n }\n\n .stash-select--disabled .stash-select__content {\n background-color: var(--color-ice-100);\n border-color: var(--color-ice-500);\n color: var(--color-ice-500);\n pointer-events: none !important;\n }\n\n .stash-select--active .stash-select__content {\n cursor: default;\n height: auto;\n min-width: var(--width-select-menu);\n overflow: visible;\n z-index: var(--z-index-control);\n box-shadow: var(--shadow-sm);\n }\n\n .stash-select--error :where(.stash-select__content, .stash-select__content:hover:not(:focus)) {\n border-color: var(--color-red-500) !important;\n }\n\n .stash-select__placeholder {\n color: var(--color-ice-500);\n }\n\n .stash-select--active .stash-select__placeholder {\n cursor: default;\n }\n\n .stash-select__icon {\n color: var(--color-ice-700);\n cursor: pointer;\n pointer-events: none;\n position: absolute;\n right: --spacing(1.5);\n top: --spacing(1.5);\n }\n\n .stash-select--disabled .stash-select__icon {\n color: var(--color-ice-500);\n }\n\n .stash-select--active .stash-select__icon {\n pointer-events: auto;\n }\n\n .stash-select__chips {\n /* distribute (or split?) the margin between chip and chips container. TODO? */\n --half-space: calc(--spacing(1.5) / 2);\n\n padding: var(--half-space);\n padding-right: --spacing(9);\n }\n\n /* chip AND placeholder AND selected: */\n .stash-select__chips > li {\n cursor: pointer;\n height: var(--height-chip);\n margin: var(--half-space);\n max-width: 100%;\n }\n\n .stash-select--disabled .stash-select__chips > li {\n cursor: default;\n }\n\n .stash-select__content-wrapper:deep(.stash-select__chip) {\n border-radius: var(--radius-sm);\n font-size: var(--text-sm);\n font-weight: normal;\n height: var(--height-chip);\n max-width: inherit;\n text-transform: none;\n }\n\n .stash-select--disabled:deep(.stash-select__chip) {\n background: var(--color-ice-500);\n color: var(--color-white);\n }\n\n /* Base total chip styles moved above the more specific descendant rule to satisfy no-descending-specificity */\n .stash-select__total {\n display: block;\n font-weight: var(--font-weight-semibold);\n line-height: var(--line-height-button);\n position: absolute;\n right: --spacing(6);\n white-space: nowrap;\n z-index: var(--z-index-content);\n\n /* -- design TBD --- */\n top: 0;\n left: 0;\n bottom: 0;\n color: var(--color-white);\n background: white;\n padding: --spacing(1.5);\n }\n\n .stash-select__content-wrapper .stash-select__total:deep(.stash-select__chip) {\n font-weight: var(--font-weight-normal);\n }\n\n .stash-select__selected {\n color: var(--color-ice-700);\n }\n\n .stash-select--disabled .stash-select__selected {\n color: var(--color-ice-500);\n }\n\n .stash-select__selected :where(.stash-select__remove) {\n display: none;\n }\n\n .stash-select__search {\n position: relative;\n width: 100%;\n height: var(--height-input);\n background: var(--color-white);\n border-radius: var(--radius-sm);\n color: var(--color-ice-700);\n display: block;\n font-family: var(--font-family-sofia);\n font-size: var(--text-sm);\n font-weight: var(--font-weight-normal);\n outline: none;\n padding: 0 --spacing(3);\n border: 0 !important;\n }\n\n .stash-select__border-selector {\n background: white;\n border-radius: var(--radius-sm);\n border: 1px solid var(--color-blue-500);\n max-height: var(--max-height-select-menu);\n overflow: auto;\n z-index: var(--z-index-dialog);\n }\n\n .stash-select__option {\n align-items: center;\n border-radius: var(--radius-sm);\n cursor: pointer;\n display: flex;\n line-height: --spacing(6);\n margin: --spacing(1.5);\n padding: --spacing(1.5);\n }\n\n .stash-select__option--disabled {\n color: var(--color-ice-500);\n cursor: not-allowed;\n }\n\n .stash-select__option--highlighted {\n background-color: var(--color-ice-200);\n }\n\n .stash-select__option--selected {\n background-color: var(--color-blue-100);\n color: var(--color-ice-700);\n }\n }\n</style>\n"],"names":["props","__props","emit","__emit","attrs","useAttrs","slots","_useSlots","selectRef","ref","contentRef","optionsWrapperRef","chipsRef","searchRef","chipsHeight","contentHeight","internalValue","searchFor","searchTerm","activeIndex","isActive","pendingSearchRequests","shouldUseLazyOptions","floatingStyles","updateFloating","useFloating","autoUpdate","flip","offset","rects","placement","size","availableHeight","elements","resizeObserverChips","debouncedUpdateChipsHeight","isSearchable","computed","internalOptions","OPTIONS","isPlainObject","name","id","readOnlyValue","option","isSearching","filteredOptions","isChipsOneLine","shouldShowTotal","clearSelectionText","shouldPreventEmpty","watch","currentValue","oldValue","setIndex","value","newValue","isEqual","isEmpty","searchForFn","useSearch","debouncedUpdateFloating","debounce","updateChipsHeight","isOptionDisabled","clear","handleSelect","isSelected","remove","dismiss","handleSelectChange","evt","selectedOption","opt","_a","selectedOptions","internalOption","index","logger","open","nextTick","scrollItems","KEY_CODES","el","elBCR","parentBCR","onKeyDown","handleSearchInput","search","DEBOUNCE","requestId","uniqueId","optionClass","isElementWithinSelectMenu","element","isElementInMenu","isElementInTeleportedMenu","_b","handleFocusOut","focusEvent","nextFocusedElement","handleOutsideClick","event","target","handleMouseLeave","onMounted","onUnmounted","_createBlock","Field","_mergeProps","_unref","fieldId","labelId","_createElementVNode","_hoisted_1","_hoisted_2","_withCtx","fieldErrorId","hasError","_openBlock","_createElementBlock","_Fragment","_renderList","_hoisted_4","_normalizeClass","_toDisplayString","_renderSlot","_ctx","_createTextVNode","_withKeys","_withModifiers","$event","_createVNode","Icon","Chip","_hoisted_8","_cache","_Teleport","_Transition","_hoisted_9","args","_hoisted_11","_hoisted_13","_withDirectives","_hoisted_14","_hoisted_15","_vShow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsME,UAAMA,IAAQC,IAiCRC,IAAOC,IA2BPC,IAAQC,GAAA,GACRC,IAAQC,GAAA,GAqCRC,KAAYC,EAA2B,IAAI,GAC3CC,IAAaD,EAA2B,IAAI,GAC5CE,IAAoBF,EAA2B,IAAI,GACnDG,IAAWH,EAA6B,IAAI,GAC5CI,KAAYJ,EAA6B,IAAI,GAE7CK,IAAcL,EAAI,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nB,gBAAY,EAAA;AAAA,4BAAA;;4BAJ3B,CAAAmB,IAAA,CAAAlJ,EAAM,WAAO,CAAK6C,YAAW,CAAKC,EAAA,MAAgB,MAAM;AAAA,0BAAA;;;6BA5C7D1B,EAAA,SAAQ,CAAKpB,EAAM,QAAQ;AAAA,sBAAA;;;;;;;sBAvH3BqG,EAAkB;AAAA,YAAA;;;;SAgLtB3B,IAAApE,EAAM,SAAN,QAAAoE,EAAA,KAAApE;gBAAiB;AAAA,gBAC/B,MAAyB;AAAA,YAAzBwH,EAAyBC,EAAA,QAAA,QAAA,CAAA,GAAA,QAAA,EAAA;AAAA,UAAA;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Select.js","sources":["../src/components/Select/Select.vue"],"sourcesContent":["<script lang=\"ts\">\n import { FieldProps } from '../Field/Field.types';\n\n // Note: the `trackBy` prop, the `single` prop, and the fact that options can be strings prevents us from knowing the type of the selected options\n\n type Option = any;\n\n type SelectedOptions = Option | Option[];\n\n export interface SelectProps extends FieldProps {\n /**\n * If there is only 1 option selected, it prevents that option from being de-selected\n */\n preventEmpty?: boolean;\n\n /**\n * @deprecated The `allowEmpty` prop is no longer supported; use `preventEmpty` instead.\n */\n allowEmpty?: string | boolean | null;\n\n /**\n * If `options` are an object, this is what prop to use for display.\n */\n displayBy?: string;\n\n /**\n * List of one or more fields to search on. When empty, displayBy will be used\n */\n searchBy?: string[];\n\n /**\n * Default field to track selected options by.\n */\n trackBy?: string;\n\n /**\n * Placeholder text.\n */\n placeholder?: string;\n\n /**\n * @deprecated Use the `error-text` prop instead\n */\n error?: string;\n\n /**\n * @deprecated Use the `hint-text` prop instead\n */\n hint?: string;\n\n /**\n * Sets a custom icon.\n */\n icon?: string | boolean;\n\n /**\n * Sets a name attribute on the native (hidden) select element\n *\n * Setting the default value to `undefined` so the attribute isn't rendered if not explicitly provided to ensure backwards compatibility with MP django forms\n */\n name?: string;\n\n /**\n * The list of all options to select from.\n */\n options?: Option[] | readonly Option[];\n\n /**\n * Lazily evaluate and set component `options`. Will execute upon user mouseover.\n */\n lazy?: () => Option[];\n\n /**\n * Sets the currently-selected value(s) for the component.\n * Accepts an array of Objects, or a single Object (if `single` is true), or a string\n */\n modelValue?: SelectedOptions;\n\n /**\n * @deprecated Use :model-value or v-model instead of :value.\n */\n value?: SelectedOptions | null;\n\n /**\n * Hides the search input\n */\n hideSearch?: boolean;\n\n /**\n * @deprecated The `searchable` prop is no longer supported; Use `hideSearch` instead.\n */\n searchable?: string | boolean | null;\n\n /**\n * If true, prevents the search term from being cleared when the drawer is dismissed.\n */\n preserveSearchTerm?: boolean;\n\n /**\n * Prevents the options from being filtered when the search term changes.\n * Allows the parent to filter the options.\n */\n disableFiltering?: boolean;\n\n /**\n * Functions as a single select, if true\n */\n single?: boolean;\n\n /**\n * Prevents the Selected Option from being truncated, if true\n */\n noTruncate?: boolean;\n\n /**\n * On an ajaxed request when the dropdown is open, we may be experiencing slower load times.\n * This flag will drop a loader into the dropdown. Note: This has never been design reviewed.\n */\n loading?: boolean;\n\n /**\n * @deprecated Instead, use the `@search` event (the onSearch prop) and ensure its event handler returns a Promise that resolves after the search is complete.\n */\n searchLoading?: boolean;\n\n /**\n * In the selection text we use this to give more visual distinction to what type of item(s) are selected\n * E.g. 2 customers selected. An empty string will result in `2 selected`.\n */\n selectItemType?: string;\n\n /**\n * Hides the \"check\" icon if truthy\n */\n hideCheck?: boolean;\n\n searchPlaceholder?: string;\n\n /**\n * Equivalent to emitting a \"search\" event, except this prop can be used to populate the list of `options` using an HTTP request because a prop's return value can be received and awaited, unlike an event.\n *\n * **Tip:** to show a loading indicator while searching, return a Promise that resolves after the search is complete.\n *\n * **Warning:** the search input is debounced so there is no need to debounce this function.\n */\n onSearch?: (searchTerm: string) => Promise<void> | void;\n\n /**\n * Uses the \"fuzzy search\" algorithm when searching, if true\n */\n useFuzzySearch?: boolean;\n\n /**\n * Sets the placement of the dropdown\n * @default 'bottom-start'\n */\n menuPlacement?: Placement;\n\n /**\n * Enables teleporting the dropdown\n * @default false\n */\n enableTeleport?: boolean;\n\n /**\n * The selector or element to which the dropdown should be teleported\n * @default `'#stash-menus-mount-node'`\n */\n teleportTo?: string | HTMLElement;\n }\n</script>\n\n<script setup lang=\"ts\">\n import { autoUpdate, flip, offset, type Placement, type Side, size, useFloating } from '@floating-ui/vue';\n import logger from '@leaflink/snitch';\n import debounce from 'lodash-es/debounce';\n import isEmpty from 'lodash-es/isEmpty';\n import isEqual from 'lodash-es/isEqual';\n import isPlainObject from 'lodash-es/isPlainObject';\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, nextTick, onMounted, onUnmounted, type Ref, ref, useAttrs, watch } from 'vue';\n\n import useSearch from '../../composables/useSearch/useSearch';\n import { DEBOUNCE, KEY_CODES } from '../../constants';\n import vClickoutside from '../../directives/clickoutside/clickoutside';\n import { DEFAULT_MENUS_PLUGIN_NODE_ID } from '../../plugins/MenusPlugin';\n import Chip from '../Chip/Chip.vue';\n import Field from '../Field/Field.vue';\n import Icon, { IconName } from '../Icon/Icon.vue';\n\n const GAP_HEIGHT = 6;\n\n const MENU_MAX_HEIGHT_PX = 300;\n\n defineOptions({\n name: 'll-select',\n });\n\n const props = withDefaults(defineProps<SelectProps>(), {\n preventEmpty: false,\n allowEmpty: null,\n displayBy: 'name',\n searchBy: () => [],\n trackBy: 'id',\n placeholder: 'Select option',\n error: '',\n hint: '',\n icon: 'caret-down',\n name: undefined,\n options: () => [],\n lazy: undefined,\n modelValue: () => [],\n value: null,\n hideSearch: false,\n searchable: null,\n preserveSearchTerm: false,\n disableFiltering: false,\n single: false,\n noTruncate: false,\n loading: false,\n searchLoading: false,\n selectItemType: '',\n hideCheck: false,\n searchPlaceholder: 'Search',\n onSearch: undefined,\n useFuzzySearch: false,\n menuPlacement: 'bottom-start',\n enableTeleport: false,\n teleportTo: `#${DEFAULT_MENUS_PLUGIN_NODE_ID}`,\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the model value changes.\n */\n (e: 'update:model-value', selectedOptions: SelectedOptions): void;\n /**\n * Emitted the selected value(s) a cleared.\n */\n (e: 'clear'): void;\n /**\n * Emitted when an option is added.\n */\n (e: 'add', optionAdded: Option): void;\n /**\n * Emitted when an option is removed.\n */\n (e: 'remove', optionRemoved: Option, index: number): void;\n /**\n * Emitted when the select is opened.\n */\n (e: 'opened'): void;\n /**\n * Emitted when the select is closed.\n */\n (e: 'closed', selectedOptions: SelectedOptions): void;\n }>();\n\n const attrs = useAttrs();\n const slots = defineSlots<{\n /**\n * Selected value(s) custom text. Exposes the option object and remove function.\n */\n selected(props: {\n /**\n * The selected option object.\n */\n option: Option;\n /**\n * Function to remove the selected option from the selection.\n */\n onRemove: () => void;\n /**\n * Class to apply to the selected chip.\n */\n chipSelectedClass: string;\n }): unknown;\n /**\n * Select custom option text. Exposes the option object\n */\n option(props: {\n /**\n * Option The option instance for this list item.\n */\n option: Option;\n }): unknown;\n /**\n * Slot for when there are no options available.\n */\n 'no-options'(): unknown;\n /**\n * Slot to display a helpful hint message below the select field.\n */\n hint(): unknown;\n }>();\n\n const selectRef = ref<HTMLDivElement | null>(null);\n const contentRef = ref<HTMLDivElement | null>(null);\n const optionsWrapperRef = ref<HTMLDivElement | null>(null);\n const chipsRef = ref<HTMLUListElement | null>(null);\n const searchRef = ref<HTMLInputElement | null>(null);\n\n const chipsHeight = ref(0);\n const contentHeight = ref(0);\n const internalValue = ref<Option[]>([]) as Ref<Option[]>;\n const searchFor = ref<(searchTerm: string) => Option[]>(() => []); // initialized in the watch handler for options\n const searchTerm = ref('');\n const activeIndex = ref(-1);\n const isActive = ref(false);\n const pendingSearchRequests = ref({});\n const shouldUseLazyOptions = ref(false);\n\n const { floatingStyles, update: updateFloating } = useFloating(selectRef, optionsWrapperRef, {\n whileElementsMounted: autoUpdate,\n placement: props.menuPlacement,\n middleware: [\n flip(),\n offset(({ rects, placement }) => {\n // gets the current placement side, especially after flip() is run\n const placementSide = placement.split('-')[0] as Side;\n const isBottom = placementSide === ('bottom' satisfies Side);\n\n // if the placement is at the bottom, we need to adjust the offset\n if (isBottom && chipsHeight.value > contentHeight.value) {\n return chipsHeight.value - rects.reference.height + GAP_HEIGHT;\n } else {\n return GAP_HEIGHT;\n }\n }),\n size({\n apply({ availableHeight, elements, rects }) {\n if (props.enableTeleport) {\n Object.assign(elements.floating.style, {\n maxWidth: `${rects.reference.width}px`,\n maxHeight: `${Math.min(availableHeight, MENU_MAX_HEIGHT_PX)}px`,\n });\n }\n },\n }),\n ],\n });\n // ResizeObserver is a browser API and is undefined in Node (SSR). Only create the observer when available\n // so this component remains SSR-safe (e.g. VitePress, Nuxt). Use optional chaining where we observe/disconnect.\n const resizeObserverChips =\n typeof ResizeObserver !== 'undefined' ? new ResizeObserver(() => debouncedUpdateChipsHeight()) : null;\n\n const isSearchable = computed(() => !props.hideSearch && props.searchable !== 'false' && props.searchable !== false);\n\n const internalOptions = computed(() => {\n let OPTIONS = (shouldUseLazyOptions.value && props.lazy ? props.lazy() : props.options).filter(Boolean); // prevent [undefined]\n\n // if `options` is an array... but not an array of objects\n if (!isPlainObject(OPTIONS[0])) {\n OPTIONS = OPTIONS.map((name, id) => ({ name, id }) as unknown as Option);\n }\n\n return OPTIONS;\n });\n\n const readOnlyValue = computed(() => {\n if (!internalValue.value.length) {\n return '';\n }\n\n return internalValue.value.map((option) => option[props.displayBy] || option).join(', ');\n });\n\n const isSearching = computed(() => props.searchLoading || Object.keys(pendingSearchRequests.value).length > 0);\n\n const filteredOptions = computed(() => {\n if (props.disableFiltering || !(searchTerm.value || '').trim()) {\n return internalOptions.value;\n }\n\n return searchFor.value(searchTerm.value);\n });\n\n const isChipsOneLine = computed(() => chipsHeight.value <= contentHeight.value);\n\n const shouldShowTotal = computed(\n () => !isActive.value && !props.single && !isChipsOneLine.value && internalValue.value.length,\n );\n\n const clearSelectionText = computed(() => {\n return [internalValue.value.length, props.selectItemType, 'selected'].filter(Boolean).join(' ');\n });\n\n const shouldPreventEmpty = computed(() => {\n return props.preventEmpty || props.allowEmpty === 'false' || props.allowEmpty === false;\n });\n\n watch(searchTerm, (currentValue, oldValue) => oldValue !== currentValue && setIndex(-1));\n\n watch(internalValue, () => debouncedUpdateChipsHeight(), { deep: true });\n\n watch(\n () => props.modelValue,\n (value) => {\n // multiple\n if (Array.isArray(value)) {\n const newValue = value.filter(Boolean); // sometimes modelValue is [undefined]\n\n if (!isEqual(newValue, internalValue.value)) {\n internalValue.value = newValue;\n }\n\n return;\n }\n\n // single; if value is a non-empty string or a non-empty object\n if (!isEmpty(value)) {\n if (!isEqual(value, internalValue.value[0])) {\n internalValue.value[0] = value;\n }\n\n return;\n }\n\n // if value is an empty object or falsy\n internalValue.value = [];\n },\n { immediate: true },\n );\n\n watch(\n () => props.options,\n () => {\n const { searchFor: searchForFn } = useSearch<Option>({\n items: computed(() => internalOptions.value),\n fieldNames: props.searchBy.length ? props.searchBy : [props.displayBy],\n trackBy: props.trackBy,\n });\n\n searchFor.value = (searchTerm) => searchForFn(searchTerm, { fuzzy: props.useFuzzySearch });\n },\n { immediate: true },\n );\n\n watch(chipsHeight, () => debouncedUpdateFloating());\n\n const debouncedUpdateFloating = debounce(() => updateFloating(), 50);\n const debouncedUpdateChipsHeight = debounce(() => updateChipsHeight(), 50);\n\n const isOptionDisabled = (option: Option) => {\n return option && typeof option === 'object' && 'disabled' in option && option?.disabled;\n };\n\n const clear = () => {\n internalValue.value = [];\n emit('update:model-value', props.single ? undefined : internalValue.value);\n emit('clear');\n };\n\n /**\n * Adds (or selects) an option.\n * @param {Option} option The selected option\n */\n const handleSelect = (option?: Option) => {\n if (props.disabled || !option || isOptionDisabled(option)) {\n return;\n }\n\n if (!isSelected(option)) {\n if (props.single) {\n internalValue.value = [];\n }\n\n internalValue.value.push(option);\n emit('update:model-value', props.single ? internalValue.value[0] : internalValue.value);\n emit('add', option);\n } else {\n remove(option);\n }\n\n if (props.single) {\n dismiss();\n }\n };\n\n const handleSelectChange = (evt) => {\n // If this is a single select, just pass along the option\n // This short-circuit is purely for readability, as the iterations for multi would also work for single selects\n if (props.single) {\n const selectedOption = internalOptions.value.find((opt) => opt[props.trackBy]?.toString() === evt.target.value);\n handleSelect(selectedOption);\n return;\n }\n\n // Spread the HTMLCollection (https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection) to array so we can invoke `find`\n const selectedOptions = [...evt.target.selectedOptions];\n\n // If it's a multiselect, the HTML select used for the screen reader can have multiple items\n // deselected and a new one selected in one change event.\n // We need to reconcile the new selected options with our internal state\n\n // 1. remove all the items in our internal state that are no longer present\n // (Spread this array so we can remove items from it while iterating)\n for (const internalOption of [...internalValue.value]) {\n const selectedOption = selectedOptions.find((opt) => opt.value === internalOption[props.trackBy]?.toString());\n\n if (!selectedOption) {\n remove(internalOption);\n }\n }\n\n // 2. add all the items that are now selected if needed\n for (const selectedOption of selectedOptions) {\n const internalOption = internalOptions.value.find(\n (opt) => opt[props.trackBy]?.toString() === selectedOption.value,\n );\n\n if (isSelected(internalOption)) {\n continue;\n } else {\n handleSelect(internalOption);\n }\n }\n };\n\n /**\n * Removes (or un-selects) an option.\n * @param {Option} option The option to be removed\n */\n const remove = (option: Option) => {\n if (props.disabled || (shouldPreventEmpty.value && internalValue.value.length === 1)) {\n return;\n }\n\n const index = internalValue.value.findIndex((opt) => opt[props.trackBy] === option[props.trackBy]);\n\n if (index === -1) {\n logger.warn('ll-select: could not find option to remove', option);\n return;\n }\n\n internalValue.value.splice(index, 1);\n emit('update:model-value', props.single ? internalValue.value[0] : internalValue.value);\n emit('remove', option, index);\n };\n\n /**\n * Opens the `options` drawer and provides focus.\n */\n const open = () => {\n if (isActive.value) {\n return;\n }\n\n debouncedUpdateChipsHeight();\n\n isActive.value = true;\n emit('opened');\n\n if (isSearchable.value) {\n nextTick(() => {\n searchRef.value?.focus({ preventScroll: true });\n });\n }\n };\n\n /**\n * Closes the drawer and cleans up a few settings.\n */\n const dismiss = () => {\n if (isActive.value) {\n emit('closed', internalValue.value);\n }\n\n setIndex(-1);\n isActive.value = false;\n\n if (!props.preserveSearchTerm) {\n searchTerm.value = '';\n }\n\n // The optional chaining here is required.\n // There are cases when the component is removed from the DOM and the ref is lost.\n // .ie when the component is used in a modal and the modal is dismissed.\n // Tracked in this ticket: F-1893\n contentRef.value?.blur(); // if the component remains in focus, clicking it again will not open the options list\n };\n\n /**\n * Scroll list items when up and down keys are pressed\n * @param {KeyboardEvent} e The native keydown event.\n */\n const scrollItems = async (e: KeyboardEvent) => {\n await nextTick();\n\n if (!contentRef.value) {\n return;\n }\n\n const allowedKeyCodes = [KEY_CODES.ENTER, KEY_CODES.ESCAPE] as number[];\n\n // Wait for highlighted item update after using keyboard (`onKeyDown`)\n if (!allowedKeyCodes.includes(e.keyCode)) {\n const el = contentRef.value.querySelector('.stash-select__option--highlighted');\n const elBCR = el?.getBoundingClientRect();\n const parentBCR = contentRef.value.getBoundingClientRect();\n\n if (!elBCR || !parentBCR) {\n return;\n }\n\n if (elBCR.bottom >= parentBCR.bottom || elBCR.top <= parentBCR.top + elBCR.height) {\n el?.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n }\n }\n };\n\n /**\n * Sets the `activeIndex` on hover, so that the user may then fine-tune\n * their selection with the arrow keys.\n */\n const setIndex = (index: number) => {\n activeIndex.value = index;\n };\n\n /**\n * Handles all user keyboard input on the Dropdown.\n * @param {KeyboardEvent} e The native keydown event.\n */\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.keyCode === KEY_CODES.ESCAPE) {\n dismiss();\n } else if (e.keyCode === KEY_CODES.DOWN && activeIndex.value < filteredOptions.value.length - 1 && isActive.value) {\n activeIndex.value++;\n } else if (e.keyCode === KEY_CODES.UP && activeIndex.value > 0) {\n if (isActive.value) {\n activeIndex.value--;\n }\n\n // Scroll to top when search is available and first element is highlighted (Using 100 to be sure that it'll be sure that search is visible)\n if (optionsWrapperRef.value && isSearchable.value && activeIndex.value === 0) {\n optionsWrapperRef.value.scrollTop -= 100;\n }\n } else if (e.keyCode === KEY_CODES.ENTER && activeIndex.value !== -1 && isActive.value) {\n handleSelect(filteredOptions.value[activeIndex.value]);\n } else {\n return;\n }\n\n e.preventDefault(); // if keyDown did something / we didn't return\n scrollItems(e);\n };\n\n const handleSearchInput = debounce(function () {\n search();\n }, DEBOUNCE.FAST);\n\n const search = async function () {\n if (!props.onSearch) {\n return;\n }\n\n const requestId = uniqueId('search-request-');\n\n try {\n pendingSearchRequests.value[requestId] = true;\n await props.onSearch(searchTerm.value);\n } finally {\n delete pendingSearchRequests.value[requestId];\n }\n };\n\n /**\n * Dynamically sets classes on an `option` in the drawer.\n * @param {Option} option The `option` for which to generate classes\n * @param {number} index The index of the `option` in the list of `options`\n */\n const optionClass = (option: Option, index: number) => {\n return [\n {\n 'stash-select__option': true,\n 'stash-select__option--disabled': isOptionDisabled(option),\n 'stash-select__option--highlighted': activeIndex.value === index,\n 'stash-select__option--selected': isSelected(option),\n },\n\n // @deprecated\n // backwards compatibility\n {\n 'is-selected': activeIndex.value === index,\n 'bg-ice-200': activeIndex.value === index,\n 'bg-blue-100 text-ice-700': isSelected(option),\n },\n ];\n };\n\n /**\n * Finds out if the given item is already present in the selected options\n * @param {Option} option The item to check\n * @returns {boolean} Returns true if element is selected\n */\n const isSelected = (option?: Option | null): boolean => {\n if (option === undefined || option === null) {\n return false;\n }\n\n return internalValue.value.some((value) => value?.[props.trackBy] === option[props.trackBy]);\n };\n\n /**\n * Checks if the element is within the Select menu by checking both the content and the teleportTo element\n */\n function isElementWithinSelectMenu(element: Node | null) {\n if (!element) {\n return false;\n }\n\n const isElementInMenu = contentRef.value?.contains(element);\n const isElementInTeleportedMenu = optionsWrapperRef.value?.contains(element);\n\n return isElementInMenu || isElementInTeleportedMenu;\n }\n\n function handleFocusOut(focusEvent: FocusEvent) {\n const nextFocusedElement = focusEvent.relatedTarget as Node | null;\n const isFocusedElementInMenu = isElementWithinSelectMenu(nextFocusedElement);\n\n if (!isFocusedElementInMenu && nextFocusedElement) {\n dismiss();\n }\n }\n\n function handleOutsideClick(event: MouseEvent) {\n const target = event.target as Node | null;\n const isFocusedElementInMenu = isElementWithinSelectMenu(target);\n\n if (!isFocusedElementInMenu) {\n dismiss();\n }\n }\n\n /**\n * Handles the mouse leave of the select and clears item highlight\n */\n const handleMouseLeave = () => {\n setIndex(-1);\n };\n\n /**\n * Update height of chips container\n */\n const updateChipsHeight = async () => {\n // Wait for the DOM to update so we can get an accurate value for chips' clientHeight\n await nextTick();\n\n if (chipsRef.value && contentRef.value) {\n contentHeight.value = contentHeight.value === 0 ? contentRef.value.clientHeight : contentHeight.value;\n chipsHeight.value = chipsRef.value.clientHeight;\n }\n };\n\n onMounted(() => {\n if (attrs.onInput) {\n throw new Error('ll-select: use the @update:model-value event instead of @input.');\n }\n\n if (resizeObserverChips && chipsRef.value) {\n resizeObserverChips.observe(chipsRef.value); // no-op when null (SSR)\n }\n\n window.addEventListener('resize', debouncedUpdateChipsHeight);\n\n debouncedUpdateChipsHeight();\n });\n\n /**\n * Remove event listener to handle component width when resizing window\n */\n onUnmounted(() => {\n window.removeEventListener('resize', updateChipsHeight);\n resizeObserverChips?.disconnect(); // null during SSR\n debouncedUpdateChipsHeight.cancel();\n });\n</script>\n\n<template>\n <Field\n v-bind=\"props\"\n class=\"input ll-select stash-select relative\"\n data-test=\"stash-select\"\n :class=\"attrs.class\"\n :error-text=\"props.errorText || props.error\"\n :hint-text=\"props.hintText || props.hint\"\n >\n <template v-if=\"props.isReadOnly\" #default=\"{ fieldId, labelId }\">\n <div class=\"flex h-input items-center text-sm\">\n <span :id=\"fieldId\" :aria-labelledby=\"labelId\" class=\"show-empty h-min\">\n {{ readOnlyValue }}\n </span>\n </div>\n </template>\n <template v-else #default=\"{ fieldId, fieldErrorId, hasError }\">\n <!-- SCREEN READER ONLY -->\n <select\n :id=\"fieldId\"\n :aria-errormessage=\"fieldErrorId\"\n :aria-invalid=\"hasError\"\n class=\"sr-only\"\n :disabled=\"props.disabled\"\n :multiple=\"!props.single\"\n :name=\"props.name\"\n @change=\"handleSelectChange\"\n >\n <option\n v-for=\"(option, index) in filteredOptions\"\n :key=\"`srOnlyOption-${index}`\"\n :selected=\"isSelected(option)\"\n :value=\"option[props.trackBy]\"\n :disabled=\"isOptionDisabled(option)\"\n >\n {{ option[props.displayBy] || '' }}\n </option>\n\n <!-- Empty option to allow deselecting non-multiselects -->\n <option value=\"\"></option>\n </select>\n\n <!-- SELECT -->\n <div\n ref=\"selectRef\"\n v-clickoutside=\"handleOutsideClick\"\n role=\"listbox\"\n aria-hidden=\"true\"\n class=\"stash-select__content-wrapper\"\n :aria-controls=\"'listbox-' + fieldId\"\n :aria-expanded=\"isActive\"\n :aria-label=\"props.placeholder\"\n :aria-disabled=\"props.disabled || undefined\"\n :class=\"[\n {\n 'stash-select--disabled': !!props.disabled,\n 'stash-select--error': !!(props.errorText || props.error),\n 'stash-select--active': isActive,\n 'stash-select--single': props.single,\n },\n\n // @deprecated\n // backwards compatibility\n {\n 'is-active': isActive,\n 'is-single': props.single,\n 'is-disabled': props.disabled,\n },\n ]\"\n @keydown=\"onKeyDown\"\n @keyup.esc=\"dismiss\"\n >\n <!-- CONTENT -->\n <div\n :id=\"'listbox-' + fieldId\"\n ref=\"contentRef\"\n class=\"input-field stash-select__content\"\n tabindex=\"0\"\n data-test=\"stash-select|dropdown-trigger\"\n @focusin=\"open\"\n @focusin.once=\"shouldUseLazyOptions = true\"\n @focusout=\"handleFocusOut\"\n @keydown=\"open\"\n @mouseleave=\"handleMouseLeave\"\n >\n <!-- CHIPS -->\n <ul ref=\"chipsRef\" class=\"stash-select__chips\">\n <!-- PLACEHOLDER -->\n <li\n v-if=\"!internalValue.length\"\n class=\"stash-select__placeholder mr-0 pl-1.5\"\n :class=\"{ truncate: !props.noTruncate }\"\n >\n {{ props.placeholder }}\n </li>\n\n <template v-if=\"props.single\">\n <li\n v-for=\"option of internalValue\"\n :key=\"`chip-${option[props.trackBy]}`\"\n class=\"stash-select__selected mr-0 pl-1.5\"\n :class=\"{ truncate: !props.noTruncate }\"\n >\n <slot\n name=\"selected\"\n :option=\"option\"\n :on-remove=\"() => remove(option)\"\n chip-selected-class=\"stash-select__chip\"\n >\n {{ option[props.displayBy] || option }}\n <button\n tabindex=\"-1\"\n class=\"stash-select__remove\"\n @keypress.enter.prevent=\"remove(option)\"\n @mousedown.prevent.stop=\"remove(option)\"\n >\n <Icon icon=\"close\" name=\"close\" size=\"small\" />\n </button>\n </slot>\n </li>\n </template>\n\n <template v-else>\n <li v-for=\"option of internalValue\" :key=\"`chip-${option[props.trackBy]}`\" class=\"inline-block\">\n <slot\n name=\"selected\"\n :option=\"option\"\n :on-remove=\"() => remove(option)\"\n chip-selected-class=\"stash-select__chip\"\n >\n <Chip\n bg-color=\"blue-500\"\n is-removable\n text-color=\"white\"\n class=\"stash-select__chip\"\n @remove=\"remove(option)\"\n >\n {{ option[props.displayBy] || option }}\n </Chip>\n </slot>\n </li>\n </template>\n </ul>\n\n <!-- TOTAL -->\n <div v-if=\"shouldShowTotal\" class=\"stash-select__total\">\n <Chip bg-color=\"blue-500\" is-removable text-color=\"white\" class=\"stash-select__chip\" @remove=\"clear\">\n {{ clearSelectionText }}\n </Chip>\n </div>\n\n <!-- TOGGLE -->\n <Icon\n v-if=\"props.icon\"\n class=\"stash-select__icon\"\n data-test=\"stash-select|toggle-icon\"\n :name=\"props.icon as IconName\"\n :class=\"{ 'text-ice-500': props.disabled }\"\n @mousedown.prevent=\"isActive && dismiss()\"\n />\n <!-- DRAWER -->\n <Teleport :to=\"props.teleportTo\" :disabled=\"!props.enableTeleport\">\n <transition name=\"fade\">\n <!-- Duplicate stash-select class so :global(:where(.stash-select) …) rules still apply when the menu is teleported outside the Field root. -->\n <div\n v-show=\"isActive && !props.disabled\"\n ref=\"optionsWrapperRef\"\n class=\"stash-select stash-select__border-selector w-full shadow-2xl\"\n :style=\"floatingStyles\"\n @click.stop\n >\n <!-- SEARCH -->\n <div v-if=\"isSearchable\" class=\"flex items-center border-b border-blue-500 pr-1.5\">\n <input\n ref=\"searchRef\"\n v-model=\"searchTerm\"\n type=\"text\"\n autocomplete=\"off\"\n class=\"stash-select__search\"\n :data-test=\"attrs['data-test'] ? attrs['data-test'] + '-search' : 'stash-select|search'\"\n :placeholder=\"props.searchPlaceholder\"\n :spellcheck=\"false\"\n @input=\"handleSearchInput\"\n />\n <Icon name=\"search\" class=\"text-ice-500\" />\n </div>\n\n <!-- OPTIONS -->\n <ul class=\"stash-select__options options my-1.5 w-full border-white bg-white\">\n <li\n v-for=\"(option, index) in filteredOptions\"\n :key=\"`option-${option[props.trackBy]}`\"\n :data-test=\"option[props.trackBy]\"\n :class=\"optionClass(option, index)\"\n @click=\"handleSelect(option)\"\n @mouseenter.self=\"setIndex(index)\"\n >\n <slot name=\"option\" :option=\"option\">\n {{ option[props.displayBy] || option }}\n </slot>\n\n <span v-if=\"isSelected(option) && !props.hideCheck\" class=\"ml-auto pl-1.5\">\n <Icon class=\"text-blue-500\" name=\"check\" />\n </span>\n </li>\n <li v-show=\"props.loading || isSearching\" class=\"m-1.5 cursor-default p-1.5\">\n <Icon data-test=\"stash-select|options-loading\" name=\"working\" class=\"animate-spin text-ice-500\" />\n </li>\n <li\n v-show=\"!props.loading && !isSearching && !filteredOptions.length\"\n class=\"m-1.5 cursor-default p-1.5\"\n data-test=\"stash-select|no-options\"\n >\n <slot name=\"no-options\"> No options </slot>\n </li>\n </ul>\n </div>\n </transition>\n </Teleport>\n </div>\n </div>\n </template>\n <template v-if=\"slots.hint?.()\" #hint>\n <slot name=\"hint\"></slot>\n </template>\n </Field>\n</template>\n\n<style module>\n @reference \"../../../styles/main.css\";\n\n @layer utilities {\n :global(:where(.stash-select) .stash-select__content),\n :global(:where(.stash-select) .stash-select__content-wrapper) {\n height: var(--height-input);\n }\n\n :global(:where(.stash-select) .stash-select__content) {\n cursor: pointer;\n overflow: hidden;\n position: absolute;\n background: var(--color-white);\n border: 1px solid var(--color-ice-500);\n border-radius: var(--radius-sm);\n color: var(--color-ice-700);\n display: block;\n font-family: var(--font-family-sofia);\n font-size: var(--text-sm);\n font-weight: normal;\n outline: none;\n padding: 0 !important;\n width: 100%;\n }\n\n :global(:where(.stash-select) .stash-select__content:hover) {\n border-color: var(--color-ice-500);\n }\n\n :global(:where(.stash-select) .stash-select__content:focus-within) {\n border-color: var(--color-blue-500) !important;\n }\n\n :global(:where(.stash-select) .stash-select--disabled .stash-select__content) {\n background-color: var(--color-ice-100);\n border-color: var(--color-ice-500);\n color: var(--color-ice-500);\n pointer-events: none !important;\n }\n\n :global(:where(.stash-select) .stash-select--active .stash-select__content) {\n cursor: default;\n height: auto;\n min-width: var(--width-select-menu);\n overflow: visible;\n z-index: var(--z-index-control);\n box-shadow: var(--shadow-sm);\n }\n\n :global(\n :where(.stash-select)\n .stash-select--error\n :where(.stash-select__content, .stash-select__content:hover:not(:focus))\n ) {\n border-color: var(--color-red-500) !important;\n }\n\n :global(:where(.stash-select) .stash-select__placeholder) {\n color: var(--color-ice-500);\n }\n\n :global(:where(.stash-select) .stash-select--active .stash-select__placeholder) {\n cursor: default;\n }\n\n :global(:where(.stash-select) .stash-select__icon) {\n color: var(--color-ice-700);\n cursor: pointer;\n pointer-events: none;\n position: absolute;\n right: --spacing(1.5);\n top: --spacing(1.5);\n }\n\n :global(:where(.stash-select) .stash-select--disabled .stash-select__icon) {\n color: var(--color-ice-500);\n }\n\n :global(:where(.stash-select) .stash-select--active .stash-select__icon) {\n pointer-events: auto;\n }\n\n :global(:where(.stash-select) .stash-select__chips) {\n /* distribute (or split?) the margin between chip and chips container. TODO? */\n --half-space: calc(--spacing(1.5) / 2);\n\n padding: var(--half-space);\n padding-right: --spacing(9);\n }\n\n /* chip AND placeholder AND selected: */\n :global(:where(.stash-select) .stash-select__chips > li) {\n cursor: pointer;\n height: var(--height-chip);\n margin: var(--half-space);\n max-width: 100%;\n }\n\n :global(:where(.stash-select) .stash-select--disabled .stash-select__chips > li) {\n cursor: default;\n }\n\n :global(:where(.stash-select) .stash-select__content-wrapper .stash-select__chip) {\n border-radius: var(--radius-sm);\n font-size: var(--text-sm);\n font-weight: normal;\n height: var(--height-chip);\n max-width: inherit;\n text-transform: none;\n }\n\n :global(:where(.stash-select) .stash-select--disabled .stash-select__chip) {\n background: var(--color-ice-500);\n color: var(--color-white);\n }\n\n /* Base total chip styles moved above the more specific descendant rule to satisfy no-descending-specificity */\n :global(:where(.stash-select) .stash-select__total) {\n display: block;\n font-weight: var(--font-weight-semibold);\n line-height: var(--line-height-button);\n position: absolute;\n right: --spacing(6);\n white-space: nowrap;\n z-index: var(--z-index-content);\n\n /* -- design TBD --- */\n top: 0;\n left: 0;\n bottom: 0;\n color: var(--color-white);\n background: white;\n padding: --spacing(1.5);\n }\n\n :global(:where(.stash-select) .stash-select__content-wrapper .stash-select__total .stash-select__chip) {\n font-weight: var(--font-weight-normal);\n }\n\n :global(:where(.stash-select) .stash-select__selected) {\n color: var(--color-ice-700);\n }\n\n :global(:where(.stash-select) .stash-select--disabled .stash-select__selected) {\n color: var(--color-ice-500);\n }\n\n :global(:where(.stash-select) .stash-select__selected :where(.stash-select__remove)) {\n display: none;\n }\n\n :global(:where(.stash-select) .stash-select__search) {\n position: relative;\n width: 100%;\n height: var(--height-input);\n background: var(--color-white);\n border-radius: var(--radius-sm);\n color: var(--color-ice-700);\n display: block;\n font-family: var(--font-family-sofia);\n font-size: var(--text-sm);\n font-weight: var(--font-weight-normal);\n outline: none;\n padding: 0 --spacing(3);\n border: 0 !important;\n }\n\n /* Include compound selector so teleported menu (same node carries .stash-select + __border-selector) still matches */\n :global(:where(.stash-select) .stash-select__border-selector),\n :global(:where(.stash-select).stash-select__border-selector) {\n background: white;\n border-radius: var(--radius-sm);\n border: 1px solid var(--color-blue-500);\n max-height: var(--max-height-select-menu);\n overflow: auto;\n z-index: var(--z-index-dialog);\n }\n\n :global(:where(.stash-select) .stash-select__option) {\n align-items: center;\n border-radius: var(--radius-sm);\n cursor: pointer;\n display: flex;\n line-height: --spacing(6);\n margin: --spacing(1.5);\n padding: --spacing(1.5);\n }\n\n :global(:where(.stash-select) .stash-select__option--disabled) {\n color: var(--color-ice-500);\n cursor: not-allowed;\n }\n\n :global(:where(.stash-select) .stash-select__option--highlighted) {\n background-color: var(--color-ice-200);\n }\n\n :global(:where(.stash-select) .stash-select__option--selected) {\n background-color: var(--color-blue-100);\n color: var(--color-ice-700);\n }\n }\n</style>\n"],"names":["props","__props","emit","__emit","attrs","useAttrs","slots","_useSlots","selectRef","ref","contentRef","optionsWrapperRef","chipsRef","searchRef","chipsHeight","contentHeight","internalValue","searchFor","searchTerm","activeIndex","isActive","pendingSearchRequests","shouldUseLazyOptions","floatingStyles","updateFloating","useFloating","autoUpdate","flip","offset","rects","placement","size","availableHeight","elements","resizeObserverChips","debouncedUpdateChipsHeight","isSearchable","computed","internalOptions","OPTIONS","isPlainObject","name","id","readOnlyValue","option","isSearching","filteredOptions","isChipsOneLine","shouldShowTotal","clearSelectionText","shouldPreventEmpty","watch","currentValue","oldValue","setIndex","value","newValue","isEqual","isEmpty","searchForFn","useSearch","debouncedUpdateFloating","debounce","updateChipsHeight","isOptionDisabled","clear","handleSelect","isSelected","remove","dismiss","handleSelectChange","evt","selectedOption","opt","_a","selectedOptions","internalOption","index","logger","open","nextTick","scrollItems","KEY_CODES","el","elBCR","parentBCR","onKeyDown","handleSearchInput","search","DEBOUNCE","requestId","uniqueId","optionClass","isElementWithinSelectMenu","element","isElementInMenu","isElementInTeleportedMenu","_b","handleFocusOut","focusEvent","nextFocusedElement","handleOutsideClick","event","target","handleMouseLeave","onMounted","onUnmounted","_createBlock","Field","_mergeProps","_unref","fieldId","labelId","_createElementVNode","_hoisted_1","_hoisted_2","_withCtx","fieldErrorId","hasError","_openBlock","_createElementBlock","_Fragment","_renderList","_hoisted_4","_normalizeClass","_toDisplayString","_renderSlot","_ctx","_createTextVNode","_withKeys","_withModifiers","$event","_createVNode","Icon","Chip","_hoisted_8","_cache","_Teleport","_Transition","_hoisted_9","args","_hoisted_11","_hoisted_13","_withDirectives","_hoisted_14","_hoisted_15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