utopia-ui 3.0.0-alpha.216 → 3.0.0-alpha.217

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.
@@ -0,0 +1 @@
1
+ export declare const GratitudeControl: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const AttestationForm: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const EmojiPicker: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare const SelectUser: ({ userType }: {
2
+ userType: string;
3
+ }) => import("react/jsx-runtime").JSX.Element;
package/dist/index.js CHANGED
@@ -2361,6 +2361,8 @@ var addIcon = function (icon) {
2361
2361
  return '<svg class="liebevoll-jetzt-icon" fill="#fff" height="1.5em" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 42 42"><path fill="#e52220" d="M32.554 33.551c0-.2.2-.5 0-.7-.2-.2-.1 0-.3-.1-.5-.2-1.2-.1-1.7.2-.7.3-1.7 1.5-1.3 2.4.2.3.5.6.8.8.5.3.8-.1 1.2-.4.4-.3.7-.5.9-1 .1-.1.8-1.2.4-1.2z"/> <path fill="#fff" d="M14.426 41.57c-1.512-.808-2.234-2.322-2.403-5.038-.104-1.671.136-3.65.844-6.962.497-2.327.545-2.56.81-3.95.236-1.234 3.381-10.767 4.237-12.842.688-1.667 3.022-6.084 3.379-6.394.158-.137.708-.948 1.22-1.802C24.243 1.704 25.935 0 27.065 0c1.134 0 2.303 1.066 2.763 2.521.274.864.133 2.528-.34 4.032-.551 1.754-2.928 6.42-3.994 7.84a37.025 37.025 0 0 0-1.753 2.622c-1.173 1.957-2.233 3.525-4.002 5.92-.831 1.126-1.628 2.306-1.77 2.621-.422.932-1.792 6.558-1.836 7.536-.023.496-.095 1.73-.16 2.742-.175 2.714.265 3.687 1.54 3.407.737-.162 1.569-.967 3.197-3.092 2.302-3.005 5.204-7.528 6.524-10.17.622-1.243 1.228-2.06 1.528-2.06.394 0 .46 1.003.131 1.975-.413 1.219-4.57 8.126-6.186 10.277-1.727 2.3-4.191 4.785-5.233 5.277-1.194.564-2.15.602-3.048.123zm6.76-23.631c2.714-4.414 5.248-9.115 5.42-10.052.027-.148.172-.553.322-.9.397-.915.872-2.532.997-3.386.077-.532.04-.833-.132-1.065-.232-.315-.259-.305-.918.33-1.692 1.632-4.116 7.08-6.488 14.581-.484 1.532-.88 2.855-.881 2.94-.002.255.192-.026 1.68-2.449z"/></svg>';
2362
2362
  case "group":
2363
2363
  return '<svg class="group-icon" stroke="#fff" fill="#fff" stroke-width="0" viewBox="0 0 20 20" aria-hidden="true" height="1.6em" width="1.6em" xmlns="http://www.w3.org/2000/svg"><path d="M10 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM6 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM1.49 15.326a.78.78 0 0 1-.358-.442 3 3 0 0 1 4.308-3.516 6.484 6.484 0 0 0-1.905 3.959c-.023.222-.014.442.025.654a4.97 4.97 0 0 1-2.07-.655ZM16.44 15.98a4.97 4.97 0 0 0 2.07-.654.78.78 0 0 0 .357-.442 3 3 0 0 0-4.308-3.517 6.484 6.484 0 0 1 1.907 3.96 2.32 2.32 0 0 1-.026.654ZM18 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM5.304 16.19a.844.844 0 0 1-.277-.71 5 5 0 0 1 9.947 0 .843.843 0 0 1-.277.71A6.975 6.975 0 0 1 10 18a6.974 6.974 0 0 1-4.696-1.81Z"></path></svg>';
2364
+ case "puzzle":
2365
+ return '<svg class="group-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#fff" width="1.6em" height="1.6em"><path d="M11.25 5.337c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.036 1.007-1.875 2.25-1.875S15 2.34 15 3.375c0 .369-.128.713-.349 1.003-.215.283-.401.604-.401.959 0 .332.278.598.61.578 1.91-.114 3.79-.342 5.632-.676a.75.75 0 0 1 .878.645 49.17 49.17 0 0 1 .376 5.452.657.657 0 0 1-.66.664c-.354 0-.675-.186-.958-.401a1.647 1.647 0 0 0-1.003-.349c-1.035 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401.31 0 .557.262.534.571a48.774 48.774 0 0 1-.595 4.845.75.75 0 0 1-.61.61c-1.82.317-3.673.533-5.555.642a.58.58 0 0 1-.611-.581c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.035-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959a.641.641 0 0 1-.658.643 49.118 49.118 0 0 1-4.708-.36.75.75 0 0 1-.645-.878c.293-1.614.504-3.257.629-4.924A.53.53 0 0 0 5.337 15c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.036 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.369 0 .713.128 1.003.349.283.215.604.401.959.401a.656.656 0 0 0 .659-.663 47.703 47.703 0 0 0-.31-4.82.75.75 0 0 1 .83-.832c1.343.155 2.703.254 4.077.294a.64.64 0 0 0 .657-.642Z" /></svg>';
2364
2366
  default:
2365
2367
  return "";
2366
2368
  }
