@seed-ship/mcp-ui-solid 4.2.2 → 4.3.0
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/CHANGELOG.md +36 -0
- package/README.md +13 -8
- package/dist/components/FormFieldRenderer.cjs +132 -52
- package/dist/components/FormFieldRenderer.cjs.map +1 -1
- package/dist/components/FormFieldRenderer.js +133 -53
- package/dist/components/FormFieldRenderer.js.map +1 -1
- package/dist/components/FormRenderer.cjs +25 -6
- package/dist/components/FormRenderer.cjs.map +1 -1
- package/dist/components/FormRenderer.d.ts.map +1 -1
- package/dist/components/FormRenderer.js +25 -6
- package/dist/components/FormRenderer.js.map +1 -1
- package/dist/components/ScratchpadPanel.cjs +329 -276
- package/dist/components/ScratchpadPanel.cjs.map +1 -1
- package/dist/components/ScratchpadPanel.js +329 -276
- package/dist/components/ScratchpadPanel.js.map +1 -1
- package/dist/services/validation.cjs +8 -0
- package/dist/services/validation.cjs.map +1 -1
- package/dist/services/validation.d.ts.map +1 -1
- package/dist/services/validation.js +8 -0
- package/dist/services/validation.js.map +1 -1
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types.d.cts +8 -0
- package/dist/types.d.ts +8 -0
- package/package.json +1 -1
- package/src/components/FormFieldRenderer.tsx +89 -2
- package/src/components/FormRenderer.tsx +12 -0
- package/src/components/ScratchpadPanel.tsx +35 -0
- package/src/services/validation.ts +10 -0
- package/src/types/index.ts +8 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { delegateEvents, createComponent, getNextElement, template, getNextMarker, insert, effect, setAttribute, className, memo, setProperty, runHydrationEvents } from "solid-js/web";
|
|
2
|
-
import { createSignal, Show, Switch, Match, For, onCleanup } from "solid-js";
|
|
2
|
+
import { createSignal, Show, Switch, Match, For, createEffect, onCleanup } from "solid-js";
|
|
3
3
|
import { useConditionalField } from "../hooks/useConditionalField.js";
|
|
4
|
-
var _tmpl$ = /* @__PURE__ */ template(`<span class=mr-1>`), _tmpl$2 = /* @__PURE__ */ template(`<span class="text-red-500 ml-1"aria-hidden=true>*`), _tmpl$3 = /* @__PURE__ */ template(`<span class="ml-2 text-[10px] font-medium bg-orange-100 dark:bg-orange-900/30 text-orange-600 dark:text-orange-400 px-1.5 py-0.5 rounded">Not supported`), _tmpl$4 = /* @__PURE__ */ template(`<span class="ml-2 text-[10px] font-medium bg-yellow-100 dark:bg-yellow-900/30 text-yellow-600 dark:text-yellow-400 px-1.5 py-0.5 rounded">?`), _tmpl$5 = /* @__PURE__ */ template(`<label><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`), _tmpl$6 = /* @__PURE__ */ template(`<input>`), _tmpl$7 = /* @__PURE__ */ template(`<input type=number>`), _tmpl$8 = /* @__PURE__ */ template(`<input type=date>`), _tmpl$9 = /* @__PURE__ */ template(`<textarea>`), _tmpl$0 = /* @__PURE__ */ template(`<option value disabled>`), _tmpl$1 = /* @__PURE__ */ template(`<select><!$><!/><!$><!/>`), _tmpl$10 = /* @__PURE__ */ template(`<label class="flex items-center gap-2 cursor-pointer"><input type=checkbox class="w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700"><span class="text-sm text-gray-700 dark:text-gray-300"><!$><!/><!$><!/>`), _tmpl$11 = /* @__PURE__ */ template(`<div class=space-y-2 role=radiogroup>`), _tmpl$12 = /* @__PURE__ */ template(`<div class="flex items-center gap-3"><input type=range class="flex-1 h-2 bg-gray-200 dark:bg-gray-600 rounded-lg appearance-none cursor-pointer accent-blue-600"><span class="text-sm font-mono text-gray-700 dark:text-gray-300 min-w-[3rem] text-right">`), _tmpl$13 = /* @__PURE__ */ template(`<label class="flex items-center gap-2 cursor-pointer"><button type=button role=switch><span></span></button><span class="text-sm text-gray-700 dark:text-gray-300">`), _tmpl$14 = /* @__PURE__ */ template(`<fieldset class="border border-gray-200 dark:border-gray-600 rounded-lg p-3"><legend class="text-xs font-medium text-gray-500 dark:text-gray-400 px-1"></legend><p class="text-xs text-gray-400">`), _tmpl$15 = /* @__PURE__ */ template(`<input type=text>`), _tmpl$16 = /* @__PURE__ */ template(`<p class="text-xs text-amber-500 mt-0.5">Unknown field type: <!$><!/>`), _tmpl$17 = /* @__PURE__ */ template(`<p>`), _tmpl$18 = /* @__PURE__ */ template(`<p class="text-xs text-gray-500 dark:text-gray-400">`), _tmpl$19 = /* @__PURE__ */ template(`<p role=alert class="text-xs text-red-600 dark:text-red-400">`), _tmpl$20 = /* @__PURE__ */ template(`<div class=space-y-1><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`), _tmpl$21 = /* @__PURE__ */ template(`<option>`), _tmpl$22 = /* @__PURE__ */ template(`<label class="flex items-center gap-2 cursor-pointer"><input type=radio class="w-4 h-4 border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600"><span class="text-sm text-gray-700 dark:text-gray-300">`), _tmpl$23 = /* @__PURE__ */ template(`<div class="flex flex-wrap gap-1 mb-1">`), _tmpl$24 = /* @__PURE__ */ template(`<div class="p-2 border-b border-gray-200 dark:border-gray-600 flex-shrink-0"><input type=text placeholder=Filter... class="w-full px-2 py-1 text-sm border border-gray-200 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:border-blue-400 outline-none"autofocus>`), _tmpl$25 = /* @__PURE__ */ template(`<p class="px-3 py-2 text-sm text-gray-400">No matches`), _tmpl$26 = /* @__PURE__ */ template(`<div class="absolute z-50 mt-1 w-full bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-md shadow-lg"style=max-height:320px;display:flex;flex-direction:column><!$><!/><div style=overflow-y:auto;flex:1;-webkit-overflow-scrolling:touch><!$><!/><!$><!/>`), _tmpl$27 = /* @__PURE__ */ template(`<div class=relative><!$><!/><button type=button><span></span><svg class="w-4 h-4 text-gray-400"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M19 9l-7 7-7-7"></path></svg></button><!$><!/>`), _tmpl$28 = /* @__PURE__ */ template(`<span class="inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded-full"><!$><!/><button type=button class="hover:text-blue-900 dark:hover:text-blue-100">×`), _tmpl$29 = /* @__PURE__ */ template(`<label class="flex items-center gap-2 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer text-sm"><input type=checkbox class="w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600"><span class="text-gray-900 dark:text-white">`), _tmpl$30 = /* @__PURE__ */ template(`<div class="absolute z-20 mt-1 w-full bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-md shadow-lg max-h-72 overflow-y-auto">`), _tmpl$
|
|
4
|
+
var _tmpl$ = /* @__PURE__ */ template(`<span class=mr-1>`), _tmpl$2 = /* @__PURE__ */ template(`<span class="text-red-500 ml-1"aria-hidden=true>*`), _tmpl$3 = /* @__PURE__ */ template(`<span class="ml-2 text-[10px] font-medium bg-orange-100 dark:bg-orange-900/30 text-orange-600 dark:text-orange-400 px-1.5 py-0.5 rounded">Not supported`), _tmpl$4 = /* @__PURE__ */ template(`<span class="ml-2 text-[10px] font-medium bg-yellow-100 dark:bg-yellow-900/30 text-yellow-600 dark:text-yellow-400 px-1.5 py-0.5 rounded">?`), _tmpl$5 = /* @__PURE__ */ template(`<label><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`), _tmpl$6 = /* @__PURE__ */ template(`<input>`), _tmpl$7 = /* @__PURE__ */ template(`<input type=number>`), _tmpl$8 = /* @__PURE__ */ template(`<input type=date>`), _tmpl$9 = /* @__PURE__ */ template(`<textarea>`), _tmpl$0 = /* @__PURE__ */ template(`<option value disabled>`), _tmpl$1 = /* @__PURE__ */ template(`<select><!$><!/><!$><!/>`), _tmpl$10 = /* @__PURE__ */ template(`<label class="flex items-center gap-2 cursor-pointer"><input type=checkbox class="w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700"><span class="text-sm text-gray-700 dark:text-gray-300"><!$><!/><!$><!/>`), _tmpl$11 = /* @__PURE__ */ template(`<div class=space-y-2 role=radiogroup>`), _tmpl$12 = /* @__PURE__ */ template(`<div class="flex items-center gap-3"><input type=range class="flex-1 h-2 bg-gray-200 dark:bg-gray-600 rounded-lg appearance-none cursor-pointer accent-blue-600"><span class="text-sm font-mono text-gray-700 dark:text-gray-300 min-w-[3rem] text-right">`), _tmpl$13 = /* @__PURE__ */ template(`<label class="flex items-center gap-2 cursor-pointer"><button type=button role=switch><span></span></button><span class="text-sm text-gray-700 dark:text-gray-300">`), _tmpl$14 = /* @__PURE__ */ template(`<fieldset class="border border-gray-200 dark:border-gray-600 rounded-lg p-3"><legend class="text-xs font-medium text-gray-500 dark:text-gray-400 px-1"></legend><p class="text-xs text-gray-400">`), _tmpl$15 = /* @__PURE__ */ template(`<input type=text>`), _tmpl$16 = /* @__PURE__ */ template(`<p class="text-xs text-amber-500 mt-0.5">Unknown field type: <!$><!/>`), _tmpl$17 = /* @__PURE__ */ template(`<p>`), _tmpl$18 = /* @__PURE__ */ template(`<p class="text-xs text-gray-500 dark:text-gray-400">`), _tmpl$19 = /* @__PURE__ */ template(`<p role=alert class="text-xs text-red-600 dark:text-red-400">`), _tmpl$20 = /* @__PURE__ */ template(`<div class=space-y-1><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`), _tmpl$21 = /* @__PURE__ */ template(`<option>`), _tmpl$22 = /* @__PURE__ */ template(`<label class="flex items-center gap-2 cursor-pointer"><input type=radio class="w-4 h-4 border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600"><span class="text-sm text-gray-700 dark:text-gray-300">`), _tmpl$23 = /* @__PURE__ */ template(`<div class="flex flex-wrap gap-1 mb-1">`), _tmpl$24 = /* @__PURE__ */ template(`<div class="p-2 border-b border-gray-200 dark:border-gray-600 flex-shrink-0"><input type=text placeholder=Filter... class="w-full px-2 py-1 text-sm border border-gray-200 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:border-blue-400 outline-none"autofocus>`), _tmpl$25 = /* @__PURE__ */ template(`<p class="px-3 py-2 text-sm text-gray-400">No matches`), _tmpl$26 = /* @__PURE__ */ template(`<div class="absolute z-50 mt-1 w-full bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-md shadow-lg"style=max-height:320px;display:flex;flex-direction:column><!$><!/><div style=overflow-y:auto;flex:1;-webkit-overflow-scrolling:touch><!$><!/><!$><!/>`), _tmpl$27 = /* @__PURE__ */ template(`<div class=relative><!$><!/><button type=button><span></span><svg class="w-4 h-4 text-gray-400"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M19 9l-7 7-7-7"></path></svg></button><!$><!/>`), _tmpl$28 = /* @__PURE__ */ template(`<span class="inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded-full"><!$><!/><button type=button class="hover:text-blue-900 dark:hover:text-blue-100">×`), _tmpl$29 = /* @__PURE__ */ template(`<label class="flex items-center gap-2 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer text-sm"><input type=checkbox class="w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600"><span class="text-gray-900 dark:text-white">`), _tmpl$30 = /* @__PURE__ */ template(`<div class="flex items-center gap-1 mb-1 text-xs text-gray-400"><span class="animate-spin h-3 w-3 border border-gray-400 border-t-transparent rounded-full"></span>Resolving...`), _tmpl$31 = /* @__PURE__ */ template(`<div class="absolute z-20 mt-1 w-full bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-md shadow-lg max-h-72 overflow-y-auto">`), _tmpl$32 = /* @__PURE__ */ template(`<div class=relative><!$><!/><!$><!/><input type=text autocomplete=off><!$><!/>`), _tmpl$33 = /* @__PURE__ */ template(`<span class="ml-2 text-xs">✓`), _tmpl$34 = /* @__PURE__ */ template(`<button type=button><!$><!/><!$><!/>`), _tmpl$35 = /* @__PURE__ */ template(`<div><!$><!/><input type=text>`);
|
|
5
5
|
const SOURCE_BADGES = {
|
|
6
6
|
detected: {
|
|
7
7
|
icon: "✅",
|
|
@@ -719,6 +719,7 @@ const AutocompleteField = (props) => {
|
|
|
719
719
|
const [suggestions, setSuggestions] = createSignal([]);
|
|
720
720
|
const [isOpen, setIsOpen] = createSignal(false);
|
|
721
721
|
const [selectedLabels, setSelectedLabels] = createSignal(/* @__PURE__ */ new Map());
|
|
722
|
+
const [resolving, setResolving] = createSignal(false);
|
|
722
723
|
let debounceTimer = null;
|
|
723
724
|
const isMultiple = () => props.field.multiple === true;
|
|
724
725
|
const selectedValues = () => isMultiple() ? Array.isArray(props.value) ? props.value : [] : [];
|
|
@@ -750,6 +751,69 @@ const AutocompleteField = (props) => {
|
|
|
750
751
|
setSuggestions([]);
|
|
751
752
|
}
|
|
752
753
|
};
|
|
754
|
+
const resolvePrefill = async (prefillValues) => {
|
|
755
|
+
if (!props.field.apiUrl || !props.field.searchParam) return;
|
|
756
|
+
setResolving(true);
|
|
757
|
+
const labelField = props.field.labelField || "label";
|
|
758
|
+
const valueField = props.field.valueField || "value";
|
|
759
|
+
try {
|
|
760
|
+
const resolvedValues = [];
|
|
761
|
+
for (const pv of prefillValues) {
|
|
762
|
+
const params = new URLSearchParams({
|
|
763
|
+
[props.field.searchParam]: pv,
|
|
764
|
+
limit: "1"
|
|
765
|
+
});
|
|
766
|
+
if (props.field.extraParams) {
|
|
767
|
+
for (const [k, v] of Object.entries(props.field.extraParams)) params.set(k, v);
|
|
768
|
+
}
|
|
769
|
+
const res = await fetch(`${props.field.apiUrl}?${params}`);
|
|
770
|
+
if (!res.ok) {
|
|
771
|
+
resolvedValues.push(pv);
|
|
772
|
+
continue;
|
|
773
|
+
}
|
|
774
|
+
const data = await res.json();
|
|
775
|
+
const items = Array.isArray(data) ? data : data.results || data.features || [];
|
|
776
|
+
if (items.length > 0) {
|
|
777
|
+
const code = String(items[0][valueField] || pv);
|
|
778
|
+
const label = items[0][labelField] || pv;
|
|
779
|
+
resolvedValues.push(code);
|
|
780
|
+
setSelectedLabels((prev) => new Map(prev).set(code, label));
|
|
781
|
+
} else {
|
|
782
|
+
resolvedValues.push(pv);
|
|
783
|
+
setSelectedLabels((prev) => new Map(prev).set(pv, pv));
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
if (isMultiple()) {
|
|
787
|
+
props.onChange(resolvedValues);
|
|
788
|
+
} else {
|
|
789
|
+
props.onChange(resolvedValues[0] || "");
|
|
790
|
+
const label = selectedLabels().get(resolvedValues[0]);
|
|
791
|
+
if (label) setQuery(label);
|
|
792
|
+
}
|
|
793
|
+
} catch {
|
|
794
|
+
} finally {
|
|
795
|
+
setResolving(false);
|
|
796
|
+
}
|
|
797
|
+
};
|
|
798
|
+
createEffect(() => {
|
|
799
|
+
const prefill = props.field.prefill;
|
|
800
|
+
if (!prefill) return;
|
|
801
|
+
const values = Array.isArray(prefill) ? prefill : [prefill];
|
|
802
|
+
if (values.length === 0) return;
|
|
803
|
+
if (props.field.prefillMode === "resolve") {
|
|
804
|
+
resolvePrefill(values);
|
|
805
|
+
} else {
|
|
806
|
+
for (const v of values) {
|
|
807
|
+
if (!selectedLabels().has(v)) {
|
|
808
|
+
setSelectedLabels((prev) => new Map(prev).set(v, props.field.displayHint || v));
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
if (!isMultiple() && values[0]) {
|
|
812
|
+
const label = props.field.displayHint || values[0];
|
|
813
|
+
setQuery(label);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
});
|
|
753
817
|
const handleInput = (value) => {
|
|
754
818
|
setQuery(value);
|
|
755
819
|
if (!isMultiple()) {
|
|
@@ -784,6 +848,14 @@ const AutocompleteField = (props) => {
|
|
|
784
848
|
setSuggestions([]);
|
|
785
849
|
}
|
|
786
850
|
};
|
|
851
|
+
const handleBlur = () => {
|
|
852
|
+
setTimeout(() => {
|
|
853
|
+
setIsOpen(false);
|
|
854
|
+
if (!isMultiple() && query() && !props.value && props.field.valueField && suggestions().length > 0) {
|
|
855
|
+
selectSuggestion(suggestions()[0]);
|
|
856
|
+
}
|
|
857
|
+
}, 200);
|
|
858
|
+
};
|
|
787
859
|
const removeChip = (val) => {
|
|
788
860
|
props.onChange(selectedValues().filter((v) => v !== val));
|
|
789
861
|
setSelectedLabels((prev) => {
|
|
@@ -797,88 +869,96 @@ const AutocompleteField = (props) => {
|
|
|
797
869
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
798
870
|
});
|
|
799
871
|
return (() => {
|
|
800
|
-
var _el$95 = getNextElement(_tmpl$
|
|
872
|
+
var _el$95 = getNextElement(_tmpl$32), _el$100 = _el$95.firstChild, [_el$101, _co$21] = getNextMarker(_el$100.nextSibling), _el$102 = _el$101.nextSibling, [_el$103, _co$22] = getNextMarker(_el$102.nextSibling), _el$98 = _el$103.nextSibling, _el$104 = _el$98.nextSibling, [_el$105, _co$23] = getNextMarker(_el$104.nextSibling);
|
|
873
|
+
insert(_el$95, createComponent(Show, {
|
|
874
|
+
get when() {
|
|
875
|
+
return resolving();
|
|
876
|
+
},
|
|
877
|
+
get children() {
|
|
878
|
+
return getNextElement(_tmpl$30);
|
|
879
|
+
}
|
|
880
|
+
}), _el$101, _co$21);
|
|
801
881
|
insert(_el$95, createComponent(Show, {
|
|
802
882
|
get when() {
|
|
803
883
|
return memo(() => !!isMultiple())() && selectedValues().length > 0;
|
|
804
884
|
},
|
|
805
885
|
get children() {
|
|
806
|
-
var _el$
|
|
807
|
-
insert(_el$
|
|
886
|
+
var _el$97 = getNextElement(_tmpl$23);
|
|
887
|
+
insert(_el$97, createComponent(For, {
|
|
808
888
|
get each() {
|
|
809
889
|
return selectedValues();
|
|
810
890
|
},
|
|
811
891
|
children: (val) => (() => {
|
|
812
|
-
var _el$
|
|
813
|
-
insert(_el$
|
|
814
|
-
_el$
|
|
815
|
-
effect(() => setAttribute(_el$
|
|
892
|
+
var _el$106 = getNextElement(_tmpl$28), _el$108 = _el$106.firstChild, [_el$109, _co$24] = getNextMarker(_el$108.nextSibling), _el$107 = _el$109.nextSibling;
|
|
893
|
+
insert(_el$106, () => getLabel(val), _el$109, _co$24);
|
|
894
|
+
_el$107.$$click = () => removeChip(val);
|
|
895
|
+
effect(() => setAttribute(_el$107, "aria-label", `Remove ${getLabel(val)}`));
|
|
816
896
|
runHydrationEvents();
|
|
817
|
-
return _el$
|
|
897
|
+
return _el$106;
|
|
818
898
|
})()
|
|
819
899
|
}));
|
|
820
|
-
return _el$
|
|
900
|
+
return _el$97;
|
|
821
901
|
}
|
|
822
|
-
}), _el$
|
|
823
|
-
_el$
|
|
824
|
-
_el$
|
|
902
|
+
}), _el$103, _co$22);
|
|
903
|
+
_el$98.addEventListener("blur", handleBlur);
|
|
904
|
+
_el$98.addEventListener("focus", () => {
|
|
825
905
|
if (suggestions().length) setIsOpen(true);
|
|
826
906
|
});
|
|
827
|
-
_el$
|
|
907
|
+
_el$98.$$input = (e) => handleInput(e.currentTarget.value);
|
|
828
908
|
insert(_el$95, createComponent(Show, {
|
|
829
909
|
get when() {
|
|
830
910
|
return memo(() => !!isOpen())() && suggestions().length > 0;
|
|
831
911
|
},
|
|
832
912
|
get children() {
|
|
833
|
-
var _el$
|
|
834
|
-
insert(_el$
|
|
913
|
+
var _el$99 = getNextElement(_tmpl$31);
|
|
914
|
+
insert(_el$99, createComponent(For, {
|
|
835
915
|
get each() {
|
|
836
916
|
return suggestions();
|
|
837
917
|
},
|
|
838
918
|
children: (item) => {
|
|
839
919
|
const isSelected = () => isMultiple() && selectedValues().includes(item.value);
|
|
840
920
|
return (() => {
|
|
841
|
-
var _el$
|
|
842
|
-
_el$
|
|
843
|
-
_el$
|
|
844
|
-
insert(_el$
|
|
845
|
-
insert(_el$
|
|
921
|
+
var _el$110 = getNextElement(_tmpl$34), _el$112 = _el$110.firstChild, [_el$113, _co$25] = getNextMarker(_el$112.nextSibling), _el$114 = _el$113.nextSibling, [_el$115, _co$26] = getNextMarker(_el$114.nextSibling);
|
|
922
|
+
_el$110.$$click = () => selectSuggestion(item);
|
|
923
|
+
_el$110.$$mousedown = (e) => e.preventDefault();
|
|
924
|
+
insert(_el$110, () => item.label, _el$113, _co$25);
|
|
925
|
+
insert(_el$110, createComponent(Show, {
|
|
846
926
|
get when() {
|
|
847
927
|
return isSelected();
|
|
848
928
|
},
|
|
849
929
|
get children() {
|
|
850
|
-
return getNextElement(_tmpl$
|
|
930
|
+
return getNextElement(_tmpl$33);
|
|
851
931
|
}
|
|
852
|
-
}), _el$
|
|
932
|
+
}), _el$115, _co$26);
|
|
853
933
|
effect((_p$) => {
|
|
854
934
|
var _v$83 = `w-full text-left px-3 py-2 text-sm hover:bg-blue-50 dark:hover:bg-blue-900/20 ${isSelected() ? "text-blue-600 dark:text-blue-400 bg-blue-50/50 dark:bg-blue-900/10" : "text-gray-900 dark:text-white"}`, _v$84 = isSelected();
|
|
855
|
-
_v$83 !== _p$.e && className(_el$
|
|
856
|
-
_v$84 !== _p$.t && setProperty(_el$
|
|
935
|
+
_v$83 !== _p$.e && className(_el$110, _p$.e = _v$83);
|
|
936
|
+
_v$84 !== _p$.t && setProperty(_el$110, "disabled", _p$.t = _v$84);
|
|
857
937
|
return _p$;
|
|
858
938
|
}, {
|
|
859
939
|
e: void 0,
|
|
860
940
|
t: void 0
|
|
861
941
|
});
|
|
862
942
|
runHydrationEvents();
|
|
863
|
-
return _el$
|
|
943
|
+
return _el$110;
|
|
864
944
|
})();
|
|
865
945
|
}
|
|
866
946
|
}));
|
|
867
|
-
return _el$
|
|
947
|
+
return _el$99;
|
|
868
948
|
}
|
|
869
|
-
}), _el$
|
|
949
|
+
}), _el$105, _co$23);
|
|
870
950
|
effect((_p$) => {
|
|
871
|
-
var _v$80 = isMultiple() && selectedValues().length ? "Add more..." : props.field.placeholder, _v$81 = props.disabled, _v$82 = props.baseClass;
|
|
872
|
-
_v$80 !== _p$.e && setAttribute(_el$
|
|
873
|
-
_v$81 !== _p$.t && setProperty(_el$
|
|
874
|
-
_v$82 !== _p$.a && className(_el$
|
|
951
|
+
var _v$80 = isMultiple() && selectedValues().length ? "Add more..." : props.field.placeholder, _v$81 = props.disabled || resolving(), _v$82 = props.baseClass;
|
|
952
|
+
_v$80 !== _p$.e && setAttribute(_el$98, "placeholder", _p$.e = _v$80);
|
|
953
|
+
_v$81 !== _p$.t && setProperty(_el$98, "disabled", _p$.t = _v$81);
|
|
954
|
+
_v$82 !== _p$.a && className(_el$98, _p$.a = _v$82);
|
|
875
955
|
return _p$;
|
|
876
956
|
}, {
|
|
877
957
|
e: void 0,
|
|
878
958
|
t: void 0,
|
|
879
959
|
a: void 0
|
|
880
960
|
});
|
|
881
|
-
effect(() => setProperty(_el$
|
|
961
|
+
effect(() => setProperty(_el$98, "value", query()));
|
|
882
962
|
runHydrationEvents();
|
|
883
963
|
return _el$95;
|
|
884
964
|
})();
|
|
@@ -905,46 +985,46 @@ const TagsField = (props) => {
|
|
|
905
985
|
}
|
|
906
986
|
};
|
|
907
987
|
return (() => {
|
|
908
|
-
var _el$
|
|
909
|
-
insert(_el$
|
|
988
|
+
var _el$116 = getNextElement(_tmpl$35), _el$119 = _el$116.firstChild, [_el$120, _co$27] = getNextMarker(_el$119.nextSibling), _el$118 = _el$120.nextSibling;
|
|
989
|
+
insert(_el$116, createComponent(Show, {
|
|
910
990
|
get when() {
|
|
911
991
|
return (props.value || []).length > 0;
|
|
912
992
|
},
|
|
913
993
|
get children() {
|
|
914
|
-
var _el$
|
|
915
|
-
insert(_el$
|
|
994
|
+
var _el$117 = getNextElement(_tmpl$23);
|
|
995
|
+
insert(_el$117, createComponent(For, {
|
|
916
996
|
get each() {
|
|
917
997
|
return props.value || [];
|
|
918
998
|
},
|
|
919
999
|
children: (tag) => (() => {
|
|
920
|
-
var _el$
|
|
921
|
-
insert(_el$
|
|
922
|
-
_el$
|
|
923
|
-
setAttribute(_el$
|
|
1000
|
+
var _el$121 = getNextElement(_tmpl$28), _el$123 = _el$121.firstChild, [_el$124, _co$28] = getNextMarker(_el$123.nextSibling), _el$122 = _el$124.nextSibling;
|
|
1001
|
+
insert(_el$121, tag, _el$124, _co$28);
|
|
1002
|
+
_el$122.$$click = () => removeTag(tag);
|
|
1003
|
+
setAttribute(_el$122, "aria-label", `Remove ${tag}`);
|
|
924
1004
|
runHydrationEvents();
|
|
925
|
-
return _el$
|
|
1005
|
+
return _el$121;
|
|
926
1006
|
})()
|
|
927
1007
|
}));
|
|
928
|
-
return _el$
|
|
1008
|
+
return _el$117;
|
|
929
1009
|
}
|
|
930
|
-
}), _el$
|
|
931
|
-
_el$
|
|
932
|
-
_el$
|
|
933
|
-
_el$
|
|
1010
|
+
}), _el$120, _co$27);
|
|
1011
|
+
_el$118.addEventListener("blur", addTag);
|
|
1012
|
+
_el$118.$$keydown = handleKeyDown;
|
|
1013
|
+
_el$118.$$input = (e) => setInput(e.currentTarget.value);
|
|
934
1014
|
effect((_p$) => {
|
|
935
1015
|
var _v$85 = props.placeholder || "Type and press Enter...", _v$86 = props.disabled, _v$87 = props.baseClass;
|
|
936
|
-
_v$85 !== _p$.e && setAttribute(_el$
|
|
937
|
-
_v$86 !== _p$.t && setProperty(_el$
|
|
938
|
-
_v$87 !== _p$.a && className(_el$
|
|
1016
|
+
_v$85 !== _p$.e && setAttribute(_el$118, "placeholder", _p$.e = _v$85);
|
|
1017
|
+
_v$86 !== _p$.t && setProperty(_el$118, "disabled", _p$.t = _v$86);
|
|
1018
|
+
_v$87 !== _p$.a && className(_el$118, _p$.a = _v$87);
|
|
939
1019
|
return _p$;
|
|
940
1020
|
}, {
|
|
941
1021
|
e: void 0,
|
|
942
1022
|
t: void 0,
|
|
943
1023
|
a: void 0
|
|
944
1024
|
});
|
|
945
|
-
effect(() => setProperty(_el$
|
|
1025
|
+
effect(() => setProperty(_el$118, "value", input()));
|
|
946
1026
|
runHydrationEvents();
|
|
947
|
-
return _el$
|
|
1027
|
+
return _el$116;
|
|
948
1028
|
})();
|
|
949
1029
|
};
|
|
950
1030
|
delegateEvents(["focusin", "click", "input", "mousedown", "keydown"]);
|