utopia-ui 3.0.0-alpha.226 → 3.0.0-alpha.228

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 +1,4 @@
1
- export declare const SimpleForm: (item: any, setState: any) => import("react/jsx-runtime").JSX.Element;
1
+ export declare const SimpleForm: ({ state, setState }: {
2
+ state: any;
3
+ setState: any;
4
+ }) => import("react/jsx-runtime").JSX.Element;
package/dist/index.js CHANGED
@@ -2542,6 +2542,9 @@ var OverlayItemsIndexPage = function (_a) {
2542
2542
  useEffect(function () {
2543
2543
  scroll();
2544
2544
  }, [addItemPopupType]);
2545
+ useEffect(function () {
2546
+ setAddItemPopupType("");
2547
+ }, [layerName]);
2545
2548
  var tags = useTags();
2546
2549
  var addTag = useAddTag();
2547
2550
  var user = useAuth().user;
@@ -2626,14 +2629,14 @@ var OverlayItemsIndexPage = function (_a) {
2626
2629
  }
2627
2630
  });
2628
2631
  }); };
2629
- 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-columns-1 md:tw-columns-2 lg:tw-columns-3 2xl:tw-columns-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) {
2632
+ 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, {})] })) })), jsx("div", __assign({ className: "tw-overflow-scroll fade tw-flex-1" }, { children: jsxs("div", __assign({ className: 'tw-columns-1 md:tw-columns-2 lg:tw-columns-3 2xl:tw-columns-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) {
2630
2633
  return filterTags.length == 0 ? item : filterTags.every(function (tag) { return getItemTags(item).some(function (filterTag) { return filterTag.name.toLocaleLowerCase() === tag.name.toLocaleLowerCase(); }); });
2631
2634
  })) === null || _b === void 0 ? void 0 : _b.sort(function (a, b) {
2632
2635
  // Convert date_created to milliseconds, handle undefined by converting to lowest possible date (0 milliseconds)
2633
2636
  var dateA = a.date_updated ? new Date(a.date_updated).getTime() : a.date_created ? new Date(a.date_created).getTime() : 0;
2634
2637
  var dateB = b.date_updated ? new Date(b.date_updated).getTime() : b.date_created ? new Date(b.date_created).getTime() : 0;
2635
2638
  return dateB - dateA; // Subtracts milliseconds which are numbers
2636
- })) === null || _c === void 0 ? void 0 : _c.map(function (i, k) { return (jsx("div", __assign({ className: "tw-break-inside-avoid tw-mb-6" }, { children: jsx(ItemCard, { i: i, loading: loading, url: url, parameterField: parameterField, deleteCallback: function () { return deleteItem(i); } }) }), k)); }) })), addItemPopupType == "place" && (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 () { return setAddItemPopupType(""); } }, { 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) && 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' })) }))] })) })))] }))] })) })), plusButton && jsx(PlusButton, { layer: layer, triggerAction: function () { setAddItemPopupType("place"); scroll(); }, color: '#777', collection: 'items' })] }));
2639
+ })) === null || _c === void 0 ? void 0 : _c.map(function (i, k) { return (jsx("div", __assign({ className: "tw-break-inside-avoid tw-mb-6" }, { children: jsx(ItemCard, { i: i, loading: loading, url: url, parameterField: parameterField, deleteCallback: function () { return deleteItem(i); } }) }), k)); }), addItemPopupType == "place" && (jsx("form", __assign({ ref: tabRef, autoComplete: 'off', onSubmit: function (e) { return submitNewItem(e); } }, { children: jsxs("div", __assign({ className: 'tw-cursor-pointer tw-break-inside-avoid 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 () { return setAddItemPopupType(""); } }, { 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) && 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' })) }))] })) })))] })) }))] })) })), plusButton && jsx(PlusButton, { layer: layer, triggerAction: function () { setAddItemPopupType("place"); scroll(); }, color: '#777', collection: 'items' })] }));
2637
2640
  };
2638
2641
 
2639
2642
  function LoginPage() {
@@ -4401,8 +4404,10 @@ var onUpdateItem = function (state, item, tags, addTag, setLoading, navigate, up
4401
4404
  }))];
4402
4405
  case 3:
4403
4406
  _m.sent();
4407
+ //take care that addTag request comes before item request
4404
4408
  return [4 /*yield*/, sleep(200)];
4405
4409
  case 4:
4410
+ //take care that addTag request comes before item request
4406
4411
  _m.sent();
