utopia-ui 3.0.25 → 3.0.27
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/Components/Input/TextInput.d.ts +3 -1
- package/dist/index.js +17 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
@@ -8,7 +8,9 @@ declare type InputTextProps = {
|
|
8
8
|
defaultValue?: string;
|
9
9
|
placeholder?: string;
|
10
10
|
autocomplete?: string;
|
11
|
+
pattern?: string;
|
12
|
+
required?: boolean;
|
11
13
|
updateFormValue?: (value: string) => void;
|
12
14
|
};
|
13
|
-
export declare function TextInput({ labelTitle, labelStyle, type, dataField, containerStyle, inputStyle, defaultValue, placeholder, autocomplete, updateFormValue, }: InputTextProps): import("react/jsx-runtime").JSX.Element;
|
15
|
+
export declare function TextInput({ labelTitle, labelStyle, type, dataField, containerStyle, inputStyle, defaultValue, placeholder, autocomplete, pattern, required, updateFormValue, }: InputTextProps): import("react/jsx-runtime").JSX.Element;
|
14
16
|
export {};
|
package/dist/index.js
CHANGED
@@ -3339,8 +3339,8 @@ function TextAreaInput(_a) {
|
|
3339
3339
|
}
|
3340
3340
|
|
3341
3341
|
function TextInput(_a) {
|
3342
|
-
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;
|
3343
|
-
var
|
3342
|
+
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, pattern = _a.pattern, _b = _a.required, required = _b === void 0 ? true : _b, updateFormValue = _a.updateFormValue;
|
3343
|
+
var _c = useState(defaultValue || ''), inputValue = _c[0], setInputValue = _c[1];
|
3344
3344
|
useEffect(function () {
|
3345
3345
|
setInputValue(defaultValue || '');
|
3346
3346
|
}, [defaultValue]);
|
@@ -3351,7 +3351,7 @@ function TextInput(_a) {
|
|
3351
3351
|
updateFormValue(newValue);
|
3352
3352
|
}
|
3353
3353
|
};
|
3354
|
-
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:
|
3354
|
+
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: required, pattern: pattern, type: type || 'text', name: dataField, value: inputValue, placeholder: placeholder || '', autoComplete: autocomplete, onChange: handleChange, className: "tw-input tw-input-bordered tw-w-full ".concat(inputStyle || '') })] })));
|
3355
3355
|
}
|
3356
3356
|
|
3357
3357
|
function ItemFormPopup(props) {
|
@@ -5579,16 +5579,16 @@ var FormHeader = function (_a) {
|
|
5579
5579
|
return setState(function (prevState) { return (__assign(__assign({}, prevState), { color: c })); });
|
5580
5580
|
}, 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) {
|
5581
5581
|
return setState(function (prevState) { return (__assign(__assign({}, prevState), { name: v })); });
|
5582
|
-
}, 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) {
|
5582
|
+
}, containerStyle: 'tw-grow tw-input-md' }), jsx(TextInput, { placeholder: 'Subtitle', required: false, defaultValue: (item === null || item === void 0 ? void 0 : item.subname) ? item.subname : '', updateFormValue: function (v) {
|
5583
5583
|
return setState(function (prevState) { return (__assign(__assign({}, prevState), { subname: v })); });
|
5584
5584
|
}, containerStyle: 'tw-grow tw-input-sm tw-px-4 tw-mt-1' })] }))] })));
|
5585
5585
|
};
|
5586
5586
|
|
5587
5587
|
var ContactInfoForm = function (_a) {
|
5588
5588
|
var state = _a.state, setState = _a.setState;
|
5589
|
-
return (jsxs("div", __assign({ className: 'tw-mt-4 tw-space-y-4' }, { children: [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', type: 'email', defaultValue: state.contact, updateFormValue: function (v) {
|
5589
|
+
return (jsxs("div", __assign({ className: 'tw-mt-4 tw-space-y-4' }, { children: [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', type: 'email', required: false, defaultValue: state.contact, updateFormValue: function (v) {
|
5590
5590
|
return setState(function (prevState) { return (__assign(__assign({}, prevState), { contact: v })); });
|
5591
|
-
} })] }), 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) {
|
5591
|
+
} })] }), 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', type: 'tel', required: false, pattern: '^\\+?[0-9\\s\\-]{7,15}$', defaultValue: state.telephone, updateFormValue: function (v) {
|
5592
5592
|
return setState(function (prevState) { return (__assign(__assign({}, prevState), { telephone: v })); });
|
5593
5593
|
} })] })] })));
|
5594
5594
|
};
|
@@ -5607,9 +5607,10 @@ var GroupSubheaderForm = function (_a) {
|
|
5607
5607
|
useEffect(function () {
|
5608
5608
|
if (groupTypes && groupStates) {
|
5609
5609
|
var groupType_1 = groupTypes.find(function (gt) { return gt.groupTypes_id.name === state.group_type; });
|
5610
|
-
|
5611
|
-
|
5612
|
-
|
5610
|
+
var customImage_1 = !groupTypes.some(function (gt) { return gt.groupTypes_id.image === state.image || !state.image; });
|
5611
|
+
setState(function (prevState) { return (__assign(__assign({}, prevState), { color: (groupType_1 === null || groupType_1 === void 0 ? void 0 : groupType_1.groupTypes_id.color) || groupTypes[0].groupTypes_id.color, marker_icon: (groupType_1 === null || groupType_1 === void 0 ? void 0 : groupType_1.groupTypes_id.markerIcon) || groupTypes[0].groupTypes_id.markerIcon, image: customImage_1
|
5612
|
+
? state.image
|
5613
|
+
: (groupType_1 === null || groupType_1 === void 0 ? void 0 : groupType_1.groupTypes_id.image) || groupTypes[0].groupTypes_id.image, status: state.status || groupStates[0], group_type: state.group_type || groupTypes[0].groupTypes_id.name })); });
|
5613
5614
|
}
|
5614
5615
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
5615
5616
|
}, [state.group_type, groupTypes]);
|
@@ -5957,12 +5958,13 @@ function ProfileForm() {
|
|
5957
5958
|
var _a;
|
5958
5959
|
setTemplate(((_a = item.layer) === null || _a === void 0 ? void 0 : _a.itemType.template) || appState.userType);
|
5959
5960
|
}, [appState.userType, item]);
|
5960
|
-
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:
|
5961
|
-
|
5962
|
-
|
5963
|
-
|
5964
|
-
|
5965
|
-
|
5961
|
+
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: jsx("form", __assign({ onSubmit: function (e) {
|
5962
|
+
e.preventDefault();
|
5963
|
+
void onUpdateItem(state, item, tags, addTag, setLoading, navigate, updateItem, addItem, user, urlParams);
|
5964
|
+
} }, { 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' && jsx(SimpleForm, { state: state, setState: setState }), template === 'flex' && (jsx(FlexForm, { item: item, state: state, setState: setState })), template === 'tabs' && (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); }, setUrlParams: setUrlParams })), jsx("div", __assign({ className: 'tw-mt-4' }, { children: jsx("button", __assign({ className: loading ? ' tw-loading tw-btn tw-float-right' : 'tw-btn tw-float-right', type: 'submit', style: {
|
5965
|
+
backgroundColor: "".concat(((_a = item.layer) === null || _a === void 0 ? void 0 : _a.itemColorField) && getValue(item, (_b = item.layer) === null || _b === void 0 ? void 0 : _b.itemColorField) ? getValue(item, (_c = item.layer) === null || _c === void 0 ? void 0 : _c.itemColorField) : getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : (_d = item === null || item === void 0 ? void 0 : item.layer) === null || _d === void 0 ? void 0 : _d.markerDefaultColor),
|
5966
|
+
color: '#fff',
|
5967
|
+
} }, { children: "Update" })) }))] })) })) })) }));
|
5966
5968
|
}
|
5967
5969
|
|
5968
5970
|
function Modal(_a) {
|