utopia-ui 3.0.0-alpha.160 → 3.0.0-alpha.161
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 +8 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -769,7 +769,7 @@ var DialogModal = function (_a) {
|
|
769
769
|
document.body.classList.remove("modal-open");
|
770
770
|
}
|
771
771
|
}, [isOpened]);
|
772
|
-
return (jsx("dialog", __assign({ className: "".concat(className ? className : "", " tw-card tw-shadow-xl tw-absolute tw-right-0 tw-top-0 tw-bottom-0 tw-left-0 tw-m-auto tw-transition-opacity tw-duration-300 tw-p-4 tw-
|
772
|
+
return (jsx("dialog", __assign({ className: "".concat(className ? className : "", " tw-card tw-shadow-xl tw-absolute tw-right-0 tw-top-0 tw-bottom-0 tw-left-0 tw-m-auto tw-transition-opacity tw-duration-300 tw-p-4 tw-max-w-xl tw-bg-base-100"), ref: ref, onCancel: onClose, onClick: function (e) {
|
773
773
|
return ref.current && !isClickInsideRectangle(e, ref.current) && closeOnClickOutside && onClose();
|
774
774
|
} }, { children: jsxs("div", __assign({ className: "tw-card-body tw-p-2" }, { children: [jsx("h2", __assign({ className: 'tw-text-2xl tw-font-semibold tw-mb-2 tw-text-center' }, { children: title })), children, showCloseButton && jsx("button", __assign({ className: "tw-btn tw-btn-sm tw-btn-circle tw-btn-ghost tw-absolute tw-right-2 tw-top-2", onClick: onClose }, { children: "\u2715" }))] })) })));
|
775
775
|
};
|
@@ -3895,11 +3895,9 @@ var PopupButton = function (_a) {
|
|
3895
3895
|
};
|
3896
3896
|
|
3897
3897
|
function NavBar(_a) {
|
3898
|
-
var _this = this;
|
3899
3898
|
var appName = _a.appName;
|
3900
|
-
var _b = useAuth(), isAuthenticated = _b.isAuthenticated, user = _b.user, logout = _b.logout
|
3901
|
-
var _c = useState(
|
3902
|
-
var _d = useState({}), userProfile = _d[0], setUserProfile = _d[1];
|
3899
|
+
var _b = useAuth(), isAuthenticated = _b.isAuthenticated, user = _b.user, logout = _b.logout;
|
3900
|
+
var _c = useState({}), userProfile = _c[0], setUserProfile = _c[1];
|
3903
3901
|
var items = useItems();
|
3904
3902
|
useEffect(function () {
|
3905
3903
|
var profile = user && items.find(function (i) { var _a, _b; return (((_a = i.user_created) === null || _a === void 0 ? void 0 : _a.id) === user.id) && ((_b = i.layer) === null || _b === void 0 ? void 0 : _b.itemType.name) === "user"; });
|
@@ -3908,42 +3906,10 @@ function NavBar(_a) {
|
|
3908
3906
|
useEffect(function () {
|
3909
3907
|
}, [userProfile]);
|
3910
3908
|
var nameRef = useRef(null);
|
3911
|
-
var
|
3909
|
+
var _d = useState(0), nameWidth = _d[0], setNameWidth = _d[1];
|
3912
3910
|
useEffect(function () {
|
3913
3911
|
nameRef && setNameWidth(nameRef.current.scrollWidth);
|
3914
3912
|
}, [nameRef, appName]);
|
3915
|
-
var _f = useState(""), email = _f[0], setEmail = _f[1];
|
3916
|
-
var _g = useState(""), password = _g[0], setPassword = _g[1];
|
3917
|
-
var navigate = useNavigate();
|
3918
|
-
var onLogin = function () { return __awaiter(_this, void 0, void 0, function () {
|
3919
|
-
return __generator(this, function (_a) {
|
3920
|
-
switch (_a.label) {
|
3921
|
-
case 0: return [4 /*yield*/, toast.promise(login({ email: email, password: password }), {
|
3922
|
-
success: {
|
3923
|
-
render: function (_a) {
|
3924
|
-
var data = _a.data;
|
3925
|
-
navigate("/");
|
3926
|
-
return "Hi ".concat(data === null || data === void 0 ? void 0 : data.first_name);
|
3927
|
-
},
|
3928
|
-
// other options
|
3929
|
-
icon: "✌️",
|
3930
|
-
},
|
3931
|
-
error: {
|
3932
|
-
render: function (_a) {
|
3933
|
-
var data = _a.data;
|
3934
|
-
return "".concat(data);
|
3935
|
-
},
|
3936
|
-
autoClose: 10000,
|
3937
|
-
},
|
3938
|
-
pending: 'logging in ...',
|
3939
|
-
})];
|
3940
|
-
case 1:
|
3941
|
-
_a.sent();
|
3942
|
-
setLoginOpen(false);
|
3943
|
-
return [2 /*return*/];
|
3944
|
-
}
|
3945
|
-
});
|
3946
|
-
}); };
|
3947
3913
|
var onLogout = function () {
|
3948
3914
|
toast.promise(logout(), {
|
3949
3915
|
success: {
|
@@ -3962,10 +3928,10 @@ function NavBar(_a) {
|
|
3962
3928
|
pending: 'logging out ..'
|
3963
3929
|
});
|
3964
3930
|
};
|
3965
|
-
return (
|
3966
|
-
|
3967
|
-
|
3968
|
-
|
3931
|
+
return (jsx(Fragment, { children: jsxs("div", __assign({ className: "tw-navbar tw-bg-base-100 tw-z-[10000] tw-shadow-xl tw-relative" }, { children: [jsx("button", __assign({ className: "tw-btn tw-btn-square tw-btn-ghost", "data-te-sidenav-toggle-ref": true, "data-te-target": "#sidenav", "aria-controls": "#sidenav", "aria-haspopup": "true" }, { children: jsx("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", className: "tw-inline-block tw-w-5 tw-h-5 tw-stroke-current" }, { children: jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M4 6h16M4 12h16M4 18h16" }) })) })), jsx("div", __assign({ className: "tw-flex-1 tw-mr-2" }, { children: jsxs("div", __assign({ className: "tw-flex-1 tw-truncate tw-grid tw-grid-flow-col", style: { maxWidth: nameWidth + 60 } }, { children: [jsx(Link, __assign({ className: "tw-btn tw-btn-ghost tw-px-2 tw-normal-case tw-text-xl tw-flex-1 tw-truncate", to: "/" }, { children: jsx("h1", __assign({ ref: nameRef, className: "tw-truncate" }, { children: appName })) })), jsx("button", __assign({ className: "tw-btn tw-px-2 tw-btn-ghost", onClick: function () { return window.my_modal_3.showModal(); } }, { children: jsx(QuestionMarkIcon, { className: "tw-h-5 tw-w-5" }) }))] })) })), isAuthenticated ?
|
3932
|
+
jsxs("div", __assign({ className: "tw-flex-none" }, { children: [(userProfile === null || userProfile === void 0 ? void 0 : userProfile.image) ? jsx("div", __assign({ className: "tw-avatar" }, { children: jsx("div", __assign({ className: "tw-w-10 tw-rounded-full" }, { children: jsx("img", { src: "https://api.utopia-lab.org/assets/" + userProfile.image }) })) })) : jsx(Fragment, {}), jsx("div", __assign({ className: 'tw-ml-2 tw-mr-2' }, { children: userProfile.name || (user === null || user === void 0 ? void 0 : user.first_name) })), jsxs("div", __assign({ className: "tw-dropdown tw-dropdown-end" }, { children: [jsx("label", __assign({ tabIndex: 0, className: "tw-btn tw-btn-ghost tw-btn-square" }, { children: jsx("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", className: "tw-h-5 tw-w-5", viewBox: "0 0 20 20", fill: "currentColor" }, { children: jsx("path", { d: "M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z" }) })) })), jsxs("ul", __assign({ tabIndex: 0, className: "tw-menu tw-menu-compact tw-dropdown-content tw-mt-3 tw-p-2 tw-shadow tw-bg-base-100 tw-rounded-box tw-w-52 !tw-z-[10000]" }, { children: [jsx("li", { children: jsx(Link, __assign({ to: "".concat(userProfile.id && "/edit-item/" + userProfile.id) }, { children: "Profile" })) }), jsx("li", { children: jsx(Link, __assign({ to: "/user-settings" }, { children: "Settings" })) }), jsx("li", { children: jsx("a", __assign({ onClick: function () { onLogout(); } }, { children: "Logout" })) })] }))] }))] }))
|
3933
|
+
:
|
3934
|
+
jsxs("div", { children: [jsxs("div", __assign({ className: "tw-hidden md:tw-flex" }, { children: [jsx(Link, __assign({ to: "/login" }, { children: jsx("div", __assign({ className: "tw-btn tw-btn-ghost tw-mr-2" }, { children: "Login" })) })), jsx(Link, __assign({ to: "/signup" }, { children: jsx("div", __assign({ className: "tw-btn tw-btn-ghost tw-mr-2" }, { children: "Sign Up" })) }))] })), jsxs("div", __assign({ className: "tw-dropdown tw-dropdown-end" }, { children: [jsx("label", __assign({ tabIndex: 1, className: "tw-btn tw-btn-ghost md:tw-hidden" }, { children: jsx("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", className: "tw-h-5 tw-w-5", viewBox: "0 0 20 20", fill: "currentColor" }, { children: jsx("path", { d: "M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z" }) })) })), jsxs("ul", __assign({ tabIndex: 1, className: "tw-menu tw-dropdown-content tw-mt-3 tw-p-2 tw-shadow tw-bg-base-100 tw-rounded-box tw-w-52 !tw-z-[10000]" }, { children: [jsx("li", { children: jsx(Link, __assign({ to: "/login" }, { children: "Login" })) }), jsx("li", { children: jsx(Link, __assign({ to: "/signup" }, { children: "Sign Up" })) })] }))] }))] })] })) }));
|
3969
3935
|
}
|
3970
3936
|
|
3971
3937
|
var SetAssetsApi = function (_a) {
|