utopia-ui 3.0.0-alpha.236 → 3.0.0-alpha.237

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,9 @@
1
1
  import { Item } from '../../../../types';
2
- export declare const PopupStartEndInput: ({ item }: {
3
- item?: Item | undefined;
4
- }) => import("react/jsx-runtime").JSX.Element;
2
+ declare type StartEndInputProps = {
3
+ item?: Item;
4
+ showLabels?: boolean;
5
+ updateStartValue?: (value: string) => void;
6
+ updateEndValue?: (value: string) => void;
7
+ };
8
+ export declare const PopupStartEndInput: ({ item, showLabels, updateStartValue, updateEndValue }: StartEndInputProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
package/dist/index.js CHANGED
@@ -3849,8 +3849,8 @@ var PopupTextAreaInput = function (_a) {
3849
3849
  };
3850
3850
 
3851
3851
  var PopupStartEndInput = function (_a) {
3852
- var item = _a.item;
3853
- return (jsxs("div", __assign({ className: 'tw-grid tw-grid-cols-2 tw-gap-2 tw-mb-5' }, { children: [jsx(TextInput, { type: 'date', placeholder: 'start', dataField: 'start', inputStyle: 'tw-text-sm tw-px-2', labelTitle: 'start', defaultValue: item && item.start ? item.start.substring(0, 10) : "", autocomplete: 'one-time-code' }), jsx(TextInput, { type: 'date', placeholder: 'end', dataField: 'end', inputStyle: 'tw-text-sm tw-px-2', labelTitle: 'end', defaultValue: item && item.end ? item.end.substring(0, 10) : "", autocomplete: 'one-time-code' })] })));
3852
+ var item = _a.item, _b = _a.showLabels, showLabels = _b === void 0 ? true : _b, updateStartValue = _a.updateStartValue, updateEndValue = _a.updateEndValue;
3853
+ return (jsxs("div", __assign({ className: 'tw-grid tw-grid-cols-2 tw-gap-2 tw-mb-5' }, { children: [jsx(TextInput, { type: 'date', placeholder: 'start', dataField: 'start', inputStyle: 'tw-text-sm tw-px-2', labelTitle: showLabels ? "start" : "", defaultValue: item && item.start ? item.start.substring(0, 10) : "", autocomplete: 'one-time-code', updateFormValue: updateStartValue }), jsx(TextInput, { type: 'date', placeholder: 'end', dataField: 'end', inputStyle: 'tw-text-sm tw-px-2', labelTitle: showLabels ? "end" : "", defaultValue: item && item.end ? item.end.substring(0, 10) : "", autocomplete: 'one-time-code', updateFormValue: updateEndValue })] })));
3854
3854
  };
3855
3855
 
3856
3856
  var PopupTextInput = function (_a) {
@@ -4158,8 +4158,8 @@ var TabsView = function (_a) {
4158
4158
  var urlTab = params.get("tab");
4159
4159
  urlTab ? setActiveTab(Number(urlTab)) : setActiveTab(1);
4160
4160
  }, [location]);
4161
- return (jsxs("div", __assign({ role: "tablist", className: "tw-tabs tw-tabs-lifted tw-mt-2 tw-mb-2 tw-px-6" }, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Info", checked: activeTab == 1 && true, onChange: function () { return updateActiveTab(1); } }), jsxs("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-280px)] tw-overflow-y-auto fade tw-pt-2 tw-pb-4 tw-mb-4 tw-overflow-x-hidden" }, { children: [((_b = item.layer) === null || _b === void 0 ? void 0 : _b.itemType.show_start_end) &&
4162
- jsx("div", __assign({ className: 'tw-max-w-xs' }, { children: jsx(StartEndView, { item: item }) })), jsx(TextView, { item: item })] })), ((_c = item.layer) === null || _c === void 0 ? void 0 : _c.itemType.offers_and_needs) &&
4161
+ return (jsxs("div", __assign({ role: "tablist", className: "tw-tabs tw-tabs-lifted tw-mt-2 tw-mb-2 tw-px-6" }, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Info", checked: activeTab == 1 && true, onChange: function () { return updateActiveTab(1); } }), jsxs("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-280px)] tw-overflow-y-auto fade tw-pt-2 tw-pb-4 tw-mb-4 tw-overflow-x-hidden tw-flex tw-flex-col" }, { children: [((_b = item.layer) === null || _b === void 0 ? void 0 : _b.itemType.show_start_end) &&
4162
+ jsx("div", __assign({ className: 'tw-max-w-xs' }, { children: jsx(StartEndView, { item: item }) })), jsx(TextView, { item: item }), jsx("div", { className: 'tw-h-4' }), jsx(TextView, { item: item, itemTextField: 'contact' })] })), ((_c = item.layer) === null || _c === void 0 ? void 0 : _c.itemType.offers_and_needs) &&
4163
4163
  jsxs(Fragment, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab tw-min-w-[10em] [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Offers & Needs", checked: activeTab == 3 && true, onChange: function () { return updateActiveTab(3); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-268px)] tw-overflow-y-auto fade tw-pt-4 tw-pb-1" }, { children: jsx("div", __assign({ className: 'tw-h-full' }, { children: jsxs("div", __assign({ className: 'tw-grid tw-grid-cols-1' }, { children: [offers.length > 0 ?
4164
4164
  jsxs("div", __assign({ className: 'tw-col-span-1' }, { children: [jsx("h3", __assign({ className: '-tw-mb-2' }, { children: "Offers" })), jsx("div", __assign({ className: 'tw-flex tw-flex-wrap tw-mb-4' }, { children: offers.map(function (o) { return jsx(TagView, { tag: o, onClick: function () {
4165
4165
  addFilterTag(o);
@@ -4396,7 +4396,7 @@ var onUpdateItem = function (state, item, tags, addTag, setLoading, navigate, up
4396
4396
  case 2:
4397
4397
  _m.sent();
4398
4398
  // update profile item in current state
4399
- changedItem = __assign(__assign(__assign(__assign(__assign({ id: state.id, group_type: state.groupType, status: state.status, name: state.name, subname: state.subname, text: state.text, color: state.color, position: item.position, contact: state.contact, telephone: state.telephone }, state.markerIcon && { markerIcon: state.markerIcon }), { next_appointment: state.nextAppointment }), state.image.length > 10 && { image: state.image }), state.offers.length > 0 && { offers: offer_updates }), state.needs.length > 0 && { needs: needs_updates });
4399
+ changedItem = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ id: state.id, name: state.name }, state.subname && { subname: state.subname }), state.text && { text: state.text }), state.color && { color: state.color }), { position: item.position }), state.groupType && { group_type: state.groupType }), state.status && { status: state.status }), state.contact && { contact: state.contact }), state.telephone && { telephone: state.telephone }), state.end && { end: state.end }), state.start && { start: state.start }), state.markerIcon && { markerIcon: state.markerIcon }), state.nextAppointment && { next_appointment: state.nextAppointment }), state.image.length > 10 && { image: state.image }), state.offers.length > 0 && { offers: offer_updates }), state.needs.length > 0 && { needs: needs_updates });
4400
4400
  offers_state = [];
4401
4401
  needs_state = [];
4402
4402
  state.offers.map(function (o) {
@@ -4753,7 +4753,8 @@ var TabsForm = function (_a) {
4753
4753
  var urlTab = params.get("tab");
4754
4754
  urlTab ? setActiveTab(Number(urlTab)) : setActiveTab(1);
4755
4755
  }, [location]);
4756
- return (jsxs("div", __assign({ role: "tablist", className: "tw-tabs tw-tabs-lifted tw-mt-4" }, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Info", checked: activeTab == 1 && true, onChange: function () { return updateActiveTab(1); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-border-[var(--fallback-bc,oklch(var(--bc)/0.2))] tw-rounded-box tw-h-[calc(100dvh-332px)] tw-min-h-56 tw-border-none" }, { children: 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-h-full', inputStyle: 'tw-h-full tw-border-t-0 tw-rounded-tl-none' }) })), ((_b = item.layer) === null || _b === void 0 ? void 0 : _b.itemType.offers_and_needs) &&
4756
+ return (jsxs("div", __assign({ role: "tablist", className: "tw-tabs tw-tabs-lifted tw-mt-3" }, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Info", checked: activeTab == 1 && true, onChange: function () { return updateActiveTab(1); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-border-[var(--fallback-bc,oklch(var(--bc)/0.2))] tw-rounded-box tw-h-[calc(100dvh-332px)] tw-min-h-56 tw-border-none" }, { children: jsxs("div", __assign({ className: "tw-flex tw-flex-col tw-h-full tw-pt-4" }, { children: [item.layer.itemType.show_start_end_input &&
4757
+ jsx(PopupStartEndInput, { item: item, showLabels: false, updateEndValue: function (e) { return setState(function (prevState) { return (__assign(__assign({}, prevState), { end: e })); }); }, updateStartValue: function (s) { return setState(function (prevState) { return (__assign(__assign({}, prevState), { start: s })); }); } }), jsx(TextAreaInput, { placeholder: "About ...", 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-grow', inputStyle: "tw-h-full ".concat(!item.layer.itemType.show_start_end_input && "tw-border-t-0 tw-rounded-tl-none") }), jsx("div", { children: jsx(TextAreaInput, { placeholder: "contact info", defaultValue: state.contact || "", updateFormValue: function (c) { return setState(function (prevState) { return (__assign(__assign({}, prevState), { contact: c })); }); }, inputStyle: "tw-h-24", containerStyle: "tw-pt-4" }) })] })) })), ((_b = item.layer) === null || _b === void 0 ? void 0 : _b.itemType.offers_and_needs) &&
4757
4758
  jsxs(Fragment, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab tw-min-w-[10em] [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Offers & Needs", checked: activeTab == 3 && true, onChange: function () { return updateActiveTab(3); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-border-[var(--fallback-bc,oklch(var(--bc)/0.2))] tw-rounded-box tw-h-[calc(100dvh-332px)] tw-min-h-56 tw-border-none" }, { children: jsxs("div", __assign({ className: 'tw-h-full' }, { children: [jsx("div", __assign({ className: 'tw-w-full tw-h-[calc(50%-0.75em)] tw-mb-4' }, { children: jsx(TagsWidget, { defaultTags: state.offers, onUpdate: function (v) { return setState(function (prevState) { return (__assign(__assign({}, prevState), { offers: v })); }); }, placeholder: "enter your offers", containerStyle: 'tw-bg-transparent tw-w-full tw-h-full tw-mt-3 tw-text-xs tw-h-[calc(100%-1rem)] tw-min-h-[5em] tw-pb-2 tw-overflow-auto' }) })), jsx("div", __assign({ className: 'tw-w-full tw-h-[calc(50%-0.75em)] ' }, { children: jsx(TagsWidget, { defaultTags: state.needs, onUpdate: function (v) { return setState(function (prevState) { return (__assign(__assign({}, prevState), { needs: v })); }); }, placeholder: "enter your needs", containerStyle: 'tw-bg-transparent tw-w-full tw-h-full tw-mt-3 tw-text-xs tw-h-[calc(100%-1rem)] tw-min-h-[5em] tw-pb-2 tw-overflow-auto' }) }))] })) }))] }), ((_c = item.layer) === null || _c === void 0 ? void 0 : _c.itemType.relations) &&
4758
4759
  jsxs(Fragment, { children: [jsx("input", { type: "radio", name: "my_tabs_2", role: "tab", className: "tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]", "aria-label": "Relations", checked: activeTab == 7 && true, onChange: function () { return updateActiveTab(7); } }), jsx("div", __assign({ role: "tabpanel", className: "tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-340px)] tw-overflow-y-auto tw-pt-4 tw-pb-1 -tw-mx-4 tw-overflow-x-hidden fade" }, { children: jsx("div", __assign({ className: 'tw-h-full' }, { children: jsxs("div", __assign({ className: 'tw-grid tw-grid-cols-1 sm:tw-grid-cols-2 md:tw-grid-cols-1 lg:tw-grid-cols-1 xl:tw-grid-cols-1 2xl:tw-grid-cols-2 tw-mb-4' }, { children: [state.relations && state.relations.map(function (i) {
4759
4760
  return jsxs("div", __assign({ className: 'tw-cursor-pointer tw-card tw-bg-base-200 tw-border-[1px] tw-border-base-300 tw-card-body tw-shadow-xl tw-text-base-content tw-mx-4 tw-p-6 tw-mb-4', onClick: function () { return navigate('/item/' + i.id); } }, { children: [jsx(LinkedItemsHeaderView, { unlinkPermission: updatePermission, item: i, unlinkCallback: function (id) { return unlinkItem(id, item, updateItem); }, loading: loading }), jsx("div", __assign({ className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade' }, { children: jsx(TextView, { truncate: true, item: i }) }))] }), i.id);
@@ -4939,7 +4940,9 @@ function ProfileForm(_a) {
4939
4940
  markerIcon: "",
4940
4941
  offers: [],
4941
4942
  needs: [],
4942
- relations: []
4943
+ relations: [],
4944
+ start: "",
4945
+ end: ""
4943
4946
  }), state = _f[0], setState = _f[1];
4944
4947
  var _g = useState(false), updatePermission = _g[0], setUpdatePermission = _g[1];
4945
4948
  var _h = useState(false), loading = _h[0], setLoading = _h[1];
@@ -4966,7 +4969,7 @@ function ProfileForm(_a) {
4966
4969
  !item && setItem({ id: crypto.randomUUID(), name: user ? user.first_name : "", text: "", layer: layer, new: true });
4967
4970
  }, [items]);
4968
4971
  useEffect(function () {
4969
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
4972
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
4970
4973
  var newColor = ((_a = item.layer) === null || _a === void 0 ? void 0 : _a.itemColorField) && getValue(item, (_b = item.layer) === null || _b === void 0 ? void 0 : _b.itemColorField)
4971
4974
  ? getValue(item, (_c = item.layer) === null || _c === void 0 ? void 0 : _c.itemColorField)
4972
4975
  : (getItemTags(item) && ((_d = getItemTags(item)[0]) === null || _d === void 0 ? void 0 : _d.color))
@@ -5005,7 +5008,9 @@ function ProfileForm(_a) {
5005
5008
  markerIcon: (_u = item === null || item === void 0 ? void 0 : item.marker_icon) !== null && _u !== void 0 ? _u : "",
5006
5009
  offers: offers,
5007
5010
  needs: needs,
5008
- relations: relations
5011
+ relations: relations,
5012
+ start: (_v = item === null || item === void 0 ? void 0 : item.start) !== null && _v !== void 0 ? _v : "",
5013
+ end: (_w = item === null || item === void 0 ? void 0 : item.end) !== null && _w !== void 0 ? _w : ""
5009
5014
  });
5010
5015
  }, [item, tags, items]);
5011
5016
  var _k = useState(""), template = _k[0], setTemplate = _k[1];