@enos5/enos-vue-default 1.5.9 → 1.6.1
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/CustomSelect.vue.d.ts +12 -3
- package/dist/components/InputGroup.vue.d.ts +9 -0
- package/dist/components/SelectInput.vue.d.ts +12 -3
- package/dist/index.js +1 -1
- package/dist/index.node.js +1 -1
- package/dist/{plugin-sa3VYroS.js → plugin-D5KJd0xy.js} +173 -66
- package/dist/plugin-D5KJd0xy.js.map +1 -0
- package/dist/styles.css +8 -0
- package/package.json +36 -36
- package/dist/plugin-sa3VYroS.js.map +0 -1
|
@@ -2,7 +2,7 @@ declare const _default: typeof __VLS_export;
|
|
|
2
2
|
export default _default;
|
|
3
3
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
4
|
modelValue: {
|
|
5
|
-
type: (StringConstructor | BooleanConstructor | NumberConstructor | null)[];
|
|
5
|
+
type: (ArrayConstructor | StringConstructor | BooleanConstructor | NumberConstructor | null)[];
|
|
6
6
|
default: string;
|
|
7
7
|
};
|
|
8
8
|
modelModifiers: {
|
|
@@ -21,6 +21,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
21
21
|
type: BooleanConstructor;
|
|
22
22
|
default: boolean;
|
|
23
23
|
};
|
|
24
|
+
multiple: {
|
|
25
|
+
type: BooleanConstructor;
|
|
26
|
+
default: boolean;
|
|
27
|
+
};
|
|
24
28
|
disabled: {
|
|
25
29
|
type: BooleanConstructor;
|
|
26
30
|
default: boolean;
|
|
@@ -85,7 +89,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
85
89
|
"update:modelValue": (...args: any[]) => void;
|
|
86
90
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
87
91
|
modelValue: {
|
|
88
|
-
type: (StringConstructor | BooleanConstructor | NumberConstructor | null)[];
|
|
92
|
+
type: (ArrayConstructor | StringConstructor | BooleanConstructor | NumberConstructor | null)[];
|
|
89
93
|
default: string;
|
|
90
94
|
};
|
|
91
95
|
modelModifiers: {
|
|
@@ -104,6 +108,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
104
108
|
type: BooleanConstructor;
|
|
105
109
|
default: boolean;
|
|
106
110
|
};
|
|
111
|
+
multiple: {
|
|
112
|
+
type: BooleanConstructor;
|
|
113
|
+
default: boolean;
|
|
114
|
+
};
|
|
107
115
|
disabled: {
|
|
108
116
|
type: BooleanConstructor;
|
|
109
117
|
default: boolean;
|
|
@@ -168,11 +176,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
168
176
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
169
177
|
}>, {
|
|
170
178
|
disabled: boolean;
|
|
171
|
-
modelValue: string | number | boolean | null;
|
|
179
|
+
modelValue: string | number | boolean | unknown[] | null;
|
|
172
180
|
modelModifiers: Record<string, any>;
|
|
173
181
|
options: unknown[];
|
|
174
182
|
placeholder: string;
|
|
175
183
|
placeholderDisabled: boolean;
|
|
184
|
+
multiple: boolean;
|
|
176
185
|
softDeleteAware: boolean;
|
|
177
186
|
labelKey: string;
|
|
178
187
|
valueKey: string;
|
|
@@ -57,6 +57,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
57
57
|
type: BooleanConstructor;
|
|
58
58
|
default: boolean;
|
|
59
59
|
};
|
|
60
|
+
multiple: {
|
|
61
|
+
type: BooleanConstructor;
|
|
62
|
+
default: boolean;
|
|
63
|
+
};
|
|
60
64
|
softDeleteAware: {
|
|
61
65
|
type: BooleanConstructor;
|
|
62
66
|
default: boolean;
|
|
@@ -201,6 +205,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
201
205
|
type: BooleanConstructor;
|
|
202
206
|
default: boolean;
|
|
203
207
|
};
|
|
208
|
+
multiple: {
|
|
209
|
+
type: BooleanConstructor;
|
|
210
|
+
default: boolean;
|
|
211
|
+
};
|
|
204
212
|
softDeleteAware: {
|
|
205
213
|
type: BooleanConstructor;
|
|
206
214
|
default: boolean;
|
|
@@ -302,6 +310,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
302
310
|
options: unknown[];
|
|
303
311
|
placeholder: string;
|
|
304
312
|
placeholderDisabled: boolean;
|
|
313
|
+
multiple: boolean;
|
|
305
314
|
softDeleteAware: boolean;
|
|
306
315
|
labelKey: string;
|
|
307
316
|
valueKey: string;
|
|
@@ -2,7 +2,7 @@ declare const _default: typeof __VLS_export;
|
|
|
2
2
|
export default _default;
|
|
3
3
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
4
|
modelValue: {
|
|
5
|
-
type: (StringConstructor | BooleanConstructor | NumberConstructor | null)[];
|
|
5
|
+
type: (ArrayConstructor | StringConstructor | BooleanConstructor | NumberConstructor | null)[];
|
|
6
6
|
default: string;
|
|
7
7
|
};
|
|
8
8
|
modelModifiers: {
|
|
@@ -21,6 +21,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
21
21
|
type: BooleanConstructor;
|
|
22
22
|
default: boolean;
|
|
23
23
|
};
|
|
24
|
+
multiple: {
|
|
25
|
+
type: BooleanConstructor;
|
|
26
|
+
default: boolean;
|
|
27
|
+
};
|
|
24
28
|
disabled: {
|
|
25
29
|
type: BooleanConstructor;
|
|
26
30
|
default: boolean;
|
|
@@ -85,7 +89,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
85
89
|
"update:modelValue": (...args: any[]) => void;
|
|
86
90
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
87
91
|
modelValue: {
|
|
88
|
-
type: (StringConstructor | BooleanConstructor | NumberConstructor | null)[];
|
|
92
|
+
type: (ArrayConstructor | StringConstructor | BooleanConstructor | NumberConstructor | null)[];
|
|
89
93
|
default: string;
|
|
90
94
|
};
|
|
91
95
|
modelModifiers: {
|
|
@@ -104,6 +108,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
104
108
|
type: BooleanConstructor;
|
|
105
109
|
default: boolean;
|
|
106
110
|
};
|
|
111
|
+
multiple: {
|
|
112
|
+
type: BooleanConstructor;
|
|
113
|
+
default: boolean;
|
|
114
|
+
};
|
|
107
115
|
disabled: {
|
|
108
116
|
type: BooleanConstructor;
|
|
109
117
|
default: boolean;
|
|
@@ -168,11 +176,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
168
176
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
169
177
|
}>, {
|
|
170
178
|
disabled: boolean;
|
|
171
|
-
modelValue: string | number | boolean | null;
|
|
179
|
+
modelValue: string | number | boolean | unknown[] | null;
|
|
172
180
|
modelModifiers: Record<string, any>;
|
|
173
181
|
options: unknown[];
|
|
174
182
|
placeholder: string;
|
|
175
183
|
placeholderDisabled: boolean;
|
|
184
|
+
multiple: boolean;
|
|
176
185
|
softDeleteAware: boolean;
|
|
177
186
|
labelKey: string;
|
|
178
187
|
valueKey: string;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './styles.css';
|
|
2
|
-
import { _, a, b, c, d, e, f, g, h, i, j, k, D, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, S, B, C, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W, X, Y, Z, $, a0, a1 } from "./plugin-
|
|
2
|
+
import { _, a, b, c, d, e, f, g, h, i, j, k, D, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, S, B, C, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W, X, Y, Z, $, a0, a1 } from "./plugin-D5KJd0xy.js";
|
|
3
3
|
export {
|
|
4
4
|
_ as ActionCard,
|
|
5
5
|
a as ActionMessage,
|
package/dist/index.node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _, a, b, c, d, e, f, g, h, i, j, k, D, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, S, B, C, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W, X, Y, Z, $, a0, a1 } from "./plugin-
|
|
1
|
+
import { _, a, b, c, d, e, f, g, h, i, j, k, D, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, S, B, C, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W, X, Y, Z, $, a0, a1 } from "./plugin-D5KJd0xy.js";
|
|
2
2
|
export {
|
|
3
3
|
_ as ActionCard,
|
|
4
4
|
a as ActionMessage,
|
|
@@ -3,11 +3,11 @@ import { LockClosedIcon, ChevronDownIcon, PhotoIcon, ExclamationCircleIcon, Excl
|
|
|
3
3
|
import Editor from "@tinymce/tinymce-vue";
|
|
4
4
|
import { Link } from "@inertiajs/vue3";
|
|
5
5
|
const _hoisted_1$C = { class: "border-b border-neutral-200 bg-neutral-50/80 p-2 dark:border-neutral-800 dark:bg-neutral-900/80" };
|
|
6
|
-
const _hoisted_2$
|
|
6
|
+
const _hoisted_2$m = {
|
|
7
7
|
role: "tablist",
|
|
8
8
|
class: "flex overflow-hidden rounded-lg bg-white shadow-sm ring-1 ring-neutral-200 dark:bg-neutral-950 dark:ring-neutral-800"
|
|
9
9
|
};
|
|
10
|
-
const _hoisted_3$
|
|
10
|
+
const _hoisted_3$f = ["aria-selected", "tabindex", "onClick", "onKeydown"];
|
|
11
11
|
const _sfc_main$R = {
|
|
12
12
|
__name: "CardTabs",
|
|
13
13
|
props: {
|
|
@@ -78,7 +78,7 @@ const _sfc_main$R = {
|
|
|
78
78
|
};
|
|
79
79
|
return (_ctx, _cache) => {
|
|
80
80
|
return openBlock(), createElementBlock("div", _hoisted_1$C, [
|
|
81
|
-
createElementVNode("div", _hoisted_2$
|
|
81
|
+
createElementVNode("div", _hoisted_2$m, [
|
|
82
82
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.tabs, (tab, index) => {
|
|
83
83
|
return openBlock(), createElementBlock("button", {
|
|
84
84
|
key: tab.value,
|
|
@@ -98,7 +98,7 @@ const _sfc_main$R = {
|
|
|
98
98
|
]),
|
|
99
99
|
onClick: ($event) => activateTab(tab.value),
|
|
100
100
|
onKeydown: ($event) => onTabKeydown($event, index)
|
|
101
|
-
}, toDisplayString(tab.label), 47, _hoisted_3$
|
|
101
|
+
}, toDisplayString(tab.label), 47, _hoisted_3$f);
|
|
102
102
|
}), 128))
|
|
103
103
|
])
|
|
104
104
|
]);
|
|
@@ -109,7 +109,7 @@ const _hoisted_1$B = {
|
|
|
109
109
|
key: 0,
|
|
110
110
|
class: "mb-4"
|
|
111
111
|
};
|
|
112
|
-
const _hoisted_2$
|
|
112
|
+
const _hoisted_2$l = {
|
|
113
113
|
key: 1,
|
|
114
114
|
class: "mb-4 text-xl font-semibold tracking-tight text-neutral-950 dark:text-neutral-50"
|
|
115
115
|
};
|
|
@@ -186,7 +186,7 @@ const _sfc_main$Q = {
|
|
|
186
186
|
}, [
|
|
187
187
|
_ctx.$slots.customTitle ? (openBlock(), createElementBlock("div", _hoisted_1$B, [
|
|
188
188
|
renderSlot(_ctx.$slots, "customTitle")
|
|
189
|
-
])) : __props.title ? (openBlock(), createElementBlock("h3", _hoisted_2$
|
|
189
|
+
])) : __props.title ? (openBlock(), createElementBlock("h3", _hoisted_2$l, toDisplayString(__props.title), 1)) : createCommentVNode("", true),
|
|
190
190
|
createElementVNode("div", {
|
|
191
191
|
class: normalizeClass(["relative", __props.tabs.length > 0 ? "overflow-hidden" : "overflow-visible"])
|
|
192
192
|
}, [
|
|
@@ -303,14 +303,14 @@ const _export_sfc = (sfc, props) => {
|
|
|
303
303
|
};
|
|
304
304
|
const _sfc_main$M = {};
|
|
305
305
|
const _hoisted_1$z = { class: "md:col-span-1 flex justify-between" };
|
|
306
|
-
const _hoisted_2$
|
|
307
|
-
const _hoisted_3$
|
|
306
|
+
const _hoisted_2$k = { class: "px-4 sm:px-0" };
|
|
307
|
+
const _hoisted_3$e = { class: "text-xl font-semibold tracking-tight text-neutral-950 dark:text-neutral-50" };
|
|
308
308
|
const _hoisted_4$9 = { class: "mt-1 max-w-2xl text-sm text-neutral-600 dark:text-neutral-200" };
|
|
309
309
|
const _hoisted_5$7 = { class: "px-4 sm:px-0" };
|
|
310
310
|
function _sfc_render(_ctx, _cache) {
|
|
311
311
|
return openBlock(), createElementBlock("div", _hoisted_1$z, [
|
|
312
|
-
createElementVNode("div", _hoisted_2$
|
|
313
|
-
createElementVNode("h3", _hoisted_3$
|
|
312
|
+
createElementVNode("div", _hoisted_2$k, [
|
|
313
|
+
createElementVNode("h3", _hoisted_3$e, [
|
|
314
314
|
renderSlot(_ctx.$slots, "title")
|
|
315
315
|
]),
|
|
316
316
|
createElementVNode("p", _hoisted_4$9, [
|
|
@@ -324,8 +324,8 @@ function _sfc_render(_ctx, _cache) {
|
|
|
324
324
|
}
|
|
325
325
|
const SectionTitle = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["render", _sfc_render]]);
|
|
326
326
|
const _hoisted_1$y = { class: "md:grid md:grid-cols-3 md:gap-6" };
|
|
327
|
-
const _hoisted_2$
|
|
328
|
-
const _hoisted_3$
|
|
327
|
+
const _hoisted_2$j = { class: "mt-5 md:mt-0 md:col-span-2" };
|
|
328
|
+
const _hoisted_3$d = { class: "rounded-lg border border-neutral-200 bg-white px-4 py-5 shadow-sm dark:border-neutral-800 dark:bg-neutral-950 sm:p-6" };
|
|
329
329
|
const _sfc_main$L = {
|
|
330
330
|
__name: "ActionSection",
|
|
331
331
|
setup(__props) {
|
|
@@ -340,8 +340,8 @@ const _sfc_main$L = {
|
|
|
340
340
|
]),
|
|
341
341
|
_: 3
|
|
342
342
|
}),
|
|
343
|
-
createElementVNode("div", _hoisted_2$
|
|
344
|
-
createElementVNode("div", _hoisted_3$
|
|
343
|
+
createElementVNode("div", _hoisted_2$j, [
|
|
344
|
+
createElementVNode("div", _hoisted_3$d, [
|
|
345
345
|
renderSlot(_ctx.$slots, "content")
|
|
346
346
|
])
|
|
347
347
|
])
|
|
@@ -615,11 +615,11 @@ const _sfc_main$H = {
|
|
|
615
615
|
}
|
|
616
616
|
};
|
|
617
617
|
const _hoisted_1$t = { class: "relative flex items-center" };
|
|
618
|
-
const _hoisted_2$
|
|
618
|
+
const _hoisted_2$i = {
|
|
619
619
|
key: 0,
|
|
620
620
|
class: "absolute inset-y-0 left-0 flex items-center pointer-events-none pl-3"
|
|
621
621
|
};
|
|
622
|
-
const _hoisted_3$
|
|
622
|
+
const _hoisted_3$c = ["type", "value", "disabled"];
|
|
623
623
|
const _hoisted_4$8 = ["aria-label"];
|
|
624
624
|
const _hoisted_5$6 = {
|
|
625
625
|
key: 0,
|
|
@@ -696,7 +696,7 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
696
696
|
__expose({ focus: () => input.value?.focus() });
|
|
697
697
|
return (_ctx, _cache) => {
|
|
698
698
|
return openBlock(), createElementBlock("div", _hoisted_1$t, [
|
|
699
|
-
isPasswordField.value ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
699
|
+
isPasswordField.value ? (openBlock(), createElementBlock("div", _hoisted_2$i, [
|
|
700
700
|
createVNode(unref(LockClosedIcon), { class: "h-5 w-5 text-neutral-400 dark:text-neutral-200" })
|
|
701
701
|
])) : createCommentVNode("", true),
|
|
702
702
|
createElementVNode("input", mergeProps({
|
|
@@ -710,7 +710,7 @@ const _sfc_main$G = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
710
710
|
onInput: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event.target.value)),
|
|
711
711
|
onBlur: _cache[1] || (_cache[1] = ($event) => emit("blur", $event)),
|
|
712
712
|
onWheel: handleWheel
|
|
713
|
-
}), null, 16, _hoisted_3$
|
|
713
|
+
}), null, 16, _hoisted_3$c),
|
|
714
714
|
isPasswordField.value ? (openBlock(), createElementBlock("button", {
|
|
715
715
|
key: 1,
|
|
716
716
|
type: "button",
|
|
@@ -822,11 +822,16 @@ const _sfc_main$F = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
822
822
|
}
|
|
823
823
|
});
|
|
824
824
|
const _hoisted_1$r = ["onClick"];
|
|
825
|
+
const _hoisted_2$h = {
|
|
826
|
+
key: 0,
|
|
827
|
+
class: "flex items-center gap-3"
|
|
828
|
+
};
|
|
829
|
+
const _hoisted_3$b = ["checked", "disabled", "onChange"];
|
|
825
830
|
const _sfc_main$E = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
826
831
|
__name: "CustomSelect",
|
|
827
832
|
props: {
|
|
828
833
|
modelValue: {
|
|
829
|
-
type: [String, Number, Boolean, null],
|
|
834
|
+
type: [String, Number, Boolean, Array, null],
|
|
830
835
|
default: ""
|
|
831
836
|
},
|
|
832
837
|
modelModifiers: {
|
|
@@ -845,6 +850,10 @@ const _sfc_main$E = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
845
850
|
type: Boolean,
|
|
846
851
|
default: false
|
|
847
852
|
},
|
|
853
|
+
multiple: {
|
|
854
|
+
type: Boolean,
|
|
855
|
+
default: false
|
|
856
|
+
},
|
|
848
857
|
disabled: {
|
|
849
858
|
type: Boolean,
|
|
850
859
|
default: false
|
|
@@ -916,6 +925,7 @@ const _sfc_main$E = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
916
925
|
const triggerRef = ref(null);
|
|
917
926
|
const dropdownMenuRef = ref(null);
|
|
918
927
|
const dropdownStyle = ref({});
|
|
928
|
+
const isDarkMode = ref(false);
|
|
919
929
|
const isObjectOption = (option) => typeof option === "object" && option !== null;
|
|
920
930
|
const optionValue = (option) => {
|
|
921
931
|
if (isObjectOption(option)) {
|
|
@@ -938,9 +948,11 @@ const _sfc_main$E = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
938
948
|
}
|
|
939
949
|
return Boolean(option[props.deletedKey]);
|
|
940
950
|
};
|
|
951
|
+
const modelValueArray = computed(() => Array.isArray(props.modelValue) ? props.modelValue : []);
|
|
941
952
|
const modelValueAsString = computed(() => String(props.modelValue ?? ""));
|
|
953
|
+
const modelValueSet = computed(() => new Set(modelValueArray.value.map((value) => String(value))));
|
|
942
954
|
const selectedDeletedOption = computed(() => {
|
|
943
|
-
if (!props.softDeleteAware || modelValueAsString.value === "") {
|
|
955
|
+
if (props.multiple || !props.softDeleteAware || modelValueAsString.value === "") {
|
|
944
956
|
return null;
|
|
945
957
|
}
|
|
946
958
|
return props.options.find((option) => optionDeleted(option) && String(optionValue(option) ?? "") === modelValueAsString.value) ?? null;
|
|
@@ -951,7 +963,39 @@ const _sfc_main$E = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
951
963
|
}
|
|
952
964
|
return props.options.filter((option) => !optionDeleted(option));
|
|
953
965
|
});
|
|
966
|
+
const selectedDeletedOptions = computed(() => {
|
|
967
|
+
if (!props.softDeleteAware || !props.multiple || modelValueSet.value.size === 0) {
|
|
968
|
+
return [];
|
|
969
|
+
}
|
|
970
|
+
return props.options.filter((option) => optionDeleted(option) && modelValueSet.value.has(String(optionValue(option) ?? "")));
|
|
971
|
+
});
|
|
972
|
+
const multipleOptions = computed(() => {
|
|
973
|
+
if (!props.multiple) {
|
|
974
|
+
return availableOptions.value;
|
|
975
|
+
}
|
|
976
|
+
const seen = /* @__PURE__ */ new Set();
|
|
977
|
+
return [...selectedDeletedOptions.value, ...availableOptions.value].filter((option) => {
|
|
978
|
+
const key = String(optionValue(option) ?? "");
|
|
979
|
+
if (seen.has(key)) {
|
|
980
|
+
return false;
|
|
981
|
+
}
|
|
982
|
+
seen.add(key);
|
|
983
|
+
return true;
|
|
984
|
+
});
|
|
985
|
+
});
|
|
986
|
+
const selectedMultipleOptions = computed(() => {
|
|
987
|
+
if (!props.multiple || modelValueSet.value.size === 0) {
|
|
988
|
+
return [];
|
|
989
|
+
}
|
|
990
|
+
return multipleOptions.value.filter((option) => modelValueSet.value.has(String(optionValue(option) ?? "")));
|
|
991
|
+
});
|
|
954
992
|
const displayText = computed(() => {
|
|
993
|
+
if (props.multiple) {
|
|
994
|
+
if (selectedMultipleOptions.value.length === 0) {
|
|
995
|
+
return props.placeholder;
|
|
996
|
+
}
|
|
997
|
+
return selectedMultipleOptions.value.map((option) => optionText(option)).join(", ");
|
|
998
|
+
}
|
|
955
999
|
if (props.modelValue === null || props.modelValue === void 0 || props.modelValue === "" && !props.options.some((option) => optionValue(option) === "")) {
|
|
956
1000
|
return props.placeholder;
|
|
957
1001
|
}
|
|
@@ -970,6 +1014,8 @@ const _sfc_main$E = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
970
1014
|
}
|
|
971
1015
|
return value;
|
|
972
1016
|
};
|
|
1017
|
+
const normalizeEmittedValues = (values) => values.map((value) => normalizeEmittedValue(value));
|
|
1018
|
+
const optionIsSelected = (option) => modelValueSet.value.has(String(optionValue(option) ?? ""));
|
|
973
1019
|
const toggleDropdown = () => {
|
|
974
1020
|
if (!props.disabled) {
|
|
975
1021
|
isOpen.value = !isOpen.value;
|
|
@@ -982,10 +1028,21 @@ const _sfc_main$E = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
982
1028
|
};
|
|
983
1029
|
const selectPlaceholder = () => {
|
|
984
1030
|
if (!props.placeholderDisabled) {
|
|
985
|
-
emit("update:modelValue", normalizeEmittedValue(""));
|
|
1031
|
+
emit("update:modelValue", props.multiple ? [] : normalizeEmittedValue(""));
|
|
986
1032
|
isOpen.value = false;
|
|
987
1033
|
}
|
|
988
1034
|
};
|
|
1035
|
+
const toggleMultipleOption = (option) => {
|
|
1036
|
+
const normalizedValue = normalizeEmittedValue(optionValue(option));
|
|
1037
|
+
const currentValues = [...modelValueArray.value];
|
|
1038
|
+
const selectedIndex = currentValues.findIndex((value) => String(value) === String(normalizedValue));
|
|
1039
|
+
if (selectedIndex >= 0) {
|
|
1040
|
+
currentValues.splice(selectedIndex, 1);
|
|
1041
|
+
} else {
|
|
1042
|
+
currentValues.push(normalizedValue);
|
|
1043
|
+
}
|
|
1044
|
+
emit("update:modelValue", normalizeEmittedValues(currentValues));
|
|
1045
|
+
};
|
|
989
1046
|
const updateDropdownPosition = () => {
|
|
990
1047
|
if (!triggerRef.value) {
|
|
991
1048
|
return;
|
|
@@ -1014,7 +1071,16 @@ const _sfc_main$E = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
1014
1071
|
isOpen.value = false;
|
|
1015
1072
|
}
|
|
1016
1073
|
};
|
|
1074
|
+
const syncDarkMode = () => {
|
|
1075
|
+
if (rootRef.value?.closest(".dark")) {
|
|
1076
|
+
isDarkMode.value = true;
|
|
1077
|
+
return;
|
|
1078
|
+
}
|
|
1079
|
+
isDarkMode.value = document.documentElement.classList.contains("dark") || document.body.classList.contains("dark");
|
|
1080
|
+
};
|
|
1081
|
+
const darkTextStyle = computed(() => isDarkMode.value ? { color: "#ffffff" } : null);
|
|
1017
1082
|
onMounted(() => {
|
|
1083
|
+
syncDarkMode();
|
|
1018
1084
|
document.addEventListener("click", closeDropdown);
|
|
1019
1085
|
window.addEventListener("resize", updateDropdownPosition);
|
|
1020
1086
|
window.addEventListener("scroll", updateDropdownPosition, true);
|
|
@@ -1028,6 +1094,7 @@ const _sfc_main$E = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
1028
1094
|
if (!open) {
|
|
1029
1095
|
return;
|
|
1030
1096
|
}
|
|
1097
|
+
syncDarkMode();
|
|
1031
1098
|
await nextTick();
|
|
1032
1099
|
updateDropdownPosition();
|
|
1033
1100
|
});
|
|
@@ -1043,14 +1110,16 @@ const _sfc_main$E = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
1043
1110
|
ref: triggerRef,
|
|
1044
1111
|
class: [
|
|
1045
1112
|
__props.baseClass,
|
|
1046
|
-
selectedDeletedOption.value ? __props.deletedSelectedClass : __props.normalTextClass,
|
|
1113
|
+
selectedDeletedOption.value || __props.multiple && selectedMultipleOptions.value.some(optionDeleted) ? __props.deletedSelectedClass : __props.normalTextClass,
|
|
1114
|
+
{ "text-neutral-50": isDarkMode.value && !(selectedDeletedOption.value || __props.multiple && selectedMultipleOptions.value.some(optionDeleted)) },
|
|
1047
1115
|
"flex items-center justify-between cursor-pointer",
|
|
1048
1116
|
unref(attrs).class
|
|
1049
1117
|
]
|
|
1050
1118
|
}, unref(attrs), { tabindex: "0" }), [
|
|
1051
1119
|
createElementVNode("span", {
|
|
1052
|
-
class: normalizeClass(!__props.modelValue && __props.placeholder ? __props.placeholderClass : null)
|
|
1053
|
-
|
|
1120
|
+
class: normalizeClass((__props.multiple && selectedMultipleOptions.value.length === 0 || !__props.multiple && !__props.modelValue) && __props.placeholder ? __props.placeholderClass : null),
|
|
1121
|
+
style: normalizeStyle(darkTextStyle.value)
|
|
1122
|
+
}, toDisplayString(displayText.value), 7),
|
|
1054
1123
|
createVNode(unref(ChevronDownIcon), {
|
|
1055
1124
|
class: normalizeClass(["size-5 text-neutral-400 transition-transform dark:text-neutral-200", { "rotate-180": isOpen.value }])
|
|
1056
1125
|
}, null, 8, ["class"])
|
|
@@ -1069,41 +1138,69 @@ const _sfc_main$E = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
1069
1138
|
key: 0,
|
|
1070
1139
|
ref_key: "dropdownMenuRef",
|
|
1071
1140
|
ref: dropdownMenuRef,
|
|
1072
|
-
class: normalizeClass(
|
|
1141
|
+
class: normalizeClass({ dark: isDarkMode.value }),
|
|
1073
1142
|
style: normalizeStyle(dropdownStyle.value)
|
|
1074
1143
|
}, [
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
{ "text-gray-400": !__props.modelValue }
|
|
1081
|
-
]),
|
|
1082
|
-
onClick: withModifiers(selectPlaceholder, ["stop"])
|
|
1083
|
-
}, toDisplayString(__props.placeholder), 3)) : createCommentVNode("", true),
|
|
1084
|
-
selectedDeletedOption.value ? (openBlock(), createElementBlock("div", {
|
|
1085
|
-
key: 1,
|
|
1086
|
-
class: normalizeClass([
|
|
1087
|
-
__props.dropdownOptionClass,
|
|
1088
|
-
__props.deletedOptionClass,
|
|
1089
|
-
__props.dropdownSelectedClass
|
|
1090
|
-
])
|
|
1091
|
-
}, toDisplayString(optionText(selectedDeletedOption.value)), 3)) : createCommentVNode("", true),
|
|
1092
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(availableOptions.value, (option) => {
|
|
1093
|
-
return openBlock(), createElementBlock("div", {
|
|
1094
|
-
key: String(optionValue(option)),
|
|
1144
|
+
createElementVNode("div", {
|
|
1145
|
+
class: normalizeClass([__props.dropdownClass, { "bg-neutral-950 border-neutral-800": isDarkMode.value }])
|
|
1146
|
+
}, [
|
|
1147
|
+
__props.placeholder && !__props.multiple ? (openBlock(), createElementBlock("div", {
|
|
1148
|
+
key: 0,
|
|
1095
1149
|
class: normalizeClass([
|
|
1096
1150
|
__props.dropdownOptionClass,
|
|
1097
|
-
__props.
|
|
1098
|
-
{
|
|
1099
|
-
[__props.dropdownSelectedClass]: optionValue(option) === __props.modelValue || String(optionValue(option)) === String(__props.modelValue),
|
|
1100
|
-
"rounded-b-lg": option === availableOptions.value[availableOptions.value.length - 1] && !__props.placeholder,
|
|
1101
|
-
"rounded-lg": !__props.placeholder && availableOptions.value.length === 1
|
|
1102
|
-
}
|
|
1151
|
+
__props.placeholderClass,
|
|
1152
|
+
{ "text-gray-400": !__props.modelValue }
|
|
1103
1153
|
]),
|
|
1104
|
-
onClick: withModifiers(
|
|
1105
|
-
},
|
|
1106
|
-
|
|
1154
|
+
onClick: withModifiers(selectPlaceholder, ["stop"])
|
|
1155
|
+
}, [
|
|
1156
|
+
createElementVNode("span", {
|
|
1157
|
+
style: normalizeStyle(darkTextStyle.value)
|
|
1158
|
+
}, toDisplayString(__props.placeholder), 5)
|
|
1159
|
+
], 2)) : createCommentVNode("", true),
|
|
1160
|
+
selectedDeletedOption.value ? (openBlock(), createElementBlock("div", {
|
|
1161
|
+
key: 1,
|
|
1162
|
+
class: normalizeClass([
|
|
1163
|
+
__props.dropdownOptionClass,
|
|
1164
|
+
__props.deletedOptionClass,
|
|
1165
|
+
__props.dropdownSelectedClass
|
|
1166
|
+
])
|
|
1167
|
+
}, toDisplayString(optionText(selectedDeletedOption.value)), 3)) : createCommentVNode("", true),
|
|
1168
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.multiple ? multipleOptions.value : availableOptions.value, (option) => {
|
|
1169
|
+
return openBlock(), createElementBlock("div", {
|
|
1170
|
+
key: String(optionValue(option)),
|
|
1171
|
+
class: normalizeClass([
|
|
1172
|
+
__props.dropdownOptionClass,
|
|
1173
|
+
optionDeleted(option) ? __props.deletedOptionClass : __props.optionClass,
|
|
1174
|
+
{ "text-neutral-50": isDarkMode.value && !optionDeleted(option) },
|
|
1175
|
+
{
|
|
1176
|
+
[__props.dropdownSelectedClass]: __props.multiple ? optionIsSelected(option) : optionValue(option) === __props.modelValue || String(optionValue(option)) === String(__props.modelValue),
|
|
1177
|
+
"rounded-b-lg": option === availableOptions.value[availableOptions.value.length - 1] && !__props.placeholder,
|
|
1178
|
+
"rounded-lg": !__props.placeholder && availableOptions.value.length === 1
|
|
1179
|
+
}
|
|
1180
|
+
]),
|
|
1181
|
+
onClick: withModifiers(($event) => __props.multiple ? toggleMultipleOption(option) : selectOption(option), ["stop"])
|
|
1182
|
+
}, [
|
|
1183
|
+
__props.multiple ? (openBlock(), createElementBlock("div", _hoisted_2$h, [
|
|
1184
|
+
createElementVNode("input", {
|
|
1185
|
+
type: "checkbox",
|
|
1186
|
+
class: "h-4 w-4 rounded border-neutral-300 text-neutral-900 focus:ring-neutral-900",
|
|
1187
|
+
checked: optionIsSelected(option),
|
|
1188
|
+
disabled: __props.disabled,
|
|
1189
|
+
tabindex: "-1",
|
|
1190
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
1191
|
+
}, ["stop"])),
|
|
1192
|
+
onChange: withModifiers(($event) => toggleMultipleOption(option), ["stop"])
|
|
1193
|
+
}, null, 40, _hoisted_3$b),
|
|
1194
|
+
createElementVNode("span", {
|
|
1195
|
+
style: normalizeStyle(darkTextStyle.value)
|
|
1196
|
+
}, toDisplayString(optionText(option)), 5)
|
|
1197
|
+
])) : (openBlock(), createElementBlock("span", {
|
|
1198
|
+
key: 1,
|
|
1199
|
+
style: normalizeStyle(darkTextStyle.value)
|
|
1200
|
+
}, toDisplayString(optionText(option)), 5))
|
|
1201
|
+
], 10, _hoisted_1$r);
|
|
1202
|
+
}), 128))
|
|
1203
|
+
], 2)
|
|
1107
1204
|
], 6)) : createCommentVNode("", true)
|
|
1108
1205
|
]))
|
|
1109
1206
|
]),
|
|
@@ -1117,7 +1214,7 @@ const _sfc_main$D = {
|
|
|
1117
1214
|
__name: "SelectInput",
|
|
1118
1215
|
props: {
|
|
1119
1216
|
modelValue: {
|
|
1120
|
-
type: [String, Number, Boolean, null],
|
|
1217
|
+
type: [String, Number, Boolean, Array, null],
|
|
1121
1218
|
default: ""
|
|
1122
1219
|
},
|
|
1123
1220
|
modelModifiers: {
|
|
@@ -1136,6 +1233,10 @@ const _sfc_main$D = {
|
|
|
1136
1233
|
type: Boolean,
|
|
1137
1234
|
default: false
|
|
1138
1235
|
},
|
|
1236
|
+
multiple: {
|
|
1237
|
+
type: Boolean,
|
|
1238
|
+
default: false
|
|
1239
|
+
},
|
|
1139
1240
|
disabled: {
|
|
1140
1241
|
type: Boolean,
|
|
1141
1242
|
default: false
|
|
@@ -1162,39 +1263,39 @@ const _sfc_main$D = {
|
|
|
1162
1263
|
},
|
|
1163
1264
|
baseClass: {
|
|
1164
1265
|
type: [String, Array, Object],
|
|
1165
|
-
default: "block w-full rounded-lg border border-slate-300 bg-white px-4 py-3 text-sm text-slate-900 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20"
|
|
1266
|
+
default: "block w-full rounded-lg border border-slate-300 bg-white px-4 py-3 text-sm text-slate-900 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50 dark:focus:border-neutral-100 dark:focus:ring-neutral-100/10"
|
|
1166
1267
|
},
|
|
1167
1268
|
normalTextClass: {
|
|
1168
1269
|
type: [String, Array, Object],
|
|
1169
|
-
default: "text-slate-900"
|
|
1270
|
+
default: "text-slate-900 dark:text-neutral-50"
|
|
1170
1271
|
},
|
|
1171
1272
|
deletedSelectedClass: {
|
|
1172
1273
|
type: [String, Array, Object],
|
|
1173
|
-
default: "text-red-600"
|
|
1274
|
+
default: "text-red-600 dark:text-neutral-100"
|
|
1174
1275
|
},
|
|
1175
1276
|
optionClass: {
|
|
1176
1277
|
type: [String, Array, Object],
|
|
1177
|
-
default: "text-slate-900"
|
|
1278
|
+
default: "text-slate-900 dark:text-neutral-50"
|
|
1178
1279
|
},
|
|
1179
1280
|
deletedOptionClass: {
|
|
1180
1281
|
type: [String, Array, Object],
|
|
1181
|
-
default: "text-rose-700"
|
|
1282
|
+
default: "text-rose-700 dark:text-neutral-100"
|
|
1182
1283
|
},
|
|
1183
1284
|
placeholderClass: {
|
|
1184
1285
|
type: [String, Array, Object],
|
|
1185
|
-
default: "text-slate-500"
|
|
1286
|
+
default: "text-slate-500 dark:text-neutral-200"
|
|
1186
1287
|
},
|
|
1187
1288
|
dropdownClass: {
|
|
1188
1289
|
type: [String, Array, Object],
|
|
1189
|
-
default: "bg-white
|
|
1290
|
+
default: "bg-white border border-slate-200 rounded-xl shadow-xl max-h-60 overflow-auto z-50 backdrop-blur-sm dark:bg-neutral-950 dark:border-neutral-800"
|
|
1190
1291
|
},
|
|
1191
1292
|
dropdownOptionClass: {
|
|
1192
1293
|
type: [String, Array, Object],
|
|
1193
|
-
default: "px-4 py-3 hover:bg-slate-100 cursor-pointer transition-colors"
|
|
1294
|
+
default: "px-4 py-3 hover:bg-slate-100 cursor-pointer transition-colors dark:hover:bg-neutral-900"
|
|
1194
1295
|
},
|
|
1195
1296
|
dropdownSelectedClass: {
|
|
1196
1297
|
type: [String, Array, Object],
|
|
1197
|
-
default: "bg-blue-50 text-blue-700 font-medium"
|
|
1298
|
+
default: "bg-blue-50 text-blue-700 font-medium dark:bg-neutral-900 dark:text-neutral-50"
|
|
1198
1299
|
}
|
|
1199
1300
|
},
|
|
1200
1301
|
emits: ["update:modelValue"],
|
|
@@ -1207,6 +1308,7 @@ const _sfc_main$D = {
|
|
|
1207
1308
|
options: __props.options,
|
|
1208
1309
|
placeholder: __props.placeholder,
|
|
1209
1310
|
"placeholder-disabled": __props.placeholderDisabled,
|
|
1311
|
+
multiple: __props.multiple,
|
|
1210
1312
|
disabled: __props.disabled,
|
|
1211
1313
|
"soft-delete-aware": __props.softDeleteAware,
|
|
1212
1314
|
"label-key": __props.labelKey,
|
|
@@ -1223,7 +1325,7 @@ const _sfc_main$D = {
|
|
|
1223
1325
|
"dropdown-option-class": __props.dropdownOptionClass,
|
|
1224
1326
|
"dropdown-selected-class": __props.dropdownSelectedClass,
|
|
1225
1327
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event))
|
|
1226
|
-
}, _ctx.$attrs), null, 16, ["model-value", "model-modifiers", "options", "placeholder", "placeholder-disabled", "disabled", "soft-delete-aware", "label-key", "value-key", "deleted-key", "option-label", "base-class", "normal-text-class", "deleted-selected-class", "option-class", "deleted-option-class", "placeholder-class", "dropdown-class", "dropdown-option-class", "dropdown-selected-class"]);
|
|
1328
|
+
}, _ctx.$attrs), null, 16, ["model-value", "model-modifiers", "options", "placeholder", "placeholder-disabled", "multiple", "disabled", "soft-delete-aware", "label-key", "value-key", "deleted-key", "option-label", "base-class", "normal-text-class", "deleted-selected-class", "option-class", "deleted-option-class", "placeholder-class", "dropdown-class", "dropdown-option-class", "dropdown-selected-class"]);
|
|
1227
1329
|
};
|
|
1228
1330
|
}
|
|
1229
1331
|
};
|
|
@@ -1814,6 +1916,10 @@ const _sfc_main$v = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
1814
1916
|
type: Boolean,
|
|
1815
1917
|
default: false
|
|
1816
1918
|
},
|
|
1919
|
+
multiple: {
|
|
1920
|
+
type: Boolean,
|
|
1921
|
+
default: false
|
|
1922
|
+
},
|
|
1817
1923
|
softDeleteAware: {
|
|
1818
1924
|
type: Boolean,
|
|
1819
1925
|
default: false
|
|
@@ -1982,6 +2088,7 @@ const _sfc_main$v = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
1982
2088
|
options: props.options,
|
|
1983
2089
|
placeholder: props.placeholder,
|
|
1984
2090
|
placeholderDisabled: props.placeholderDisabled,
|
|
2091
|
+
multiple: props.multiple,
|
|
1985
2092
|
disabled: props.disabled,
|
|
1986
2093
|
softDeleteAware: props.softDeleteAware,
|
|
1987
2094
|
labelKey: props.labelKey,
|
|
@@ -4766,4 +4873,4 @@ export {
|
|
|
4766
4873
|
_sfc_main$z as y,
|
|
4767
4874
|
_sfc_main$x as z
|
|
4768
4875
|
};
|
|
4769
|
-
//# sourceMappingURL=plugin-
|
|
4876
|
+
//# sourceMappingURL=plugin-D5KJd0xy.js.map
|