utopia-ui 3.0.0-alpha.227 → 3.0.0-alpha.229

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
@@ -666,8 +666,18 @@ function TextAreaInput(_a) {
666
666
 
667
667
  function TextInput(_a) {
668
668
  var labelTitle = _a.labelTitle, labelStyle = _a.labelStyle, type = _a.type, dataField = _a.dataField, containerStyle = _a.containerStyle, inputStyle = _a.inputStyle, defaultValue = _a.defaultValue, placeholder = _a.placeholder, autocomplete = _a.autocomplete, updateFormValue = _a.updateFormValue;
669
- return (jsxs("div", __assign({ className: "tw-form-control ".concat(containerStyle) }, { children: [labelTitle ? jsx("label", __assign({ className: "tw-label" }, { children: jsx("span", __assign({ className: "tw-label-text tw-text-base-content " + labelStyle }, { children: labelTitle })) }))
670
- : " ", jsx("input", { required: true, type: type || "text", name: dataField, defaultValue: defaultValue, placeholder: placeholder || "", autoComplete: autocomplete, onChange: function (e) { return updateFormValue && updateFormValue(e.target.value); }, className: "tw-input tw-input-bordered tw-w-full ".concat(inputStyle ? inputStyle : "") })] })));
669
+ var _b = useState(defaultValue || ""), inputValue = _b[0], setInputValue = _b[1];
670
+ useEffect(function () {
671
+ setInputValue(defaultValue || "");
672
+ }, [defaultValue]);
673
+ var handleChange = function (e) {
674
+ var newValue = e.target.value;
675
+ setInputValue(newValue);
676
+ if (updateFormValue) {
677
+ updateFormValue(newValue);
678
+ }
679
+ };
680
+ return (jsxs("div", __assign({ className: "tw-form-control ".concat(containerStyle) }, { children: [labelTitle ? (jsx("label", __assign({ className: "tw-label" }, { children: jsx("span", __assign({ className: "tw-label-text tw-text-base-content ".concat(labelStyle) }, { children: labelTitle })) }))) : null, jsx("input", { required: true, type: type || "text", name: dataField, value: inputValue, placeholder: placeholder || "", autoComplete: autocomplete, onChange: handleChange, className: "tw-input tw-input-bordered tw-w-full ".concat(inputStyle || "") })] })));
671
681
  }
672
682
 
673
683
  function SelectBox(props) {
@@ -4601,8 +4611,9 @@ var OnepagerForm = function (_a) {
4601
4611
  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" })] })] })));
4602
4612
  };
4603
4613
 
4604
- var SimpleForm = function (item, setState) {
4605
- 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' }));
4614
+ var SimpleForm = function (_a) {
4615
+ var state = _a.state, setState = _a.setState;
4616
+ 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' }));
4606
4617
  };
4607
4618
 
4608
4619
  var Autocomplete = function (_a) {
@@ -5004,7 +5015,7 @@ function ProfileForm(_a) {
5004
5015
  }, [userType, item]);
5005
5016
  var params = new URLSearchParams(window.location.search);
5006
5017
  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" &&
5007
- jsx(SimpleForm, { item: item, state: state, setState: setState }), template == "tabs" &&
5018
+ jsx(SimpleForm, { state: state, setState: setState }), template == "tabs" &&
5008
5019
  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" })) }))] })) })) }));
5009
5020
  }
5010
5021