@@ -2869,8 +2871,10 @@ function usePermissionsManager(initialPermissions) {
2869
2871
  return false;
2870
2872
  };
2871
2873
  var evaluatePermissions = function (permissionConditions) {
2872
- var _a;
2873
- return (_a = permissionConditions._and) === null || _a === void 0 ? void 0 : _a.every(function (andCondition) {
2874
+ if (!permissionConditions || !permissionConditions._and) {
2875
+ return true;
2876
+ }
2877
+ return permissionConditions._and.every(function (andCondition) {
2874
2878
  return andCondition._or
2875
2879
  ? andCondition._or.some(function (orCondition) { return evaluateCondition(orCondition); })
2876
2880
  : evaluateCondition(andCondition);
@@ -2886,10 +2890,10 @@ function usePermissionsManager(initialPermissions) {
2886
2890
  return p.action === action &&
2887
2891
  p.collection === collectionName &&
2888
2892
  ((p.role === (user === null || user === void 0 ? void 0 : user.role) &&
2889
- (!item || !p.permissions || evaluatePermissions(p.permissions))) ||
2893
+ (!item || evaluatePermissions(p.permissions))) ||
2890
2894
  (p.role == null &&
2891
2895
  (((layer === null || layer === void 0 ? void 0 : layer.public_edit_items) || ((_a = item === null || item === void 0 ? void 0 : item.layer) === null || _a === void 0 ? void 0 : _a.public_edit_items)) &&
2892
- (!item || !p.permissions || evaluatePermissions(p.permissions)))));
2896
+ (!item || evaluatePermissions(p.permissions)))));
2893
2897
  });
2894
2898
  }
2895
2899
  }, [permissions, user]);
