utopia-ui 3.0.0-alpha.179 → 3.0.0-alpha.180

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,6 +1,7 @@
1
1
  import { Item } from '../../../../types';
2
- export declare const TextView: ({ item, truncate, itemTextField }: {
2
+ export declare const TextView: ({ item, truncate, itemTextField, rawText }: {
3
3
  item?: Item | undefined;
4
4
  truncate?: boolean | undefined;
5
5
  itemTextField?: string | undefined;
6
+ rawText?: string | undefined;
6
7
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,6 @@
1
- declare const SubHeader: ({ location, country, countryCode, url, title }: {
1
+ declare const SubHeader: ({ location, type, url, title }: {
2
2
  location: any;
3
- country: any;
4
- countryCode: any;
3
+ type: any;
5
4
  url: any;
6
5
  title: any;
7
6
  }) => import("react/jsx-runtime").JSX.Element;
package/dist/index.js CHANGED
@@ -3358,17 +3358,19 @@ function fixUrls(message) {
3358
3358
 
3359
3359
  var TextView = function (_a) {
3360
3360
  var _b, _c;
3361
- var item = _a.item, _d = _a.truncate, truncate = _d === void 0 ? false : _d, itemTextField = _a.itemTextField;
3361
+ var item = _a.item, _d = _a.truncate, truncate = _d === void 0 ? false : _d, itemTextField = _a.itemTextField, rawText = _a.rawText;
3362
3362
  var tags = useTags();
3363
3363
  var addFilterTag = useAddFilterTag();
3364
3364
  var text = "";
3365
- if (itemTextField && item)
3365
+ var replacedText = "";
3366
+ if (rawText)
3367
+ text = replacedText = rawText;
3368
+ else if (itemTextField && item)
3366
3369
  text = getValue(item, itemTextField);
3367
3370
  else
3368
3371
  text = ((_b = item === null || item === void 0 ? void 0 : item.layer) === null || _b === void 0 ? void 0 : _b.itemTextField) && item ? getValue(item, (_c = item.layer) === null || _c === void 0 ? void 0 : _c.itemTextField) : "";
3369
3372
  if (item && text && truncate)
3370
3373
  text = truncateText(removeMarkdownKeepLinksAndParagraphs(text), 100);
3371
- var replacedText;
3372
3374
  item && text ? replacedText = fixUrls(text) : "";
3373
3375
  replacedText ? replacedText = replacedText.replace(/(?<!\]?\()https?:\/\/[^\s\)]+(?!\))/g, function (url) {
3374
3376
  var shortUrl = url;
@@ -3441,7 +3443,7 @@ var TextView = function (_a) {
3441
3443
  addFilterTag(tag);
3442
3444
  } }, { children: decodeTag(children) }), tag ? tag.name + item.id : item.id));
3443
3445
  };
3444
- return (jsx(Markdown, __assign({ className: "tw-text-map tw-leading-map ", remarkPlugins: [remarkBreaks], components: {
3446
+ return (jsx(Markdown, __assign({ className: "tw-text-map tw-leading-map tw-text-sm", remarkPlugins: [remarkBreaks], components: {
3445
3447
  p: CustomParagraph,
3446
3448
  a: function (_a) {
3447
3449
  var href = _a.href, children = _a.children;
@@ -4764,7 +4766,7 @@ var RelationCard = function (_a) {
4764
4766
  var ContactInfo = function (_a) {
4765
4767
  var email = _a.email, name = _a.name, avatar = _a.avatar;
4766
4768
  var assetsApi = useAssetApi();
4767
- return (jsxs("div", __assign({ className: "tw-bg-gray-100 tw-my-10 tw-p-6" }, { children: [jsx("h2", __assign({ className: "tw-text-lg tw-font-semibold" }, { children: "Du hast Fragen?" })), jsxs("div", __assign({ className: "tw-mt-4 tw-flex tw-items-center" }, { children: [jsx("div", __assign({ className: "tw-w-20 tw-h-20 tw-bg-gray-200 tw-rounded-full tw-mr-5 tw-flex tw-items-center tw-justify-center" }, { children: avatar ? (jsx("img", { src: assetsApi.url + avatar, alt: name, className: "tw-w-full tw-h-full tw-rounded-full" })) : (jsxs("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", className: "tw-w-6 tw-h-6", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, { children: [jsx("path", { d: "M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" }), jsx("circle", { cx: "12", cy: "7", r: "4" })] }))) })), jsxs("div", __assign({ className: "tw-text-sm" }, { children: [jsx("p", __assign({ className: "tw-font-semibold" }, { children: name })), jsxs("a", __assign({ href: "mailto:".concat(email), className: "tw-mt-2 tw-text-green-500 tw-flex tw-items-center" }, { children: [jsxs("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", className: "tw-w-4 tw-h-4 tw-mr-1" }, { children: [jsx("path", { d: "M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z" }), jsx("polyline", { points: "22,6 12,13 2,6" })] })), email] }))] }))] }))] })));
4769
+ return (jsxs("div", __assign({ className: "tw-bg-gray-100 tw-my-10 tw-p-6" }, { children: [jsx("h2", __assign({ className: "tw-text-lg tw-font-semibold" }, { children: "Du hast Fragen?" })), jsxs("div", __assign({ className: "tw-mt-4 tw-flex tw-items-center" }, { children: [jsx("div", __assign({ className: "tw-mr-5 tw-flex tw-items-center tw-justify-center" }, { children: jsx("div", __assign({ className: "tw-avatar" }, { children: jsx("div", __assign({ className: "tw-w-20 tw-h-20 tw-bg-gray-200 rounded-full tw-flex tw-items-center tw-justify-center overflow-hidden" }, { children: avatar ? (jsx("img", { src: assetsApi.url + avatar, alt: name, className: "tw-w-full tw-h-full tw-object-cover" })) : (jsx("div", __assign({ className: "tw-flex tw-items-center tw-justify-center tw-w-full tw-h-full" }, { children: jsxs("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", className: "tw-w-12 tw-h-12", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, { children: [jsx("path", { d: "M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" }), jsx("circle", { cx: "12", cy: "7", r: "4" })] })) }))) })) })) })), jsxs("div", __assign({ className: "tw-text-sm" }, { children: [jsx("p", __assign({ className: "tw-font-semibold" }, { children: name })), jsxs("a", __assign({ href: "mailto:".concat(email), className: "tw-mt-2 tw-text-green-500 tw-flex tw-items-center" }, { children: [jsxs("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", className: "tw-w-4 tw-h-4 tw-mr-1" }, { children: [jsx("path", { d: "M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z" }), jsx("polyline", { points: "22,6 12,13 2,6" })] })), email] }))] }))] }))] })));
4768
4770
  };
4769
4771
 
4770
4772
  var platformConfigs = {
@@ -4812,7 +4814,16 @@ var SocialShareButton = function (_a) {
4812
4814
 
4813
4815
  var SocialShareBar = function (_a) {
4814
4816
  var url = _a.url, title = _a.title, _b = _a.platforms, platforms = _b === void 0 ? ['facebook', 'twitter', 'linkedin', 'xing', 'email'] : _b;
4815
- return (jsx("div", __assign({ className: "tw-flex tw-items-center tw-justify-end tw-space-x-2" }, { children: jsx("div", __assign({ className: "tw-flex tw-space-x-2" }, { children: platforms.map(function (platform) { return (jsx(SocialShareButton, { platform: platform, url: url, title: title })); }) })) })));
4817
+ return (jsx("div", __assign({ className: "tw-flex tw-items-center tw-justify-end tw-space-x-2" }, { children: platforms.map(function (platform) { return (jsx(SocialShareButton, { platform: platform, url: url, title: title })); }) })));
4818
+ };
4819
+
4820
+ ({
4821
+ de: (jsxs("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 5 3", className: "tw-w-5 tw-h-3" }, { children: [jsx("rect", { width: "5", height: "3", fill: "#FFCE00" }), jsx("rect", { width: "5", height: "2", fill: "#DD0000" }), jsx("rect", { width: "5", height: "1", fill: "#000000" })] }))),
4822
+ at: (jsxs("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 5 3", className: "tw-w-5 tw-h-3" }, { children: [jsx("rect", { width: "5", height: "3", fill: "#ED2939" }), jsx("rect", { width: "5", height: "2", fill: "#FFFFFF" }), jsx("rect", { width: "5", height: "1", fill: "#ED2939" })] })))
4823
+ });
4824
+ var SubHeader = function (_a) {
4825
+ var location = _a.location, type = _a.type, url = _a.url, title = _a.title;
4826
+ return (jsxs("div", { children: [jsxs("div", __assign({ className: "tw-flex tw-items-center tw-mt-6" }, { children: [jsx("span", __assign({ className: "tw-text-sm tw-text-gray-600" }, { children: type })), jsx("span", __assign({ className: "tw-text-sm tw-text-gray-600 tw-ml-6" }, { children: location }))] })), jsx("div", __assign({ className: "tw-mt-4" }, { children: jsx(SocialShareBar, { url: url, title: title }) }))] }));
4816
4827
  };
4817
4828
 
4818
4829
  function OverlayItemProfile() {
@@ -5040,7 +5051,7 @@ function OverlayItemProfile() {
5040
5051
  }); };
5041
5052
  var d = {
5042
5053
  groupName: "Gruppe Berlin-Britz",
5043
- location: "12347 Berlin-Britz",
5054
+ location: "🇩🇪 12347 Berlin",
5044
5055
  country: "Berlin, Deutschland",
5045
5056
  countryCode: "de",
5046
5057
  contact: {
@@ -5061,8 +5072,8 @@ function OverlayItemProfile() {
5061
5072
  title: "Gruppe Berlin-Britz"
5062
5073
  };
5063
5074
  return (jsx(Fragment, { children: item &&
5064
- jsx(MapOverlayPage, __assign({ className: "".concat(((_a = item.layer) === null || _a === void 0 ? void 0 : _a.itemType.onepager) && '!tw-p-0', " tw-mx-4 tw-mt-4 tw-max-h-[calc(100dvh-96px)] tw-h-[calc(100dvh-96px)] md:tw-w-[calc(50%-32px)] tw-w-[calc(100%-32px)] tw-min-w-80 tw-max-w-3xl !tw-left-0 sm:!tw-left-auto tw-top-0 tw-bottom-0 tw-transition-opacity tw-duration-500 ").concat(!selectPosition ? 'tw-opacity-100 tw-pointer-events-auto' : 'tw-opacity-0 tw-pointer-events-none') }, { children: jsxs(Fragment, { children: [jsxs("div", __assign({ className: "".concat(((_b = item.layer) === null || _b === void 0 ? void 0 : _b.itemType.onepager) && 'tw-p-4') }, { children: [jsx(HeaderView, { showAddress: true, api: (_c = item.layer) === null || _c === void 0 ? void 0 : _c.api, item: item, deleteCallback: handleDelete, editCallback: function () { return navigate("/edit-item/" + item.id); }, setPositionCallback: function () { map.closePopup(); setSelectPosition(item); navigate("/"); }, big: true, truncateSubname: false }), jsx(SocialShareBar, { url: "", title: "title" })] })), jsxs("div", __assign({ className: 'tw-h-full tw-overflow-y-auto fade' }, { children: [((_d = item.layer) === null || _d === void 0 ? void 0 : _d.itemType.onepager) &&
5065
- jsxs(Fragment, { children: [jsx(TextView, { item: item }), d.contact && (jsx(ContactInfo, { name: item.user_created.first_name, avatar: item.user_created.avatar, email: item.contact })), d.relations && (jsxs("div", __assign({ className: "tw-my-10 tw-px-6" }, { children: [jsx("h2", __assign({ className: "tw-text-lg tw-font-semibold tw-mb-4" }, { children: "Projekte" })), d.relations.map(function (project, index) { return (jsx(RelationCard, { title: project.title, description: project.description, imageSrc: project.imageSrc }, index)); })] })))] }), !((_e = item.layer) === null || _e === void 0 ? void 0 : _e.itemType.onepager) &&
5075
+ jsx(MapOverlayPage, __assign({ className: "".concat(((_a = item.layer) === null || _a === void 0 ? void 0 : _a.itemType.onepager) && '!tw-p-0', " tw-mx-4 tw-mt-4 tw-max-h-[calc(100dvh-96px)] tw-h-[calc(100dvh-96px)] md:tw-w-[calc(50%-32px)] tw-w-[calc(100%-32px)] tw-min-w-80 tw-max-w-3xl !tw-left-0 sm:!tw-left-auto tw-top-0 tw-bottom-0 tw-transition-opacity tw-duration-500 ").concat(!selectPosition ? 'tw-opacity-100 tw-pointer-events-auto' : 'tw-opacity-0 tw-pointer-events-none') }, { children: jsxs(Fragment, { children: [jsxs("div", __assign({ className: "tw-px-6 tw-pt-6" }, { children: [jsx(HeaderView, { api: (_b = item.layer) === null || _b === void 0 ? void 0 : _b.api, item: item, deleteCallback: handleDelete, editCallback: function () { return navigate("/edit-item/" + item.id); }, setPositionCallback: function () { map.closePopup(); setSelectPosition(item); navigate("/"); }, big: true, truncateSubname: false }), jsx(SubHeader, { location: d.location, type: "Regionalgruppe", url: d.url, title: d.title })] })), jsxs("div", __assign({ className: 'tw-h-full tw-overflow-y-auto fade' }, { children: [((_c = item.layer) === null || _c === void 0 ? void 0 : _c.itemType.onepager) &&
5076
+ jsxs(Fragment, { children: [item.user_created.first_name && (jsx(ContactInfo, { name: item.user_created.first_name, avatar: item.user_created.avatar, email: item.contact })), jsxs("div", __assign({ className: "tw-my-10 tw-px-6" }, { children: [jsx("h2", __assign({ className: "tw-text-lg tw-font-semibold" }, { children: "Beschreibung" })), jsx("p", __assign({ className: "tw-mt-2 tw-text-sm tw-text-gray-600" }, { children: jsx(TextView, { rawText: (_d = item.text) !== null && _d !== void 0 ? _d : 'Keine Beschreibung vorhanden' }) }))] })), d.relations && (jsxs("div", __assign({ className: "tw-my-10 tw-px-6" }, { children: [jsx("h2", __assign({ className: "tw-text-lg tw-font-semibold tw-mb-4" }, { children: "Projekte" })), d.relations.map(function (project, index) { return (jsx(RelationCard, { title: project.title, description: project.description, imageSrc: project.imageSrc }, index)); })] })))] }), !((_e = item.layer) === null || _e === void 0 ? void 0 : _e.itemType.onepager) &&
5066
5077
  jsxs("div", __assign({ role: "tablist", className: "tw-tabs tw-tabs-lifted tw-mt-2 tw-mb-2" }, { 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: [((_f = item.layer) === null || _f === void 0 ? void 0 : _f.itemType.show_start_end) &&
5067
5078
  jsx("div", __assign({ className: 'tw-max-w-xs' }, { children: jsx(StartEndView, { item: item }) })), jsx(TextView, { item: item })] })), ((_g = item.layer) === null || _g === void 0 ? void 0 : _g.itemType.offers_and_needs) &&
5068
5079
  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 ?