utopia-ui 3.0.0-alpha.156 → 3.0.0-alpha.157
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 +22 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -4904,19 +4904,19 @@ function OverlayItemProfile() {
|
|
4904
4904
|
|
4905
4905
|
function OverlayItemProfileSettings() {
|
4906
4906
|
var _this = this;
|
4907
|
-
var _a, _b, _c, _d, _e, _f
|
4908
|
-
var
|
4909
|
-
var
|
4910
|
-
var
|
4911
|
-
var
|
4912
|
-
var
|
4913
|
-
var
|
4914
|
-
var
|
4915
|
-
var
|
4916
|
-
var
|
4917
|
-
var
|
4918
|
-
var
|
4919
|
-
var
|
4907
|
+
var _a, _b, _c, _d, _e, _f;
|
4908
|
+
var _g = useState(""), id = _g[0], setId = _g[1];
|
4909
|
+
var _h = useState(""), name = _h[0], setName = _h[1];
|
4910
|
+
var _j = useState(""), subname = _j[0], setSubname = _j[1];
|
4911
|
+
var _k = useState(""), text = _k[0], setText = _k[1];
|
4912
|
+
var _l = useState(""), image = _l[0], setImage = _l[1];
|
4913
|
+
var _m = useState(""), color = _m[0], setColor = _m[1];
|
4914
|
+
var _o = useState([]), offers = _o[0], setOffers = _o[1];
|
4915
|
+
var _p = useState([]), needs = _p[0], setNeeds = _p[1];
|
4916
|
+
var _q = useState([]), relations = _q[0], setRelations = _q[1];
|
4917
|
+
var _r = useState(false), updatePermission = _r[0], setUpdatePermission = _r[1];
|
4918
|
+
var _s = useState(1), activeTab = _s[0], setActiveTab = _s[1];
|
4919
|
+
var _t = useState(false), loading = _t[0], setLoading = _t[1];
|
4920
4920
|
var user = useAuth().user;
|
4921
4921
|
var updateItem = useUpdateItem();
|
4922
4922
|
var addItem = useAddItem();
|
@@ -4928,7 +4928,7 @@ function OverlayItemProfileSettings() {
|
|
4928
4928
|
var hasUserPermission = useHasUserPermission();
|
4929
4929
|
var getItemTags = useGetItemTags();
|
4930
4930
|
var items = useItems();
|
4931
|
-
var
|
4931
|
+
var _u = useState({}), item = _u[0], setItem = _u[1];
|
4932
4932
|
useEffect(function () {
|
4933
4933
|
item && item.user_created && hasUserPermission("items", "update", item) && setUpdatePermission(true);
|
4934
4934
|
}, [item]);
|
@@ -4953,11 +4953,11 @@ function OverlayItemProfileSettings() {
|
|
4953
4953
|
urlTab ? setActiveTab(Number(urlTab)) : setActiveTab(1);
|
4954
4954
|
}, [location]);
|
4955
4955
|
useEffect(function () {
|
4956
|
-
var _a, _b, _c, _d, _e, _f;
|
4956
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
4957
4957
|
if ((_a = item.layer) === null || _a === void 0 ? void 0 : _a.itemColorField)
|
4958
4958
|
setColor(getValue(item, (_b = item.layer) === null || _b === void 0 ? void 0 : _b.itemColorField));
|
4959
4959
|
else
|
4960
|
-
setColor(((_c = item.layer) === null || _c === void 0 ? void 0 : _c.
|
4960
|
+
setColor(((_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));
|
4961
4961
|
setId((item === null || item === void 0 ? void 0 : item.id) ? item.id : "");
|
4962
4962
|
setName((item === null || item === void 0 ? void 0 : item.name) ? item.name : "");
|
4963
4963
|
setSubname((item === null || item === void 0 ? void 0 : item.subname) ? item.subname : "");
|
@@ -4966,15 +4966,15 @@ function OverlayItemProfileSettings() {
|
|
4966
4966
|
setOffers([]);
|
4967
4967
|
setNeeds([]);
|
4968
4968
|
setRelations([]);
|
4969
|
-
(
|
4969
|
+
(_g = item === null || item === void 0 ? void 0 : item.offers) === null || _g === void 0 ? void 0 : _g.map(function (o) {
|
4970
4970
|
var offer = tags === null || tags === void 0 ? void 0 : tags.find(function (t) { return t.id === o.tags_id; });
|
4971
4971
|
offer && setOffers(function (current) { return __spreadArray(__spreadArray([], current, true), [offer], false); });
|
4972
4972
|
});
|
4973
|
-
(
|
4973
|
+
(_h = item === null || item === void 0 ? void 0 : item.needs) === null || _h === void 0 ? void 0 : _h.map(function (o) {
|
4974
4974
|
var need = tags === null || tags === void 0 ? void 0 : tags.find(function (t) { return t.id === o.tags_id; });
|
4975
4975
|
need && setNeeds(function (current) { return __spreadArray(__spreadArray([], current, true), [need], false); });
|
4976
4976
|
});
|
4977
|
-
(
|
4977
|
+
(_j = item.relations) === null || _j === void 0 ? void 0 : _j.map(function (r) {
|
4978
4978
|
var item = items.find(function (i) { return i.id == r.related_items_id; });
|
4979
4979
|
item && setRelations(function (current) { return __spreadArray(__spreadArray([], current, true), [item], false); });
|
4980
4980
|
});
|
@@ -5126,11 +5126,11 @@ function OverlayItemProfileSettings() {
|
|
5126
5126
|
}
|
5127
5127
|
});
|
5128
5128
|
}); };
|
5129
|
-
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:
|
5130
|
-
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' }) }))] })) }))] }), ((
|
5129
|
+
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) &&
|
5130
|
+
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) &&
|
5131
5131
|
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) {
|
5132
5132
|
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);
|
5133
|
-
}), 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(((
|
5133
|
+
}), 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" })) }))] })) })) }));
|
5134
5134
|
}
|
5135
5135
|
|
5136
5136
|
function Modal(_a) {
|