@scalar/components 0.14.21 → 0.14.23
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/components/ScalarCombobox/ScalarCombobox.stories.d.ts +29 -60
- package/dist/components/ScalarCombobox/ScalarCombobox.stories.d.ts.map +1 -1
- package/dist/components/ScalarCombobox/ScalarCombobox.vue.d.ts +21 -41
- package/dist/components/ScalarCombobox/ScalarCombobox.vue.d.ts.map +1 -1
- package/dist/components/ScalarCombobox/ScalarCombobox.vue.js +40 -27
- package/dist/components/ScalarCombobox/ScalarComboboxMultiselect.test.d.ts +2 -0
- package/dist/components/ScalarCombobox/ScalarComboboxMultiselect.test.d.ts.map +1 -0
- package/dist/components/ScalarCombobox/ScalarComboboxMultiselect.vue.d.ts +252 -438
- package/dist/components/ScalarCombobox/ScalarComboboxMultiselect.vue.d.ts.map +1 -1
- package/dist/components/ScalarCombobox/ScalarComboboxMultiselect.vue.js +45 -32
- package/dist/components/ScalarCombobox/ScalarComboboxOption.test.d.ts +2 -0
- package/dist/components/ScalarCombobox/ScalarComboboxOption.test.d.ts.map +1 -0
- package/dist/components/ScalarCombobox/ScalarComboboxOption.vue.d.ts +5 -9
- package/dist/components/ScalarCombobox/ScalarComboboxOption.vue.d.ts.map +1 -1
- package/dist/components/ScalarCombobox/ScalarComboboxOption.vue.js +14 -28
- package/dist/components/ScalarCombobox/ScalarComboboxOptionGroup.test.d.ts +2 -0
- package/dist/components/ScalarCombobox/ScalarComboboxOptionGroup.test.d.ts.map +1 -0
- package/dist/components/ScalarCombobox/ScalarComboboxOptionGroup.vue.d.ts.map +1 -1
- package/dist/components/ScalarCombobox/ScalarComboboxOptionGroup.vue.js +5 -5
- package/dist/components/ScalarCombobox/ScalarComboboxOptions.test.d.ts +2 -0
- package/dist/components/ScalarCombobox/ScalarComboboxOptions.test.d.ts.map +1 -0
- package/dist/components/ScalarCombobox/ScalarComboboxOptions.vue.d.ts +22 -29
- package/dist/components/ScalarCombobox/ScalarComboboxOptions.vue.d.ts.map +1 -1
- package/dist/components/ScalarCombobox/ScalarComboboxOptions.vue.js +2 -2
- package/dist/components/ScalarCombobox/ScalarComboboxOptions.vue2.js +112 -92
- package/dist/components/ScalarCombobox/ScalarComboboxOptions.vue3.js +2 -2
- package/dist/components/ScalarCombobox/ScalarComboboxPopover.test.d.ts +2 -0
- package/dist/components/ScalarCombobox/ScalarComboboxPopover.test.d.ts.map +1 -0
- package/dist/components/ScalarCombobox/types.d.ts +17 -6
- package/dist/components/ScalarCombobox/types.d.ts.map +1 -1
- package/dist/components/ScalarCombobox/types.js +3 -3
- package/dist/components/ScalarListbox/ScalarListbox.vue.js +25 -25
- package/dist/components/ScalarListbox/ScalarListboxCheckbox.vue.d.ts +1 -2
- package/dist/components/ScalarListbox/ScalarListboxCheckbox.vue.d.ts.map +1 -1
- package/dist/components/ScalarListbox/ScalarListboxCheckbox.vue.js +7 -7
- package/dist/components/ScalarListbox/ScalarListboxItem.vue.d.ts +2 -2
- package/dist/components/ScalarListbox/ScalarListboxItem.vue.d.ts.map +1 -1
- package/dist/components/ScalarListbox/ScalarListboxItem.vue.js +17 -17
- package/dist/components/ScalarListbox/index.d.ts +1 -1
- package/dist/components/ScalarListbox/index.d.ts.map +1 -1
- package/dist/components/ScalarListbox/types.d.ts +0 -1
- package/dist/components/ScalarListbox/types.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +6 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScalarComboboxMultiselect.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCombobox/ScalarComboboxMultiselect.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScalarComboboxMultiselect.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCombobox/ScalarComboboxMultiselect.vue"],"names":[],"mappings":"AAsFA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAG9D,OAAO,KAAK,EACV,aAAa,EACb,MAAM,EACN,WAAW,EACX,eAAe,EAChB,MAAM,SAAS,CAAA;yBAGE,CAAC,SAAS,MAAM,WAAW,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,gCACvD,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WAsJxD,mBAAmB,CAAC;;;qBAxHjB,CAAC,EAAE;;iBA1BH,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;sBAChB,MAAM;8BAiJ+F,CAAC,4BAA2B;oBAChI,OAAO,KAAK,EAAE,gBAAgB;;;;;;;;;;;;;;;;gCAvKjD,KA1CS,eA0CT,KA1C6B,uBA0C7B,KAxCC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+MsE,GAAG,IAAI;WACpE,GAAG;;;;;;YAK+B,OAAO,CAAC,OAAO,WAAW,CAAC;;AAhKvE,wBAgK4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as g, mergeModels as v, useModel as $, ref as y, createBlock as m, openBlock as d, withCtx as o, createCommentVNode as k, createSlots as c, renderSlot as l, normalizeProps as i, guardReactiveProps as f } from "vue";
|
|
2
|
+
import V from "./ScalarComboboxOptions.vue.js";
|
|
3
|
+
import h from "./ScalarComboboxPopover.vue.js";
|
|
4
|
+
const B = /* @__PURE__ */ g({
|
|
5
5
|
__name: "ScalarComboboxMultiselect",
|
|
6
|
-
props: {
|
|
6
|
+
props: /* @__PURE__ */ v({
|
|
7
7
|
options: {},
|
|
8
|
-
modelValue: {},
|
|
9
8
|
placeholder: {},
|
|
10
|
-
isDeletable: { type: Boolean },
|
|
11
9
|
placement: {},
|
|
12
10
|
offset: { type: [Number, Object, Function] },
|
|
13
11
|
resize: { type: Boolean },
|
|
14
12
|
target: {},
|
|
15
13
|
middleware: {},
|
|
16
14
|
teleport: { type: [Boolean, String] }
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
}, {
|
|
16
|
+
modelValue: { default: [] },
|
|
17
|
+
modelModifiers: {}
|
|
18
|
+
}),
|
|
19
|
+
emits: ["update:modelValue"],
|
|
20
|
+
setup(u, { expose: b }) {
|
|
21
|
+
const a = $(u, "modelValue"), s = y(null);
|
|
22
|
+
return b({ comboboxPopoverRef: s }), (e, p) => (d(), m(h, {
|
|
22
23
|
ref_key: "comboboxPopoverRef",
|
|
23
24
|
ref: s,
|
|
24
25
|
middleware: e.middleware,
|
|
@@ -28,44 +29,56 @@ const w = /* @__PURE__ */ d({
|
|
|
28
29
|
target: e.target,
|
|
29
30
|
teleport: e.teleport
|
|
30
31
|
}, {
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
default: o(({ open: r }) => [
|
|
33
|
+
l(e.$slots, "default", { open: r })
|
|
34
|
+
]),
|
|
35
|
+
popover: o(({ open: r }) => {
|
|
36
|
+
var n;
|
|
33
37
|
return [
|
|
34
|
-
(
|
|
38
|
+
(n = e.options) != null && n.length ? (d(), m(V, {
|
|
35
39
|
key: 0,
|
|
36
|
-
|
|
37
|
-
modelValue:
|
|
40
|
+
modelValue: a.value,
|
|
41
|
+
"onUpdate:modelValue": p[0] || (p[0] = (t) => a.value = t),
|
|
38
42
|
multiselect: "",
|
|
39
|
-
open:
|
|
43
|
+
open: r,
|
|
40
44
|
options: e.options,
|
|
41
|
-
placeholder: e.placeholder
|
|
42
|
-
|
|
43
|
-
"onUpdate:modelValue": o[1] || (o[1] = (r) => e.$emit("update:modelValue", r))
|
|
44
|
-
}, b({ _: 2 }, [
|
|
45
|
+
placeholder: e.placeholder
|
|
46
|
+
}, c({ _: 2 }, [
|
|
45
47
|
e.$slots.before ? {
|
|
46
48
|
name: "before",
|
|
47
|
-
fn:
|
|
48
|
-
|
|
49
|
+
fn: o(() => [
|
|
50
|
+
l(e.$slots, "before")
|
|
49
51
|
]),
|
|
50
52
|
key: "0"
|
|
51
53
|
} : void 0,
|
|
54
|
+
e.$slots.option ? {
|
|
55
|
+
name: "option",
|
|
56
|
+
fn: o((t) => [
|
|
57
|
+
l(e.$slots, "option", i(f(t)))
|
|
58
|
+
]),
|
|
59
|
+
key: "1"
|
|
60
|
+
} : void 0,
|
|
61
|
+
e.$slots.group ? {
|
|
62
|
+
name: "group",
|
|
63
|
+
fn: o((t) => [
|
|
64
|
+
l(e.$slots, "group", i(f(t)))
|
|
65
|
+
]),
|
|
66
|
+
key: "2"
|
|
67
|
+
} : void 0,
|
|
52
68
|
e.$slots.after ? {
|
|
53
69
|
name: "after",
|
|
54
|
-
fn:
|
|
55
|
-
|
|
70
|
+
fn: o(() => [
|
|
71
|
+
l(e.$slots, "after")
|
|
56
72
|
]),
|
|
57
|
-
key: "
|
|
73
|
+
key: "3"
|
|
58
74
|
} : void 0
|
|
59
|
-
]), 1032, ["
|
|
75
|
+
]), 1032, ["modelValue", "open", "options", "placeholder"])) : k("", !0)
|
|
60
76
|
];
|
|
61
77
|
}),
|
|
62
|
-
default: t(() => [
|
|
63
|
-
a(e.$slots, "default")
|
|
64
|
-
]),
|
|
65
78
|
_: 3
|
|
66
79
|
}, 8, ["middleware", "offset", "placement", "resize", "target", "teleport"]));
|
|
67
80
|
}
|
|
68
81
|
});
|
|
69
82
|
export {
|
|
70
|
-
|
|
83
|
+
B as default
|
|
71
84
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScalarComboboxOption.test.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCombobox/ScalarComboboxOption.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import { type ScalarListboxOptionStyle } from '../ScalarListbox';
|
|
2
1
|
type __VLS_Props = {
|
|
3
2
|
active?: boolean;
|
|
4
3
|
selected?: boolean;
|
|
5
|
-
style?: ScalarListboxOptionStyle;
|
|
6
|
-
isDeletable?: boolean;
|
|
7
4
|
};
|
|
8
5
|
declare function __VLS_template(): {
|
|
9
6
|
attrs: Partial<{}>;
|
|
10
7
|
slots: {
|
|
11
|
-
default?(_: {
|
|
8
|
+
default?(_: {
|
|
9
|
+
active: boolean;
|
|
10
|
+
selected: boolean;
|
|
11
|
+
}): any;
|
|
12
12
|
};
|
|
13
13
|
refs: {};
|
|
14
14
|
rootEl: HTMLLIElement;
|
|
15
15
|
};
|
|
16
16
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
17
|
-
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
18
|
-
delete: () => any;
|
|
19
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
20
|
-
onDelete?: (() => any) | undefined;
|
|
21
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLLIElement>;
|
|
17
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLLIElement>;
|
|
22
18
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
23
19
|
export default _default;
|
|
24
20
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScalarComboboxOption.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCombobox/ScalarComboboxOption.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScalarComboboxOption.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCombobox/ScalarComboboxOption.vue"],"names":[],"mappings":"AA0CA,KAAK,WAAW,GAAG;IACjB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAC;AA0BF,iBAAS,cAAc;WAkCT,OAAO,IAA6B;;;;;YARrB,GAAG;;;;EAa/B;AAYD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,4SAOnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import g from "../ScalarListbox/ScalarListboxCheckbox.vue.js";
|
|
5
|
-
const k = ["aria-selected"], B = { class: "inline-block min-w-0 flex-1 truncate text-c-1" }, w = /* @__PURE__ */ r({
|
|
1
|
+
import { defineComponent as o, createElementBlock as r, openBlock as s, normalizeClass as n, unref as t, renderSlot as c } from "vue";
|
|
2
|
+
import { cva as l, cx as i } from "@scalar/use-hooks/useBindCx";
|
|
3
|
+
const p = ["aria-selected"], b = /* @__PURE__ */ o({
|
|
6
4
|
__name: "ScalarComboboxOption",
|
|
7
5
|
props: {
|
|
8
6
|
active: { type: Boolean },
|
|
9
|
-
selected: { type: Boolean }
|
|
10
|
-
style: {},
|
|
11
|
-
isDeletable: { type: Boolean }
|
|
7
|
+
selected: { type: Boolean }
|
|
12
8
|
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const a = y({
|
|
9
|
+
setup(d) {
|
|
10
|
+
const a = l({
|
|
16
11
|
base: [
|
|
17
12
|
// Group
|
|
18
13
|
"group/item",
|
|
@@ -28,28 +23,19 @@ const k = ["aria-selected"], B = { class: "inline-block min-w-0 flex-1 truncate
|
|
|
28
23
|
active: { true: "bg-b-2" }
|
|
29
24
|
}
|
|
30
25
|
});
|
|
31
|
-
return (e,
|
|
26
|
+
return (e, m) => (s(), r("li", {
|
|
32
27
|
"aria-selected": e.selected,
|
|
33
|
-
class: n(t(
|
|
28
|
+
class: n(t(i)(t(a)({ active: e.active, selected: e.selected }))),
|
|
34
29
|
role: "option",
|
|
35
30
|
tabindex: "-1"
|
|
36
31
|
}, [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
u(e.$slots, "default")
|
|
43
|
-
]),
|
|
44
|
-
e.isDeletable ? (l(), p(t(b), {
|
|
45
|
-
key: 0,
|
|
46
|
-
"aria-label": "Delete",
|
|
47
|
-
class: "text-c-2 opacity-0 group-hover/item:opacity-100 size-4",
|
|
48
|
-
onClick: o[0] || (o[0] = f((x) => e.$emit("delete"), ["stop"]))
|
|
49
|
-
})) : m("", !0)
|
|
50
|
-
], 10, k));
|
|
32
|
+
c(e.$slots, "default", {
|
|
33
|
+
active: e.active,
|
|
34
|
+
selected: e.selected
|
|
35
|
+
})
|
|
36
|
+
], 10, p));
|
|
51
37
|
}
|
|
52
38
|
});
|
|
53
39
|
export {
|
|
54
|
-
|
|
40
|
+
b as default
|
|
55
41
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScalarComboboxOptionGroup.test.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCombobox/ScalarComboboxOptionGroup.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScalarComboboxOptionGroup.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCombobox/ScalarComboboxOptionGroup.vue"],"names":[],"mappings":"AA6BA,KAAK,WAAW,GAAG;IACjB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC;AASF,iBAAS,cAAc;
|
|
1
|
+
{"version":3,"file":"ScalarComboboxOptionGroup.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCombobox/ScalarComboboxOptionGroup.vue"],"names":[],"mappings":"AA6BA,KAAK,WAAW,GAAG;IACjB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC;AASF,iBAAS,cAAc;WA8CT,OAAO,IAA6B;;uBATvB,GAAG;yBACD,GAAG;;;;EAa/B;AAQD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,6SAOnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const n = ["id", "aria-labelledby", "role"], r = ["id"], m = /* @__PURE__ */
|
|
1
|
+
import { defineComponent as a, useId as i, createElementBlock as o, openBlock as d, createCommentVNode as t, renderSlot as l } from "vue";
|
|
2
|
+
const n = ["id", "aria-labelledby", "role"], r = ["id"], m = /* @__PURE__ */ a({
|
|
3
3
|
__name: "ScalarComboboxOptionGroup",
|
|
4
4
|
props: {
|
|
5
|
-
id: { default: () =>
|
|
5
|
+
id: { default: () => i() },
|
|
6
6
|
hidden: { type: Boolean, default: !1 }
|
|
7
7
|
},
|
|
8
8
|
setup(s) {
|
|
@@ -12,10 +12,10 @@ const n = ["id", "aria-labelledby", "role"], r = ["id"], m = /* @__PURE__ */ t({
|
|
|
12
12
|
class: "contents",
|
|
13
13
|
role: e.hidden ? void 0 : "group"
|
|
14
14
|
}, [
|
|
15
|
-
e.hidden ?
|
|
15
|
+
e.hidden ? t("", !0) : (d(), o("div", {
|
|
16
16
|
key: 0,
|
|
17
17
|
id: `${e.id}-label`,
|
|
18
|
-
class: "min-w-0 truncate px-2.5 py-1.5 text-
|
|
18
|
+
class: "min-w-0 truncate px-2.5 py-1.5 text-c-2"
|
|
19
19
|
}, [
|
|
20
20
|
l(e.$slots, "label")
|
|
21
21
|
], 8, r)),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScalarComboboxOptions.test.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCombobox/ScalarComboboxOptions.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,32 +1,25 @@
|
|
|
1
|
-
import { type ComboboxSlots, type Option, type OptionGroup } from './types.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { type ComboboxSlots, type Option, type OptionGroup, type OptionsOrGroups } from './types.js';
|
|
2
|
+
declare const _default: <O extends Option = Option, G extends OptionGroup<O> = OptionGroup<O>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
4
|
+
readonly "onUpdate:modelValue"?: ((value: O[]) => any) | undefined;
|
|
5
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue"> & Partial<{}> & ({
|
|
6
|
+
modelValue?: O[];
|
|
7
|
+
} & {
|
|
8
|
+
options: OptionsOrGroups<O, G>;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
multiselect?: boolean;
|
|
11
|
+
})> & import("vue").PublicProps;
|
|
12
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
13
|
+
attrs: any;
|
|
14
|
+
slots: Readonly<Omit<ComboboxSlots<O, G>, "default">> & Omit<ComboboxSlots<O, G>, "default">;
|
|
15
|
+
emit: (evt: "update:modelValue", value: O[]) => void;
|
|
16
|
+
}>) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}> & {
|
|
19
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
8
20
|
};
|
|
9
|
-
declare function __VLS_template(): {
|
|
10
|
-
attrs: Partial<{}>;
|
|
11
|
-
slots: Readonly<Omit<ComboboxSlots, "default">> & Omit<ComboboxSlots, "default">;
|
|
12
|
-
refs: {
|
|
13
|
-
input: HTMLInputElement;
|
|
14
|
-
};
|
|
15
|
-
rootEl: any;
|
|
16
|
-
};
|
|
17
|
-
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
18
|
-
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
19
|
-
delete: (option: Option) => any;
|
|
20
|
-
"update:modelValue": (v: Option[]) => any;
|
|
21
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
22
|
-
onDelete?: ((option: Option) => any) | undefined;
|
|
23
|
-
"onUpdate:modelValue"?: ((v: Option[]) => any) | undefined;
|
|
24
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
|
-
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
26
21
|
export default _default;
|
|
27
|
-
type
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
};
|
|
22
|
+
type __VLS_PrettifyLocal<T> = {
|
|
23
|
+
[K in keyof T]: T[K];
|
|
24
|
+
} & {};
|
|
32
25
|
//# sourceMappingURL=ScalarComboboxOptions.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScalarComboboxOptions.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCombobox/ScalarComboboxOptions.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScalarComboboxOptions.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCombobox/ScalarComboboxOptions.vue"],"names":[],"mappings":"AAsPA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,eAAe,EAErB,MAAM,SAAS,CAAA;yBAGC,CAAC,SAAS,MAAM,WAAW,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,gCACtD,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WAiXxD,mBAAmB,CAAC;;;qBA9NjB,CAAC,EAAE;;iBA/IL,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;sBAChB,MAAM;sBACN,OAAO;MA2WgG,CAAC,4BAA2B;oBAChI,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;;;;;YAK+B,OAAO,CAAC,OAAO,WAAW,CAAC;;AA3XvE,wBA2X4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./ScalarComboboxOptions.vue2.js";
|
|
2
2
|
import "./ScalarComboboxOptions.vue3.js";
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-fcdffd02"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
r as default
|
|
7
7
|
};
|
|
@@ -1,77 +1,84 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ScalarIconMagnifyingGlass as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { isGroups as
|
|
6
|
-
|
|
1
|
+
import { defineComponent as F, mergeModels as U, useModel as j, useId as H, computed as g, ref as h, onMounted as E, watch as J, createElementBlock as m, openBlock as r, Fragment as f, createElementVNode as y, withDirectives as N, createVNode as T, unref as L, withKeys as x, withModifiers as k, vModelText as P, renderSlot as w, renderList as A, createBlock as D, withCtx as I, createCommentVNode as Q, toDisplayString as G, createTextVNode as R, vShow as W } from "vue";
|
|
2
|
+
import { ScalarIconMagnifyingGlass as X } from "@scalar/icons";
|
|
3
|
+
import Y from "./ScalarComboboxOption.vue.js";
|
|
4
|
+
import Z from "./ScalarComboboxOptionGroup.vue.js";
|
|
5
|
+
import { isGroups as K } from "./types.js";
|
|
6
|
+
import _ from "../ScalarListbox/ScalarListboxCheckbox.vue.js";
|
|
7
|
+
const ee = { class: "relative flex" }, te = ["aria-activedescendant", "placeholder"], le = ["aria-multiselectable"], oe = { class: "inline-block min-w-0 flex-1 truncate text-c-1" }, de = /* @__PURE__ */ F({
|
|
7
8
|
inheritAttrs: !1,
|
|
8
9
|
__name: "ScalarComboboxOptions",
|
|
9
|
-
props: {
|
|
10
|
+
props: /* @__PURE__ */ U({
|
|
10
11
|
options: {},
|
|
11
|
-
modelValue: {},
|
|
12
12
|
placeholder: {},
|
|
13
|
-
multiselect: { type: Boolean }
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
multiselect: { type: Boolean }
|
|
14
|
+
}, {
|
|
15
|
+
modelValue: { default: [] },
|
|
16
|
+
modelModifiers: {}
|
|
17
|
+
}),
|
|
18
|
+
emits: ["update:modelValue"],
|
|
19
|
+
setup(M) {
|
|
20
|
+
var S;
|
|
21
|
+
const u = M, i = j(M, "modelValue"), b = `scalar-combobox-items-${H()}`;
|
|
22
|
+
function $(e) {
|
|
23
|
+
return `${b}-${e.id}`;
|
|
22
24
|
}
|
|
23
|
-
const
|
|
24
|
-
() =>
|
|
25
|
-
), O =
|
|
26
|
-
() =>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
const d = g(
|
|
26
|
+
() => K(u.options) ? u.options.flatMap((e) => e.options) : u.options
|
|
27
|
+
), O = g(
|
|
28
|
+
() => K(u.options) ? u.options : (
|
|
29
|
+
/*
|
|
30
|
+
We know G is an unextended OptionGroup<O> here because of the
|
|
31
|
+
structure of the component props so we can cast it to G
|
|
32
|
+
*/
|
|
33
|
+
[{ label: "", options: u.options }]
|
|
34
|
+
)
|
|
35
|
+
// G is OptionGroup<O>
|
|
36
|
+
), v = h(""), s = h(((S = i.value) == null ? void 0 : S[0]) ?? d.value[0]);
|
|
37
|
+
E(async () => {
|
|
38
|
+
var t;
|
|
39
|
+
v.value = "", s.value = ((t = i.value) == null ? void 0 : t[0]) ?? d.value[0], i.value[0] && setTimeout(() => {
|
|
40
|
+
var a;
|
|
41
|
+
const o = i.value[0];
|
|
42
|
+
o && ((a = document == null ? void 0 : document.getElementById($(o))) == null || a.scrollIntoView({ block: "nearest" }));
|
|
36
43
|
}, 10);
|
|
37
|
-
}),
|
|
38
|
-
() =>
|
|
39
|
-
() =>
|
|
44
|
+
}), J(
|
|
45
|
+
() => v.value,
|
|
46
|
+
() => s.value = p.value[0]
|
|
47
|
+
);
|
|
48
|
+
const p = g(
|
|
49
|
+
() => v.value === "" ? d.value : d.value.filter((e) => e.label.toLowerCase().includes(v.value.toLowerCase()))
|
|
40
50
|
);
|
|
41
|
-
|
|
42
|
-
() =>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
});
|
|
47
|
-
function k(e) {
|
|
48
|
-
a.multiselect ? i.value.some((t) => t.id === e.id) ? i.value = i.value.filter((t) => t.id !== e.id) : i.value = [...i.value, e] : i.value = [e];
|
|
51
|
+
function V(e) {
|
|
52
|
+
e && (u.multiselect ? i.value.some((t) => t.id === e.id) ? i.value = i.value.filter((t) => t.id !== e.id) : i.value = [
|
|
53
|
+
...i.value,
|
|
54
|
+
d.value.find((t) => t.id === e.id)
|
|
55
|
+
] : i.value = [d.value.find((t) => t.id === e.id)]);
|
|
49
56
|
}
|
|
50
|
-
function
|
|
57
|
+
function C(e) {
|
|
51
58
|
var l;
|
|
52
|
-
const t =
|
|
53
|
-
var
|
|
54
|
-
return
|
|
59
|
+
const t = p.value, a = t.findIndex((c) => {
|
|
60
|
+
var n;
|
|
61
|
+
return c.id === ((n = s.value) == null ? void 0 : n.id);
|
|
55
62
|
}) + e;
|
|
56
|
-
|
|
63
|
+
a < 0 || a > t.length - 1 || (s.value = t[a], s.value && ((l = document == null ? void 0 : document.getElementById($(s.value))) == null || l.scrollIntoView({
|
|
57
64
|
behavior: "smooth",
|
|
58
65
|
block: "nearest"
|
|
59
66
|
})));
|
|
60
67
|
}
|
|
61
|
-
const
|
|
62
|
-
return
|
|
68
|
+
const B = h(null);
|
|
69
|
+
return E(() => setTimeout(() => {
|
|
63
70
|
var e;
|
|
64
|
-
return (e =
|
|
65
|
-
}, 0)), (e, t) => (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"onUpdate:modelValue": t[0] || (t[0] = (o) =>
|
|
71
|
+
return (e = B.value) == null ? void 0 : e.focus();
|
|
72
|
+
}, 0)), (e, t) => (r(), m(f, null, [
|
|
73
|
+
y("div", ee, [
|
|
74
|
+
T(L(X), { class: "pointer-events-none absolute left-2.5 search-icon text-c-3 size-4" }),
|
|
75
|
+
N(y("input", {
|
|
76
|
+
"onUpdate:modelValue": t[0] || (t[0] = (o) => v.value = o),
|
|
70
77
|
ref_key: "input",
|
|
71
|
-
ref:
|
|
72
|
-
"aria-activedescendant":
|
|
78
|
+
ref: B,
|
|
79
|
+
"aria-activedescendant": s.value ? $(s.value) : void 0,
|
|
73
80
|
"aria-autocomplete": "list",
|
|
74
|
-
"aria-controls":
|
|
81
|
+
"aria-controls": b,
|
|
75
82
|
class: "min-w-0 flex-1 rounded border-0 py-2.5 pl-8 pr-3 leading-none text-c-1 -outline-offset-1",
|
|
76
83
|
"data-1p-ignore": "",
|
|
77
84
|
placeholder: e.placeholder,
|
|
@@ -79,70 +86,83 @@ const Z = { class: "relative flex" }, _ = ["aria-activedescendant", "placeholder
|
|
|
79
86
|
tabindex: "0",
|
|
80
87
|
type: "text",
|
|
81
88
|
onKeydown: [
|
|
82
|
-
t[1] || (t[1] = x(
|
|
83
|
-
t[2] || (t[2] = x(
|
|
84
|
-
t[3] || (t[3] = x(
|
|
89
|
+
t[1] || (t[1] = x(k((o) => C(1), ["prevent"]), ["down"])),
|
|
90
|
+
t[2] || (t[2] = x(k((o) => s.value && V(s.value), ["prevent"]), ["enter"])),
|
|
91
|
+
t[3] || (t[3] = x(k((o) => C(-1), ["prevent"]), ["up"]))
|
|
85
92
|
]
|
|
86
|
-
}, null, 40,
|
|
87
|
-
[
|
|
93
|
+
}, null, 40, te), [
|
|
94
|
+
[P, v.value]
|
|
88
95
|
])
|
|
89
96
|
]),
|
|
90
|
-
|
|
91
|
-
id:
|
|
97
|
+
N(y("ul", {
|
|
98
|
+
id: b,
|
|
92
99
|
"aria-multiselectable": e.multiselect,
|
|
93
100
|
class: "border-t p-0.75 custom-scroll overscroll-contain flex-1 min-h-0",
|
|
94
101
|
role: "listbox",
|
|
95
102
|
tabindex: "-1"
|
|
96
103
|
}, [
|
|
97
|
-
|
|
98
|
-
(
|
|
99
|
-
id: `${
|
|
100
|
-
key:
|
|
104
|
+
w(e.$slots, "before", {}, void 0, !0),
|
|
105
|
+
(r(!0), m(f, null, A(O.value, (o, a) => (r(), D(Z, {
|
|
106
|
+
id: `${b}-group-${a}`,
|
|
107
|
+
key: a,
|
|
101
108
|
hidden: (
|
|
102
109
|
// Only show the group label if there are some results
|
|
103
|
-
!o.options.some((l) =>
|
|
110
|
+
!o.options.some((l) => p.value.some((c) => c.id === l.id)) || // And it has a label
|
|
104
111
|
!o.label
|
|
105
112
|
)
|
|
106
113
|
}, {
|
|
107
|
-
label:
|
|
108
|
-
|
|
114
|
+
label: I(() => [
|
|
115
|
+
e.$slots.group ? w(e.$slots, "group", {
|
|
116
|
+
key: 0,
|
|
117
|
+
group: o
|
|
118
|
+
}, void 0, !0) : (r(), m(f, { key: 1 }, [
|
|
119
|
+
R(G(o.label), 1)
|
|
120
|
+
], 64))
|
|
109
121
|
]),
|
|
110
|
-
default:
|
|
111
|
-
(
|
|
112
|
-
var
|
|
113
|
-
return
|
|
122
|
+
default: I(() => [
|
|
123
|
+
(r(!0), m(f, null, A(p.value, (l) => {
|
|
124
|
+
var c;
|
|
125
|
+
return r(), m(f, {
|
|
114
126
|
key: l.id
|
|
115
127
|
}, [
|
|
116
|
-
o.options.some((
|
|
128
|
+
o.options.some((n) => n.id === l.id) ? (r(), D(Y, {
|
|
117
129
|
key: 0,
|
|
118
|
-
id:
|
|
119
|
-
active: ((
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
onClick: (s) => k(l),
|
|
124
|
-
onDelete: (s) => e.$emit("delete", l),
|
|
125
|
-
onMousedown: t[4] || (t[4] = h(() => {
|
|
130
|
+
id: $(l),
|
|
131
|
+
active: ((c = s.value) == null ? void 0 : c.id) === l.id,
|
|
132
|
+
selected: i.value.some((n) => n.id === l.id),
|
|
133
|
+
onClick: (n) => V(l),
|
|
134
|
+
onMousedown: t[4] || (t[4] = k(() => {
|
|
126
135
|
}, ["prevent"])),
|
|
127
|
-
onMouseenter: (
|
|
136
|
+
onMouseenter: (n) => s.value = l
|
|
128
137
|
}, {
|
|
129
|
-
default:
|
|
130
|
-
|
|
138
|
+
default: I(({ active: n, selected: q }) => [
|
|
139
|
+
e.$slots.option ? w(e.$slots, "option", {
|
|
140
|
+
key: 0,
|
|
141
|
+
option: l,
|
|
142
|
+
active: n,
|
|
143
|
+
selected: q
|
|
144
|
+
}, void 0, !0) : (r(), m(f, { key: 1 }, [
|
|
145
|
+
T(L(_), {
|
|
146
|
+
selected: i.value.some((z) => z.id === l.id),
|
|
147
|
+
multiselect: e.multiselect
|
|
148
|
+
}, null, 8, ["selected", "multiselect"]),
|
|
149
|
+
y("span", oe, G(l.label), 1)
|
|
150
|
+
], 64))
|
|
131
151
|
]),
|
|
132
152
|
_: 2
|
|
133
|
-
}, 1032, ["id", "active", "
|
|
153
|
+
}, 1032, ["id", "active", "selected", "onClick", "onMouseenter"])) : Q("", !0)
|
|
134
154
|
], 64);
|
|
135
155
|
}), 128))
|
|
136
156
|
]),
|
|
137
157
|
_: 2
|
|
138
158
|
}, 1032, ["id", "hidden"]))), 128)),
|
|
139
|
-
|
|
140
|
-
], 8,
|
|
141
|
-
[
|
|
159
|
+
w(e.$slots, "after", {}, void 0, !0)
|
|
160
|
+
], 8, le), [
|
|
161
|
+
[W, p.value.length || e.$slots.before || e.$slots.after]
|
|
142
162
|
])
|
|
143
163
|
], 64));
|
|
144
164
|
}
|
|
145
165
|
});
|
|
146
166
|
export {
|
|
147
|
-
|
|
167
|
+
de as default
|
|
148
168
|
};
|