utopia-ui 3.0.0-alpha.148 → 3.0.0-alpha.149

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.
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare type route = {
3
2
  path: string;
4
3
  icon: JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare function SidebarSubmenu({ submenu, name, icon }: {
3
2
  path: string;
4
3
  icon: JSX.Element;
@@ -1,4 +1,6 @@
1
- export declare function PlusButton({ triggerAction, color, collection }: {
1
+ import { LayerProps } from "../../types";
2
+ export declare function PlusButton({ layer, triggerAction, color, collection }: {
3
+ layer?: LayerProps;
2
4
  triggerAction: any;
3
5
  color: string;
4
6
  collection?: string;
package/dist/index.js CHANGED
@@ -509,9 +509,9 @@ function getValue(obj, path) {
509
509
  }
510
510
 
511
511
  function PlusButton(_a) {
512
- var triggerAction = _a.triggerAction, color = _a.color, _b = _a.collection, collection = _b === void 0 ? "items" : _b;
512
+ var layer = _a.layer, triggerAction = _a.triggerAction, color = _a.color, _b = _a.collection, collection = _b === void 0 ? "items" : _b;
513
513
  var hasUserPermission = useHasUserPermission();
514
- return (jsx(Fragment, { children: hasUserPermission(collection, "create") &&
514
+ return (jsx(Fragment, { children: hasUserPermission(collection, "create", undefined, layer) &&
515
515
  jsx("div", __assign({ className: "tw-dropdown tw-dropdown-top tw-dropdown-end tw-dropdown-hover tw-z-3000 tw-absolute tw-right-4 tw-bottom-4" }, { children: jsx("button", __assign({ tabIndex: 0, className: "tw-z-500 tw-btn tw-btn-circle tw-shadow", onClick: function () { triggerAction(); }, style: { backgroundColor: color, color: "#fff" } }, { children: jsx("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", className: "tw-w-5 tw-h-5" }, { children: jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4.5v15m7.5-7.5h-15" }) })) })) })) }));
516
516
  }
517
517
 
@@ -1199,7 +1199,7 @@ var OverlayItemsIndexPage = function (_a) {
1199
1199
  if (success) {
1200
1200
  toast.success("New item created");
1201
1201
  }
1202
- addItem(__assign(__assign({}, formItem), { user_created: user, id: uuid, layer: layer }));
1202
+ addItem(__assign(__assign({}, formItem), { user_created: user, id: uuid, layer: layer, public_edit: !user ? true : false }));
1203
1203
  setLoading(false);
1204
1204
  setAddItemPopupType("");
1205
1205
  return [2 /*return*/];
@@ -1250,7 +1250,8 @@ var OverlayItemsIndexPage = function (_a) {
1250
1250
  }), addItemPopupType == "place" ?
1251
1251
  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 () {
1252
1252
  setAddItemPopupType("");
1253
- } }, { children: jsx("p", __assign({ className: 'tw-text-center ' }, { children: "\u2715" })) })), jsx(TextInput, { type: "text", placeholder: "Name", dataField: "name", defaultValue: "", inputStyle: '' }), jsx(TextAreaInput, { placeholder: "Text", dataField: "text", defaultValue: "", inputStyle: 'tw-h-40 tw-mt-5' }), jsx("div", __assign({ className: 'tw-flex tw-justify-center' }, { children: jsx("button", __assign({ className: loading ? 'tw-btn tw-btn-disabled tw-mt-5 tw-place-self-center' : 'tw-btn tw-mt-5 tw-place-self-center', type: 'submit' }, { children: loading ? jsx("span", { className: "tw-loading tw-loading-spinner" }) : 'Save' })) }))] })) })) : jsx(Fragment, {})] })), children] })), plusButton && jsx(PlusButton, { triggerAction: function () { setAddItemPopupType("place"); scroll(); }, color: '#777', collection: 'items' })] }));
1253
+ } }, { 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) &&
1254
+ jsx(PopupStartEndInput, {}), jsx(TextAreaInput, { placeholder: "Text", dataField: "text", defaultValue: "", inputStyle: 'tw-h-40 tw-mt-5' }), jsx("div", __assign({ className: 'tw-flex tw-justify-center' }, { children: jsx("button", __assign({ className: loading ? 'tw-btn tw-btn-disabled tw-mt-5 tw-place-self-center' : 'tw-btn tw-mt-5 tw-place-self-center', type: 'submit' }, { children: loading ? jsx("span", { className: "tw-loading tw-loading-spinner" }) : 'Save' })) }))] })) })) : jsx(Fragment, {})] })), children] })), plusButton && jsx(PlusButton, { layer: layer, triggerAction: function () { setAddItemPopupType("place"); scroll(); }, color: '#777', collection: 'items' })] }));
1254
1255
  };
1255
1256
 
1256
1257
  function LoginPage() {