utopia-ui 3.0.0-alpha.176 → 3.0.0-alpha.178

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/index.js CHANGED
@@ -2699,16 +2699,16 @@ var OverlayItemsIndexPage = function (_a) {
2699
2699
  }
2700
2700
  });
2701
2701
  }); };
2702
- return (jsxs(Fragment, { children: [jsx(MapOverlayPage, __assign({ className: 'tw-rounded-none tw-overflow-y-auto tw-bg-base-200 !tw-p-4' }, { children: jsxs("div", __assign({ className: 'tw-flex tw-flex-col tw-h-full' }, { children: [jsx("div", __assign({ className: 'tw-flex-none' }, { children: jsxs(Control, __assign({ position: 'topLeft', zIndex: "1000", absolute: false }, { children: [jsx(SearchControl, {}), jsx(TagsControl, {})] })) })), jsxs("div", __assign({ className: "tw-overflow-scroll fade tw-flex-1 tw-grid tw-grid-cols-1 md:tw-grid-cols-2 lg:tw-grid-cols-3 2xl:tw-grid-cols-4 tw-gap-6 tw-pt-4" }, { children: [(_c = (_b = items === null || items === void 0 ? void 0 : items.filter(function (i) { var _a; return ((_a = i.layer) === null || _a === void 0 ? void 0 : _a.name) === layerName; }).filter(function (item) {
2703
- return filterTags.length == 0 ? item : filterTags.every(function (tag) { return getItemTags(item).some(function (filterTag) { return filterTag.name.toLocaleLowerCase() === tag.name.toLocaleLowerCase(); }); });
2704
- })) === null || _b === void 0 ? void 0 : _b.sort(function (a, b) {
2705
- // Convert date_created to milliseconds, handle undefined by converting to lowest possible date (0 milliseconds)
2706
- var dateA = a.date_updated ? new Date(a.date_updated).getTime() : a.date_created ? new Date(a.date_created).getTime() : 0;
2707
- var dateB = b.date_updated ? new Date(b.date_updated).getTime() : b.date_created ? new Date(b.date_created).getTime() : 0;
2708
- return dateB - dateA; // Subtracts milliseconds which are numbers
2709
- })) === null || _c === void 0 ? void 0 : _c.map(function (i, k) {
2710
- return (jsx(ItemCard, { i: i, loading: loading, url: url, parameterField: parameterField, deleteCallback: function () { return deleteItem(i); } }, k));
2711
- }), addItemPopupType == "place" ?
2702
+ return (jsxs(Fragment, { children: [jsx(MapOverlayPage, __assign({ className: 'tw-rounded-none tw-overflow-y-auto tw-bg-base-200 !tw-p-4' }, { children: jsxs("div", __assign({ className: 'tw-flex tw-flex-col tw-h-full' }, { children: [jsx("div", __assign({ className: 'tw-flex-none' }, { children: jsxs(Control, __assign({ position: 'topLeft', zIndex: "1000", absolute: false }, { children: [jsx(SearchControl, {}), jsx(TagsControl, {})] })) })), jsxs("div", __assign({ className: "tw-overflow-scroll fade tw-flex-1" }, { children: [jsx("div", __assign({ className: 'tw-grid tw-grid-cols-1 md:tw-grid-cols-2 lg:tw-grid-cols-3 2xl:tw-grid-cols-4 tw-gap-6 tw-pt-4' }, { children: (_c = (_b = items === null || items === void 0 ? void 0 : items.filter(function (i) { var _a; return ((_a = i.layer) === null || _a === void 0 ? void 0 : _a.name) === layerName; }).filter(function (item) {
2703
+ return filterTags.length == 0 ? item : filterTags.every(function (tag) { return getItemTags(item).some(function (filterTag) { return filterTag.name.toLocaleLowerCase() === tag.name.toLocaleLowerCase(); }); });
2704
+ })) === null || _b === void 0 ? void 0 : _b.sort(function (a, b) {
2705
+ // Convert date_created to milliseconds, handle undefined by converting to lowest possible date (0 milliseconds)
2706
+ var dateA = a.date_updated ? new Date(a.date_updated).getTime() : a.date_created ? new Date(a.date_created).getTime() : 0;
2707
+ var dateB = b.date_updated ? new Date(b.date_updated).getTime() : b.date_created ? new Date(b.date_created).getTime() : 0;
2708
+ return dateB - dateA; // Subtracts milliseconds which are numbers
2709
+ })) === null || _c === void 0 ? void 0 : _c.map(function (i, k) {
2710
+ return (jsx(ItemCard, { i: i, loading: loading, url: url, parameterField: parameterField, deleteCallback: function () { return deleteItem(i); } }, k));
2711
+ }) })), addItemPopupType == "place" ?
2712
2712
  jsx("form", __assign({ ref: tabRef, autoComplete: 'off', onSubmit: function (e) { return submitNewItem(e); } }, { children: jsxs("div", __assign({ className: 'tw-cursor-pointer tw-card tw-border-[1px] tw-border-base-300 tw-card-body tw-shadow-xl tw-bg-base-100 tw-text-base-content tw-p-6 tw-mb-10' }, { children: [jsx("label", __assign({ className: "tw-btn tw-btn-sm tw-rounded-2xl tw-btn-circle tw-btn-ghost hover:tw-bg-transparent tw-absolute tw-right-0 tw-top-0 tw-text-gray-600", onClick: function () {
2713
2713
  setAddItemPopupType("");
2714
2714
  } }, { children: jsx("p", __assign({ className: 'tw-text-center ' }, { children: "\u2715" })) })), jsx(TextInput, { type: "text", placeholder: "Name", dataField: "name", defaultValue: "", inputStyle: '' }), (layer === null || layer === void 0 ? void 0 : layer.itemType.show_start_end_input) &&
@@ -3333,7 +3333,7 @@ var TextView = function (_a) {
3333
3333
  else
3334
3334
  text = ((_b = item === null || item === void 0 ? void 0 : item.layer) === null || _b === void 0 ? void 0 : _b.itemTextField) && item ? getValue(item, (_c = item.layer) === null || _c === void 0 ? void 0 : _c.itemTextField) : "";
3335
3335
  if (item && text && truncate)
3336
- text = truncateString(text, 100, true);
3336
+ text = truncateText(removeMarkdownKeepLinksAndParagraphs(text), 100);
3337
3337
  var replacedText;
3338
3338
  item && text ? replacedText = fixUrls(text) : "";
3339
3339
  replacedText ? replacedText = replacedText.replace(/(?<!\]?\()https?:\/\/[^\s\)]+(?!\))/g, function (url) {
@@ -3405,25 +3405,20 @@ var TextView = function (_a) {
3405
3405
  return (jsx("a", __assign({ style: { color: tag ? tag.color : '#faa', fontWeight: 'bold', cursor: 'pointer' }, onClick: function (e) {
3406
3406
  e.stopPropagation();
3407
3407
  addFilterTag(tag);
3408
- // map.fitBounds(items)
3409
- // map.closePopup();
3410
3408
  } }, { children: decodeTag(children) }), tag ? tag.name + item.id : item.id));
3411
3409
  };
3412
- return (
3413
- //@ts-ignore
3414
- jsx(Markdown, __assign({ className: "tw-text-map tw-leading-map ", remarkPlugins: [remarkBreaks], components: {
3410
+ return (jsx(Markdown, __assign({ className: "tw-text-map tw-leading-map ", remarkPlugins: [remarkBreaks], components: {
3415
3411
  p: CustomParagraph,
3416
3412
  a: function (_a) {
3417
3413
  var href = _a.href, children = _a.children;
3418
- // Prüft, ob der Link ein YouTube-Video ist
3419
3414
  var isYouTubeVideo = href === null || href === void 0 ? void 0 : href.startsWith('https://www.youtube.com/watch?v=');
3420
3415
  if (isYouTubeVideo) {
3421
- var videoId = href === null || href === void 0 ? void 0 : href.split('v=')[1].split('&')[0]; // Extrahiert die Video-ID aus der URL
3416
+ var videoId = href === null || href === void 0 ? void 0 : href.split('v=')[1].split('&')[0];
3422
3417
  var youtubeEmbedUrl = "https://www.youtube-nocookie.com/embed/".concat(videoId);
3423
3418
  return (jsx("iframe", { className: 'tw-w-full', src: youtubeEmbedUrl, allowFullScreen: true }));
3424
3419
  }
3425
3420
  if (href === null || href === void 0 ? void 0 : href.startsWith("#")) {
3426
- var tag = tags.find(function (t) { return t.name.toLowerCase() == decodeURI(href).slice(1).toLowerCase(); });
3421
+ var tag = tags.find(function (t) { return t.name.toLowerCase() === decodeURI(href).slice(1).toLowerCase(); });
3427
3422
  return jsx(CustomHashTagLink, __assign({ tag: tag, item: item }, { children: children }));
3428
3423
  }
3429
3424
  else {
@@ -3442,14 +3437,37 @@ var TextView = function (_a) {
3442
3437
  h6: CustomH6,
3443
3438
  } }, { children: replacedText })));
3444
3439
  };
3445
- function truncateString(str, n, useWordBoundary) {
3446
- if (str.length <= n) {
3447
- return str;
3440
+ function removeMarkdownKeepLinksAndParagraphs(text) {
3441
+ // Remove Markdown syntax using regular expressions but keep links and paragraphs
3442
+ return text
3443
+ .replace(/!\[.*?\]\(.*?\)/g, '') // Remove images
3444
+ .replace(/(`{1,3})(.*?)\1/g, '$2') // Remove inline code
3445
+ .replace(/(\*{1,2}|_{1,2})(.*?)\1/g, '$2') // Remove bold and italic
3446
+ .replace(/(#+)\s+(.*)/g, '$2') // Remove headers
3447
+ .replace(/>\s+(.*)/g, '$1') // Remove blockquotes
3448
+ .replace(/^\s*\n/gm, '\n') // Preserve empty lines
3449
+ .replace(/(\r\n|\n|\r)/gm, '\n'); // Preserve line breaks
3450
+ }
3451
+ function truncateText(text, limit) {
3452
+ if (text.length <= limit) {
3453
+ return text;
3454
+ }
3455
+ var truncated = "";
3456
+ var length = 0;
3457
+ // Split the text by paragraphs
3458
+ var paragraphs = text.split('\n');
3459
+ for (var _i = 0, paragraphs_1 = paragraphs; _i < paragraphs_1.length; _i++) {
3460
+ var paragraph = paragraphs_1[_i];
3461
+ if (length + paragraph.length > limit) {
3462
+ truncated += paragraph.slice(0, limit - length) + '...';
3463
+ break;
3464
+ }
3465
+ else {
3466
+ truncated += paragraph + '\n';
3467
+ length += paragraph.length;
3468
+ }
3448
3469
  }
3449
- var subString = str.slice(0, n - 1); // the original check
3450
- return (useWordBoundary
3451
- ? subString.slice(0, subString.lastIndexOf(" "))
3452
- : subString) + "&hellip;";
3470
+ return truncated.trim();
3453
3471
  }
3454
3472
 
3455
3473
  var ItemViewPopup = React.forwardRef(function (props, ref) {
@@ -4711,18 +4729,18 @@ function LinkedItemsHeaderView(_a) {
4711
4729
 
4712
4730
  function OverlayItemProfile() {
4713
4731
  var _this = this;
4714
- var _a, _b, _c, _d;
4715
- var _e = useState(false), updatePermission = _e[0], setUpdatePermission = _e[1];
4716
- var _f = useState([]), relations = _f[0], setRelations = _f[1];
4717
- var _g = useState(1), activeTab = _g[0], setActiveTab = _g[1];
4718
- var _h = useState(""), addItemPopupType = _h[0]; _h[1];
4719
- var _j = useState(false), loading = _j[0], setLoading = _j[1];
4720
- var _k = useState([]), offers = _k[0], setOffers = _k[1];
4721
- var _l = useState([]), needs = _l[0], setNeeds = _l[1];
4732
+ var _a, _b, _c, _d, _e, _f;
4733
+ var _g = useState(false), updatePermission = _g[0], setUpdatePermission = _g[1];
4734
+ var _h = useState([]), relations = _h[0], setRelations = _h[1];
4735
+ var _j = useState(1), activeTab = _j[0], setActiveTab = _j[1];
4736
+ var _k = useState(""), addItemPopupType = _k[0]; _k[1];
4737
+ var _l = useState(false), loading = _l[0], setLoading = _l[1];
4738
+ var _m = useState([]), offers = _m[0], setOffers = _m[1];
4739
+ var _o = useState([]), needs = _o[0], setNeeds = _o[1];
4722
4740
  var location = useLocation();
4723
4741
  var items = useItems();
4724
4742
  var updateItem = useUpdateItem();
4725
- var _m = useState({}), item = _m[0], setItem = _m[1];
4743
+ var _p = useState({}), item = _p[0], setItem = _p[1];
4726
4744
  var map = useMap();
4727
4745
  useLayers();
4728
4746
  var selectPosition = useSelectPosition();
@@ -4933,34 +4951,38 @@ function OverlayItemProfile() {
4933
4951
  });
4934
4952
  }); };
4935
4953
  return (jsx(Fragment, { children: item &&
4936
- jsx(MapOverlayPage, __assign({ className: "tw-mx-4 tw-mt-4 tw-max-h-[calc(100dvh-96px)] tw-h-[calc(100dvh-96px)] md:tw-w-[calc(50%-32px)] tw-w-[calc(100%-32px)] tw-min-w-80 tw-max-w-3xl !tw-left-0 sm:!tw-left-auto tw-top-0 tw-bottom-0 tw-transition-opacity tw-duration-500 ".concat(!selectPosition ? 'tw-opacity-100 tw-pointer-events-auto' : 'tw-opacity-0 tw-pointer-events-none') }, { children: jsxs(Fragment, { children: [jsx(HeaderView, { api: (_a = item.layer) === null || _a === void 0 ? void 0 : _a.api, item: item, deleteCallback: handleDelete, editCallback: function () { return navigate("/edit-item/" + item.id); }, setPositionCallback: function () { map.closePopup(); setSelectPosition(item); navigate("/"); }, big: true, truncateSubname: false }), jsx("div", __assign({ className: 'tw-h-full' }, { children: jsxs("div", __assign({ role: "tablist", className: "tw-tabs tw-tabs-lifted tw-mt-2 tw-mb-2" }, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Info", checked: activeTab == 1 && true, onChange: function () { return updateActiveTab(1); } }), jsxs("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-280px)] tw-overflow-y-auto fade tw-pt-2 tw-pb-4 tw-mb-4 tw-overflow-x-hidden" }, { children: [((_b = item.layer) === null || _b === void 0 ? void 0 : _b.itemType.show_start_end) &&
4937
- jsx("div", __assign({ className: 'tw-max-w-xs' }, { children: jsx(StartEndView, { item: item }) })), jsx(TextView, { item: item })] })), ((_c = item.layer) === null || _c === void 0 ? void 0 : _c.itemType.offers_and_needs) &&
4938
- jsxs(Fragment, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab tw-min-w-[10em] [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Offers & Needs", checked: activeTab == 3 && true, onChange: function () { return updateActiveTab(3); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-268px)] tw-overflow-y-auto fade tw-pt-4 tw-pb-1" }, { children: jsx("div", __assign({ className: 'tw-h-full' }, { children: jsxs("div", __assign({ className: 'tw-grid tw-grid-cols-1' }, { children: [offers.length > 0 ?
4939
- jsxs("div", __assign({ className: 'tw-col-span-1' }, { children: [jsx("h3", __assign({ className: '-tw-mb-2' }, { children: "Offers" })), jsx("div", __assign({ className: 'tw-flex tw-flex-wrap tw-mb-4' }, { children: offers.map(function (o) { return jsx(TagView, { tag: o, onClick: function () {
4940
- console.log(o);
4941
- addFilterTag(o);
4942
- } }, o === null || o === void 0 ? void 0 : o.id); }) }))] })) : "", needs.length > 0 ?
4943
- jsxs("div", __assign({ className: 'tw-col-span-1' }, { children: [jsx("h3", __assign({ className: '-tw-mb-2 tw-col-span-1' }, { children: "Needs" })), jsx("div", __assign({ className: 'tw-flex tw-flex-wrap tw-mb-4' }, { children: needs.map(function (n) { return jsx(TagView, { tag: n, onClick: function () { return addFilterTag(n); } }, n === null || n === void 0 ? void 0 : n.id); }) }))] })) : ""] })) })) }))] }), ((_d = item.layer) === null || _d === void 0 ? void 0 : _d.itemType.relations) &&
4944
- jsxs(Fragment, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Relations", checked: activeTab == 7 && true, onChange: function () { return updateActiveTab(7); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-280px)] tw-overflow-y-auto tw-pt-4 tw-pb-1 -tw-mx-4 tw-overflow-x-hidden" }, { children: jsx("div", __assign({ className: 'tw-h-full' }, { children: jsxs("div", __assign({ className: 'tw-grid tw-grid-cols-1 sm:tw-grid-cols-2 md:tw-grid-cols-1 lg:tw-grid-cols-1 xl:tw-grid-cols-1 2xl:tw-grid-cols-2' }, { children: [relations && relations.map(function (i) {
4945
- return jsxs("div", __assign({ className: 'tw-cursor-pointer tw-card tw-bg-base-200 tw-border-[1px] tw-border-base-300 tw-card-body tw-shadow-xl tw-text-base-content tw-mx-4 tw-p-6 tw-mb-4', onClick: function () { return navigate('/item/' + i.id); } }, { children: [jsx(LinkedItemsHeaderView, { unlinkPermission: updatePermission, item: i, unlinkCallback: unlinkItem, loading: loading }), jsx("div", __assign({ className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade' }, { children: jsx(TextView, { truncate: true, item: i }) }))] }), i.id);
4946
- }), updatePermission && jsx(ActionButton, { collection: "items", item: item, existingRelations: relations, triggerItemSelected: linkItem, colorField: item.layer.itemColorField })] })) })) }))] })] })) }))] }) }), item.id) }));
4954
+ jsx(MapOverlayPage, __assign({ className: "tw-mx-4 tw-mt-4 tw-max-h-[calc(100dvh-96px)] tw-h-[calc(100dvh-96px)] md:tw-w-[calc(50%-32px)] tw-w-[calc(100%-32px)] tw-min-w-80 tw-max-w-3xl !tw-left-0 sm:!tw-left-auto tw-top-0 tw-bottom-0 tw-transition-opacity tw-duration-500 ".concat(!selectPosition ? 'tw-opacity-100 tw-pointer-events-auto' : 'tw-opacity-0 tw-pointer-events-none') }, { children: jsxs(Fragment, { children: [jsx(HeaderView, { api: (_a = item.layer) === null || _a === void 0 ? void 0 : _a.api, item: item, deleteCallback: handleDelete, editCallback: function () { return navigate("/edit-item/" + item.id); }, setPositionCallback: function () { map.closePopup(); setSelectPosition(item); navigate("/"); }, big: true, truncateSubname: false }), jsxs("div", __assign({ className: 'tw-h-full' }, { children: [((_b = item.layer) === null || _b === void 0 ? void 0 : _b.itemType.onepager) &&
4955
+ jsxs(Fragment, { children: [jsx(TextView, { item: item }), jsxs("div", __assign({ className: 'tw-grid tw-grid-cols-1 sm:tw-grid-cols-2 md:tw-grid-cols-1 lg:tw-grid-cols-1 xl:tw-grid-cols-1 2xl:tw-grid-cols-2' }, { children: [relations && relations.map(function (i) {
4956
+ return jsxs("div", __assign({ className: 'tw-cursor-pointer tw-card tw-bg-base-200 tw-border-[1px] tw-border-base-300 tw-card-body tw-shadow-xl tw-text-base-content tw-mx-4 tw-p-6 tw-mb-4', onClick: function () { return navigate('/item/' + i.id); } }, { children: [jsx(LinkedItemsHeaderView, { unlinkPermission: updatePermission, item: i, unlinkCallback: unlinkItem, loading: loading }), jsx("div", __assign({ className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade' }, { children: jsx(TextView, { truncate: true, item: i }) }))] }), i.id);
4957
+ }), updatePermission && jsx(ActionButton, { collection: "items", item: item, existingRelations: relations, triggerItemSelected: linkItem, colorField: item.layer.itemColorField })] }))] }), !((_c = item.layer) === null || _c === void 0 ? void 0 : _c.itemType.onepager) &&
4958
+ jsxs("div", __assign({ role: "tablist", className: "tw-tabs tw-tabs-lifted tw-mt-2 tw-mb-2" }, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Info", checked: activeTab == 1 && true, onChange: function () { return updateActiveTab(1); } }), jsxs("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-280px)] tw-overflow-y-auto fade tw-pt-2 tw-pb-4 tw-mb-4 tw-overflow-x-hidden" }, { children: [((_d = item.layer) === null || _d === void 0 ? void 0 : _d.itemType.show_start_end) &&
4959
+ jsx("div", __assign({ className: 'tw-max-w-xs' }, { children: jsx(StartEndView, { item: item }) })), jsx(TextView, { item: item })] })), ((_e = item.layer) === null || _e === void 0 ? void 0 : _e.itemType.offers_and_needs) &&
4960
+ jsxs(Fragment, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab tw-min-w-[10em] [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Offers & Needs", checked: activeTab == 3 && true, onChange: function () { return updateActiveTab(3); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-268px)] tw-overflow-y-auto fade tw-pt-4 tw-pb-1" }, { children: jsx("div", __assign({ className: 'tw-h-full' }, { children: jsxs("div", __assign({ className: 'tw-grid tw-grid-cols-1' }, { children: [offers.length > 0 ?
4961
+ jsxs("div", __assign({ className: 'tw-col-span-1' }, { children: [jsx("h3", __assign({ className: '-tw-mb-2' }, { children: "Offers" })), jsx("div", __assign({ className: 'tw-flex tw-flex-wrap tw-mb-4' }, { children: offers.map(function (o) { return jsx(TagView, { tag: o, onClick: function () {
4962
+ console.log(o);
4963
+ addFilterTag(o);
4964
+ } }, o === null || o === void 0 ? void 0 : o.id); }) }))] })) : "", needs.length > 0 ?
4965
+ jsxs("div", __assign({ className: 'tw-col-span-1' }, { children: [jsx("h3", __assign({ className: '-tw-mb-2 tw-col-span-1' }, { children: "Needs" })), jsx("div", __assign({ className: 'tw-flex tw-flex-wrap tw-mb-4' }, { children: needs.map(function (n) { return jsx(TagView, { tag: n, onClick: function () { return addFilterTag(n); } }, n === null || n === void 0 ? void 0 : n.id); }) }))] })) : ""] })) })) }))] }), ((_f = item.layer) === null || _f === void 0 ? void 0 : _f.itemType.relations) &&
4966
+ jsxs(Fragment, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Relations", checked: activeTab == 7 && true, onChange: function () { return updateActiveTab(7); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-280px)] tw-overflow-y-auto tw-pt-4 tw-pb-1 -tw-mx-4 tw-overflow-x-hidden" }, { children: jsx("div", __assign({ className: 'tw-h-full' }, { children: jsxs("div", __assign({ className: 'tw-grid tw-grid-cols-1 sm:tw-grid-cols-2 md:tw-grid-cols-1 lg:tw-grid-cols-1 xl:tw-grid-cols-1 2xl:tw-grid-cols-2' }, { children: [relations && relations.map(function (i) {
4967
+ return jsxs("div", __assign({ className: 'tw-cursor-pointer tw-card tw-bg-base-200 tw-border-[1px] tw-border-base-300 tw-card-body tw-shadow-xl tw-text-base-content tw-mx-4 tw-p-6 tw-mb-4', onClick: function () { return navigate('/item/' + i.id); } }, { children: [jsx(LinkedItemsHeaderView, { unlinkPermission: updatePermission, item: i, unlinkCallback: unlinkItem, loading: loading }), jsx("div", __assign({ className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade' }, { children: jsx(TextView, { truncate: true, item: i }) }))] }), i.id);
4968
+ }), updatePermission && jsx(ActionButton, { collection: "items", item: item, existingRelations: relations, triggerItemSelected: linkItem, colorField: item.layer.itemColorField })] })) })) }))] })] }))] }))] }) }), item.id) }));
4947
4969
  }
4948
4970
 
4949
4971
  function OverlayItemProfileSettings() {
4950
4972
  var _this = this;
4951
- var _a, _b, _c, _d, _e, _f;
4952
- var _g = useState(""), id = _g[0], setId = _g[1];
4953
- var _h = useState(""), name = _h[0], setName = _h[1];
4954
- var _j = useState(""), subname = _j[0], setSubname = _j[1];
4955
- var _k = useState(""), text = _k[0], setText = _k[1];
4956
- var _l = useState(""), image = _l[0], setImage = _l[1];
4957
- var _m = useState(""), color = _m[0], setColor = _m[1];
4958
- var _o = useState([]), offers = _o[0], setOffers = _o[1];
4959
- var _p = useState([]), needs = _p[0], setNeeds = _p[1];
4960
- var _q = useState([]), relations = _q[0], setRelations = _q[1];
4961
- var _r = useState(false), updatePermission = _r[0], setUpdatePermission = _r[1];
4962
- var _s = useState(1), activeTab = _s[0], setActiveTab = _s[1];
4963
- var _t = useState(false), loading = _t[0], setLoading = _t[1];
4973
+ var _a, _b, _c, _d, _e, _f, _g, _h;
4974
+ var _j = useState(""), id = _j[0], setId = _j[1];
4975
+ var _k = useState(""), name = _k[0], setName = _k[1];
4976
+ var _l = useState(""), subname = _l[0], setSubname = _l[1];
4977
+ var _m = useState(""), text = _m[0], setText = _m[1];
4978
+ var _o = useState(""), image = _o[0], setImage = _o[1];
4979
+ var _p = useState(""), color = _p[0], setColor = _p[1];
4980
+ var _q = useState([]), offers = _q[0], setOffers = _q[1];
4981
+ var _r = useState([]), needs = _r[0], setNeeds = _r[1];
4982
+ var _s = useState([]), relations = _s[0], setRelations = _s[1];
4983
+ var _t = useState(false), updatePermission = _t[0], setUpdatePermission = _t[1];
4984
+ var _u = useState(1), activeTab = _u[0], setActiveTab = _u[1];
4985
+ var _v = useState(false), loading = _v[0], setLoading = _v[1];
4964
4986
  var user = useAuth().user;
4965
4987
  var updateItem = useUpdateItem();
4966
4988
  var addItem = useAddItem();
@@ -4972,7 +4994,7 @@ function OverlayItemProfileSettings() {
4972
4994
  var hasUserPermission = useHasUserPermission();
4973
4995
  var getItemTags = useGetItemTags();
4974
4996
  var items = useItems();
4975
- var _u = useState({}), item = _u[0], setItem = _u[1];
4997
+ var _w = useState({}), item = _w[0], setItem = _w[1];
4976
4998
  useEffect(function () {
4977
4999
  item && hasUserPermission("items", "update", item) && setUpdatePermission(true);
4978
5000
  }, [item]);
@@ -5167,11 +5189,16 @@ function OverlayItemProfileSettings() {
5167
5189
  }
5168
5190
  });
5169
5191
  }); };
5170
- return (jsx(Fragment, { children: jsx(MapOverlayPage, __assign({ backdrop: true, className: 'tw-mx-4 tw-mt-4 tw-mb-12 tw-overflow-x-hidden tw-max-h-[calc(100dvh-96px)] !tw-h-[calc(100dvh-96px)] tw-w-[calc(100%-32px)] md:tw-w-[calc(50%-32px)] tw-max-w-3xl !tw-left-auto tw-top-0 tw-bottom-0' }, { children: jsxs("div", __assign({ className: 'tw-flex tw-flex-col tw-h-full' }, { children: [jsxs("div", __assign({ className: "tw-flex" }, { children: [jsx(AvatarWidget, { avatar: image, setAvatar: setImage }), jsx(ColorPicker, { color: color, onChange: setColor, className: "-tw-left-6 tw-top-14 -tw-mr-6" }), jsxs("div", __assign({ className: 'tw-grow tw-mr-4' }, { children: [jsx(TextInput, { placeholder: "Name", defaultValue: (item === null || item === void 0 ? void 0 : item.name) ? item.name : "", updateFormValue: function (v) { return setName(v); }, containerStyle: 'tw-grow tw-input-md' }), jsx(TextInput, { placeholder: "Subtitle", defaultValue: (item === null || item === void 0 ? void 0 : item.subname) ? item.subname : "", updateFormValue: function (v) { return setSubname(v); }, containerStyle: 'tw-grow tw-input-sm tw-px-4 tw-mt-1' })] }))] })), jsxs("div", __assign({ role: "tablist", className: "tw-tabs tw-tabs-lifted tw-mt-4" }, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Info", checked: activeTab == 1 && true, onChange: function () { return updateActiveTab(1); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-border-[var(--fallback-bc,oklch(var(--bc)/0.2))] tw-rounded-box tw-h-[calc(100dvh-332px)] tw-min-h-56 tw-border-none" }, { children: jsx(TextAreaInput, { placeholder: "My Vision...", defaultValue: (item === null || item === void 0 ? void 0 : item.text) ? item.text : "", updateFormValue: function (v) { console.log(v); setText(v); }, containerStyle: 'tw-h-full', inputStyle: 'tw-h-full tw-border-t-0 tw-rounded-tl-none' }) })), ((_a = item.layer) === null || _a === void 0 ? void 0 : _a.itemType.offers_and_needs) &&
5171
- jsxs(Fragment, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab tw-min-w-[10em] [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Offers & Needs", checked: activeTab == 3 && true, onChange: function () { return updateActiveTab(3); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-border-[var(--fallback-bc,oklch(var(--bc)/0.2))] tw-rounded-box tw-h-[calc(100dvh-332px)] tw-min-h-56 tw-border-none" }, { children: jsxs("div", __assign({ className: 'tw-h-full' }, { children: [jsx("div", __assign({ className: 'tw-w-full tw-h-[calc(50%-0.75em)] tw-mb-4' }, { children: jsx(TagsWidget, { defaultTags: offers, onUpdate: function (v) { return setOffers(v); }, placeholder: "enter your offers", containerStyle: 'tw-bg-transparent tw-w-full tw-h-full tw-mt-3 tw-text-xs tw-h-[calc(100%-1rem)] tw-min-h-[5em] tw-pb-2 tw-overflow-auto' }) })), jsx("div", __assign({ className: 'tw-w-full tw-h-[calc(50%-0.75em)] ' }, { children: jsx(TagsWidget, { defaultTags: needs, onUpdate: function (v) { return setNeeds(v); }, placeholder: "enter your needs", containerStyle: 'tw-bg-transparent tw-w-full tw-h-full tw-mt-3 tw-text-xs tw-h-[calc(100%-1rem)] tw-min-h-[5em] tw-pb-2 tw-overflow-auto' }) }))] })) }))] }), ((_b = item.layer) === null || _b === void 0 ? void 0 : _b.itemType.relations) &&
5172
- jsxs(Fragment, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Relations", checked: activeTab == 7 && true, onChange: function () { return updateActiveTab(7); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-332px)] tw-overflow-y-auto tw-pt-4 tw-pb-1 -tw-mx-4 tw-overflow-x-hidden" }, { children: jsx("div", __assign({ className: 'tw-h-full' }, { children: jsxs("div", __assign({ className: 'tw-grid tw-grid-cols-1 sm:tw-grid-cols-2 md:tw-grid-cols-1 lg:tw-grid-cols-1 xl:tw-grid-cols-1 2xl:tw-grid-cols-2' }, { children: [relations && relations.map(function (i) {
5173
- return jsxs("div", __assign({ className: 'tw-cursor-pointer tw-card tw-bg-base-200 tw-border-[1px] tw-border-base-300 tw-card-body tw-shadow-xl tw-text-base-content tw-mx-4 tw-p-6 tw-mb-4', onClick: function () { return navigate('/item/' + i.id); } }, { children: [jsx(LinkedItemsHeaderView, { unlinkPermission: updatePermission, item: i, unlinkCallback: unlinkItem, loading: loading }), jsx("div", __assign({ className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade' }, { children: jsx(TextView, { truncate: true, item: i }) }))] }), i.id);
5174
- }), updatePermission && jsx(ActionButton, { customStyle: "!tw-bottom-20", collection: "items", item: item, existingRelations: relations, triggerItemSelected: linkItem, colorField: item.layer.itemColorField })] })) })) }))] })] })), jsx("div", __assign({ className: "tw-mt-4 tw-mb-4" }, { children: jsx("button", __assign({ className: loading ? " tw-loading tw-btn tw-float-right" : "tw-btn tw-float-right", onClick: function () { return onUpdateItem(); }, style: { backgroundColor: "".concat(((_c = item.layer) === null || _c === void 0 ? void 0 : _c.itemColorField) && getValue(item, (_d = item.layer) === null || _d === void 0 ? void 0 : _d.itemColorField) ? getValue(item, (_e = item.layer) === null || _e === void 0 ? void 0 : _e.itemColorField) : (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : (_f = item === null || item === void 0 ? void 0 : item.layer) === null || _f === void 0 ? void 0 : _f.markerDefaultColor)), color: "#fff" } }, { children: "Update" })) }))] })) })) }));
5192
+ useEffect(function () {
5193
+ console.log(item);
5194
+ }, [item]);
5195
+ return (jsx(Fragment, { children: jsx(MapOverlayPage, __assign({ backdrop: true, className: 'tw-mx-4 tw-mt-4 tw-mb-12 tw-overflow-x-hidden tw-max-h-[calc(100dvh-96px)] !tw-h-[calc(100dvh-96px)] tw-w-[calc(100%-32px)] md:tw-w-[calc(50%-32px)] tw-max-w-3xl !tw-left-auto tw-top-0 tw-bottom-0' }, { children: jsxs("div", __assign({ className: 'tw-flex tw-flex-col tw-h-full' }, { children: [jsxs("div", __assign({ className: "tw-flex" }, { children: [jsx(AvatarWidget, { avatar: image, setAvatar: setImage }), jsx(ColorPicker, { color: color, onChange: setColor, className: "-tw-left-6 tw-top-14 -tw-mr-6" }), jsxs("div", __assign({ className: 'tw-grow tw-mr-4' }, { children: [jsx(TextInput, { placeholder: "Name", defaultValue: (item === null || item === void 0 ? void 0 : item.name) ? item.name : "", updateFormValue: function (v) { return setName(v); }, containerStyle: 'tw-grow tw-input-md' }), jsx(TextInput, { placeholder: "Subtitle", defaultValue: (item === null || item === void 0 ? void 0 : item.subname) ? item.subname : "", updateFormValue: function (v) { return setSubname(v); }, containerStyle: 'tw-grow tw-input-sm tw-px-4 tw-mt-1' })] }))] })), ((_a = item.layer) === null || _a === void 0 ? void 0 : _a.itemType.onepager) &&
5196
+ jsx(TextAreaInput, { placeholder: "My Visino...", defaultValue: (item === null || item === void 0 ? void 0 : item.text) ? item.text : "", updateFormValue: function (v) { console.log(v); setText(v); }, containerStyle: 'tw-h-full', inputStyle: 'tw-h-full tw-border-t-0 tw-rounded-tl-none' }), !((_b = item.layer) === null || _b === void 0 ? void 0 : _b.itemType.onepager) &&
5197
+ jsxs("div", __assign({ role: "tablist", className: "tw-tabs tw-tabs-lifted tw-mt-4" }, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Info", checked: activeTab == 1 && true, onChange: function () { return updateActiveTab(1); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-border-[var(--fallback-bc,oklch(var(--bc)/0.2))] tw-rounded-box tw-h-[calc(100dvh-332px)] tw-min-h-56 tw-border-none" }, { children: jsx(TextAreaInput, { placeholder: "My Visino...", defaultValue: (item === null || item === void 0 ? void 0 : item.text) ? item.text : "", updateFormValue: function (v) { console.log(v); setText(v); }, containerStyle: 'tw-h-full', inputStyle: 'tw-h-full tw-border-t-0 tw-rounded-tl-none' }) })), ((_c = item.layer) === null || _c === void 0 ? void 0 : _c.itemType.offers_and_needs) &&
5198
+ jsxs(Fragment, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab tw-min-w-[10em] [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Offers & Needs", checked: activeTab == 3 && true, onChange: function () { return updateActiveTab(3); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-border-[var(--fallback-bc,oklch(var(--bc)/0.2))] tw-rounded-box tw-h-[calc(100dvh-332px)] tw-min-h-56 tw-border-none" }, { children: jsxs("div", __assign({ className: 'tw-h-full' }, { children: [jsx("div", __assign({ className: 'tw-w-full tw-h-[calc(50%-0.75em)] tw-mb-4' }, { children: jsx(TagsWidget, { defaultTags: offers, onUpdate: function (v) { return setOffers(v); }, placeholder: "enter your offers", containerStyle: 'tw-bg-transparent tw-w-full tw-h-full tw-mt-3 tw-text-xs tw-h-[calc(100%-1rem)] tw-min-h-[5em] tw-pb-2 tw-overflow-auto' }) })), jsx("div", __assign({ className: 'tw-w-full tw-h-[calc(50%-0.75em)] ' }, { children: jsx(TagsWidget, { defaultTags: needs, onUpdate: function (v) { return setNeeds(v); }, placeholder: "enter your needs", containerStyle: 'tw-bg-transparent tw-w-full tw-h-full tw-mt-3 tw-text-xs tw-h-[calc(100%-1rem)] tw-min-h-[5em] tw-pb-2 tw-overflow-auto' }) }))] })) }))] }), ((_d = item.layer) === null || _d === void 0 ? void 0 : _d.itemType.relations) &&
5199
+ jsxs(Fragment, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Relations", checked: activeTab == 7 && true, onChange: function () { return updateActiveTab(7); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-332px)] tw-overflow-y-auto tw-pt-4 tw-pb-1 -tw-mx-4 tw-overflow-x-hidden" }, { children: jsx("div", __assign({ className: 'tw-h-full' }, { children: jsxs("div", __assign({ className: 'tw-grid tw-grid-cols-1 sm:tw-grid-cols-2 md:tw-grid-cols-1 lg:tw-grid-cols-1 xl:tw-grid-cols-1 2xl:tw-grid-cols-2' }, { children: [relations && relations.map(function (i) {
5200
+ return jsxs("div", __assign({ className: 'tw-cursor-pointer tw-card tw-bg-base-200 tw-border-[1px] tw-border-base-300 tw-card-body tw-shadow-xl tw-text-base-content tw-mx-4 tw-p-6 tw-mb-4', onClick: function () { return navigate('/item/' + i.id); } }, { children: [jsx(LinkedItemsHeaderView, { unlinkPermission: updatePermission, item: i, unlinkCallback: unlinkItem, loading: loading }), jsx("div", __assign({ className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade' }, { children: jsx(TextView, { truncate: true, item: i }) }))] }), i.id);
5201
+ }), updatePermission && jsx(ActionButton, { customStyle: "!tw-bottom-20", collection: "items", item: item, existingRelations: relations, triggerItemSelected: linkItem, colorField: item.layer.itemColorField })] })) })) }))] })] })), jsx("div", __assign({ className: "tw-mt-4 tw-mb-4" }, { children: jsx("button", __assign({ className: loading ? " tw-loading tw-btn tw-float-right" : "tw-btn tw-float-right", onClick: function () { return onUpdateItem(); }, style: { backgroundColor: "".concat(((_e = item.layer) === null || _e === void 0 ? void 0 : _e.itemColorField) && getValue(item, (_f = item.layer) === null || _f === void 0 ? void 0 : _f.itemColorField) ? getValue(item, (_g = item.layer) === null || _g === void 0 ? void 0 : _g.itemColorField) : (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : (_h = item === null || item === void 0 ? void 0 : item.layer) === null || _h === void 0 ? void 0 : _h.markerDefaultColor)), color: "#fff" } }, { children: "Update" })) }))] })) })) }));
5175
5202
  }
5176
5203
 
5177
5204
  function Modal(_a) {