4407
4412
  if (!item.new) {
4408
4413
  ((_e = (_d = item === null || item === void 0 ? void 0 : item.layer) === null || _d === void 0 ? void 0 : _d.api) === null || _e === void 0 ? void 0 : _e.updateItem) && toast.promise((_g = (_f = item === null || item === void 0 ? void 0 : item.layer) === null || _f === void 0 ? void 0 : _f.api) === null || _g === void 0 ? void 0 : _g.updateItem(changedItem), {
@@ -4596,8 +4601,9 @@ var OnepagerForm = function (_a) {
4596
4601
  return (jsxs("div", __assign({ className: "tw-space-y-6 tw-mt-6" }, { children: [jsxs("div", __assign({ className: "tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-6" }, { children: [jsxs("div", { children: [jsx("label", __assign({ htmlFor: "groupType", className: "tw-block tw-text-sm tw-font-medium tw-text-gray-500 tw-mb-1" }, { children: "Gruppenart:" })), jsx(ComboBoxInput, { id: "groupType", options: typeMapping, value: state.groupType, onValueChange: function (v) { return setState(function (prevState) { return (__assign(__assign({}, prevState), { groupType: v })); }); } })] }), jsxs("div", { children: [jsx("label", __assign({ htmlFor: "status", className: "tw-block tw-text-sm tw-font-medium tw-text-gray-500 tw-mb-1" }, { children: "Gruppenstatus:" })), jsx(ComboBoxInput, { id: "status", options: statusMapping, value: state.status, onValueChange: function (v) { return setState(function (prevState) { return (__assign(__assign({}, prevState), { status: v })); }); } })] })] })), jsxs("div", { children: [jsx("label", __assign({ htmlFor: "email", className: "tw-block tw-text-sm tw-font-medium tw-text-gray-500 tw-mb-1" }, { children: "Email-Adresse (Kontakt):" })), jsx(TextInput, { placeholder: "Email", defaultValue: state.contact, updateFormValue: function (v) { return setState(function (prevState) { return (__assign(__assign({}, prevState), { contact: v })); }); } })] }), jsxs("div", { children: [jsx("label", __assign({ htmlFor: "telephone", className: "tw-block tw-text-sm tw-font-medium tw-text-gray-500 tw-mb-1" }, { children: "Telefonnummer (Kontakt):" })), jsx(TextInput, { placeholder: "Telefonnummer", defaultValue: state.telephone, updateFormValue: function (v) { return setState(function (prevState) { return (__assign(__assign({}, prevState), { telephone: v })); }); } })] }), jsxs("div", { children: [jsx("label", __assign({ htmlFor: "nextAppointment", className: "tw-block tw-text-sm tw-font-medium tw-text-gray-500 tw-mb-1" }, { children: "N\u00E4chste Termine:" })), jsx(TextAreaInput, { placeholder: "N\u00E4chste Termine", defaultValue: state.nextAppointment, updateFormValue: function (v) { return setState(function (prevState) { return (__assign(__assign({}, prevState), { nextAppointment: v })); }); }, inputStyle: "tw-h-24" })] }), jsxs("div", { children: [jsx("label", __assign({ htmlFor: "description", className: "tw-block tw-text-sm tw-font-medium tw-text-gray-500 tw-mb-1" }, { children: "Gruppenbeschreibung:" })), jsx(TextAreaInput, { placeholder: "Beschreibung", defaultValue: state.text || "", updateFormValue: function (v) { return setState(function (prevState) { return (__assign(__assign({}, prevState), { text: v })); }); }, inputStyle: "tw-h-48" })] })] })));
4597
4602
  };
4598
4603
 
4599
- var SimpleForm = function (item, setState) {
4600
- return (jsx(TextAreaInput, { placeholder: "About me ...", defaultValue: (item === null || item === void 0 ? void 0 : item.text) ? item.text : "", updateFormValue: function (v) { return setState(function (prevState) { return (__assign(__assign({}, prevState), { text: v })); }); }, containerStyle: 'tw-mt-8 tw-h-full', inputStyle: 'tw-h-full' }));
4604
+ var SimpleForm = function (_a) {
4605
+ var state = _a.state, setState = _a.setState;
4606
+ return (jsx(TextAreaInput, { placeholder: "About me ...", defaultValue: (state === null || state === void 0 ? void 0 : state.text) || "", updateFormValue: function (v) { return setState(function (prevState) { return (__assign(__assign({}, prevState), { text: v })); }); }, containerStyle: 'tw-mt-8 tw-h-full', inputStyle: 'tw-h-full' }));
4601
4607
  };
4602
4608
 
4603
4609
  var Autocomplete = function (_a) {
@@ -4998,8 +5004,11 @@ function ProfileForm(_a) {
4998
5004
  setTemplate(((_a = item.layer) === null || _a === void 0 ? void 0 : _a.itemType.template) || userType);
4999
5005
  }, [userType, item]);
5000
5006
  var params = new URLSearchParams(window.location.search);
5007
+ useEffect(function () {
5008
+ console.log(state.text);
5009
+ }, [state]);
5001
5010
  return (jsx(Fragment, { children: jsx(MapOverlayPage, __assign({ backdrop: true, className: 'tw-mx-4 tw-mt-4 tw-mb-4 tw-overflow-x-hidden 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: [jsx(FormHeader, { item: item, state: state, setState: setState }), template == "onepager" && (jsx(OnepagerForm, { item: item, state: state, setState: setState })), template == "simple" &&
5002
- jsx(SimpleForm, { item: item, setState: setState }), template == "tabs" &&
5011
+ jsx(SimpleForm, { state: state, setState: setState }), template == "tabs" &&
5003
5012
  jsx(TabsForm, { loading: loading, item: item, state: state, setState: setState, updatePermission: updatePermission, linkItem: function (id) { return linkItem(id, item, updateItem); }, unlinkItem: function (id) { return unlinkItem(id, item, updateItem); } }), 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(state, item, tags, addTag, setLoading, navigate, updateItem, addItem, user, params); }, style: { backgroundColor: "".concat(((_b = item.layer) === null || _b === void 0 ? void 0 : _b.itemColorField) && getValue(item, (_c = item.layer) === null || _c === void 0 ? void 0 : _c.itemColorField) ? getValue(item, (_d = item.layer) === null || _d === void 0 ? void 0 : _d.itemColorField) : (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : (_e = item === null || item === void 0 ? void 0 : item.layer) === null || _e === void 0 ? void 0 : _e.markerDefaultColor)), color: "#fff" } }, { children: "Update" })) }))] })) })) }));
5004
5013
  }
5005
5014