@@ -3522,7 +3526,6 @@ function ItemFormPopup(props) {
3522
3526
  return [3 /*break*/, 13];
3523
3527
  case 5:
3524
3528
  item = items.find(function (i) { var _a, _b; return ((_a = i.user_created) === null || _a === void 0 ? void 0 : _a.id) === (user === null || user === void 0 ? void 0 : user.id) && ((_b = i.layer) === null || _b === void 0 ? void 0 : _b.itemType.name) === props.layer.itemType.name; });
3525
- console.log(item);
3526
3529
  uuid = crypto.randomUUID();
3527
3530
  success = false;
3528
3531
  _g.label = 6;
@@ -4357,22 +4360,27 @@ var onUpdateItem = function (state, item, tags, addTag, setLoading, navigate, up
4357
4360
  changedItem = {};
4358
4361
  offer_updates = [];
4359
4362
  //check for new offers
4360
- (_a = state.offers) === null || _a === void 0 ? void 0 : _a.map(function (o) {
4361
- var _a;
4362
- var existingOffer = (_a = item === null || item === void 0 ? void 0 : item.offers) === null || _a === void 0 ? void 0 : _a.find(function (t) { return t.tags_id === o.id; });
4363
- existingOffer && offer_updates.push(existingOffer.id);
4364
- if (!existingOffer && !tags.some(function (t) { return t.id === o.id; }))
4365
- addTag(__assign(__assign({}, o), { offer_or_need: true }));
4366
- !existingOffer && offer_updates.push({ items_id: item === null || item === void 0 ? void 0 : item.id, tags_id: o.id });
4367
- });
4363
+ return [4 /*yield*/, ((_a = state.offers) === null || _a === void 0 ? void 0 : _a.map(function (o) {
4364
+ var _a;
4365
+ var existingOffer = (_a = item === null || item === void 0 ? void 0 : item.offers) === null || _a === void 0 ? void 0 : _a.find(function (t) { return t.tags_id === o.id; });
4366
+ existingOffer && offer_updates.push(existingOffer.id);
4367
+ if (!existingOffer && !tags.some(function (t) { return t.id === o.id; }))
4368
+ addTag(__assign(__assign({}, o), { offer_or_need: true }));
4369
+ !existingOffer && offer_updates.push({ items_id: item === null || item === void 0 ? void 0 : item.id, tags_id: o.id });
4370
+ }))];
4371
+ case 1:
4372
+ //check for new offers
4373
+ _m.sent();
4368
4374
  needs_updates = [];
4369
- (_b = state.needs) === null || _b === void 0 ? void 0 : _b.map(function (n) {
4370
- var _a;
4371
- var existingNeed = (_a = item === null || item === void 0 ? void 0 : item.needs) === null || _a === void 0 ? void 0 : _a.find(function (t) { return t.tags_id === n.id; });
4372
- existingNeed && needs_updates.push(existingNeed.id);
4373
- !existingNeed && needs_updates.push({ items_id: item === null || item === void 0 ? void 0 : item.id, tags_id: n.id });
4374
- !existingNeed && !tags.some(function (t) { return t.id === n.id; }) && addTag(__assign(__assign({}, n), { offer_or_need: true }));
4375
- });
4375
+ return [4 /*yield*/, ((_b = state.needs) === null || _b === void 0 ? void 0 : _b.map(function (n) {
4376
+ var _a;
4377
+ var existingNeed = (_a = item === null || item === void 0 ? void 0 : item.needs) === null || _a === void 0 ? void 0 : _a.find(function (t) { return t.tags_id === n.id; });
4378
+ existingNeed && needs_updates.push(existingNeed.id);
4379
+ !existingNeed && needs_updates.push({ items_id: item === null || item === void 0 ? void 0 : item.id, tags_id: n.id });
4380
+ !existingNeed && !tags.some(function (t) { return t.id === n.id; }) && addTag(__assign(__assign({}, n), { offer_or_need: true }));
4381
+ }))];
4382
+ case 2:
4383
+ _m.sent();
4376
4384
  // update profile item in current state
4377
4385
  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 });
4378
4386
  offers_state = [];
@@ -4380,12 +4388,12 @@ var onUpdateItem = function (state, item, tags, addTag, setLoading, navigate, up
4380
4388
  return [4 /*yield*/, state.offers.map(function (o) {
4381
4389
  offers_state.push({ items_id: item === null || item === void 0 ? void 0 : item.id, tags_id: o.id });
4382
4390
  })];
4383
- case 1:
4391
+ case 3:
4384
4392
  _m.sent();
4385
4393
  return [4 /*yield*/, state.needs.map(function (n) {
4386
4394
  needs_state.push({ items_id: item === null || item === void 0 ? void 0 : item.id, tags_id: n.id });
4387
4395
  })];
4388
- case 2:
4396
+ case 4:
4389
4397
  _m.sent();
4390
4398
  changedItem = __assign(__assign({}, changedItem), { offers: offers_state, needs: needs_state });
4391
4399
  (_c = state.text.toLocaleLowerCase().match(hashTagRegex)) === null || _c === void 0 ? void 0 : _c.map(function (tag) {
@@ -4938,6 +4946,12 @@ function ProfileForm(_a) {
4938
4946
  var layer = layers.find(function (l) { return l.itemType.name == userType; });
4939
4947
  !item && setItem({ id: crypto.randomUUID(), name: user ? user.first_name : "", text: "", layer: layer, new: true });
4940
4948
  }, [items]);
4949
+ useEffect(function () {
4950
+ console.log(state.offers);
4951
+ console.log(state.needs);
4952
+ console.log(state.id);
4953
+ console.log(item);
4954
+ }, [state]);
4941
4955
  useEffect(function () {
4942
4956
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
4943
4957
  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)