@limetech/lime-crm-building-blocks 1.25.1 → 1.25.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### [1.25.2](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.25.1...v1.25.2) (2024-01-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+
7
+ * **feed:** unbundle two feed items with distinct icons that are closely timed ([402b24e](https://github.com/Lundalogik/lime-crm-building-blocks/commit/402b24e65321e62259cc67c62b6c2d4ec8feb069))
8
+
1
9
  ### [1.25.1](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.25.0...v1.25.1) (2024-01-05)
2
10
 
3
11
 
@@ -191,7 +191,7 @@ const Feed = class {
191
191
  */
192
192
  this.totalCount = 0;
193
193
  this.isBundled = (item, index) => {
194
- var _a, _b, _c;
194
+ var _a, _b, _c, _d, _e, _f;
195
195
  if (index === 0) {
196
196
  return false;
197
197
  }
@@ -200,6 +200,11 @@ const Feed = class {
200
200
  if (previousAuthorId !== currentAuthorId) {
201
201
  return false;
202
202
  }
203
+ const previousItemIcon = (_e = (_d = this.items[index - 1]) === null || _d === void 0 ? void 0 : _d.icon) === null || _e === void 0 ? void 0 : _e.name;
204
+ const currentItemIcon = (_f = item === null || item === void 0 ? void 0 : item.icon) === null || _f === void 0 ? void 0 : _f.name;
205
+ if (previousItemIcon !== currentItemIcon) {
206
+ return false;
207
+ }
203
208
  const currentIndexDate = new Date(item.timestamp);
204
209
  const previousIndexDate = new Date(this.items[index - 1].timestamp);
205
210
  const previousItemDate = new Date(previousIndexDate);
@@ -42,7 +42,7 @@ export class Feed {
42
42
  */
43
43
  this.totalCount = 0;
44
44
  this.isBundled = (item, index) => {
45
- var _a, _b, _c;
45
+ var _a, _b, _c, _d, _e, _f;
46
46
  if (index === 0) {
47
47
  return false;
48
48
  }
@@ -51,6 +51,11 @@ export class Feed {
51
51
  if (previousAuthorId !== currentAuthorId) {
52
52
  return false;
53
53
  }
54
+ const previousItemIcon = (_e = (_d = this.items[index - 1]) === null || _d === void 0 ? void 0 : _d.icon) === null || _e === void 0 ? void 0 : _e.name;
55
+ const currentItemIcon = (_f = item === null || item === void 0 ? void 0 : item.icon) === null || _f === void 0 ? void 0 : _f.name;
56
+ if (previousItemIcon !== currentItemIcon) {
57
+ return false;
58
+ }
54
59
  const currentIndexDate = new Date(item.timestamp);
55
60
  const previousIndexDate = new Date(this.items[index - 1].timestamp);
56
61
  const previousItemDate = new Date(previousIndexDate);
@@ -190,7 +190,7 @@ const Feed = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
190
190
  */
191
191
  this.totalCount = 0;
192
192
  this.isBundled = (item, index) => {
193
- var _a, _b, _c;
193
+ var _a, _b, _c, _d, _e, _f;
194
194
  if (index === 0) {
195
195
  return false;
196
196
  }
@@ -199,6 +199,11 @@ const Feed = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
199
199
  if (previousAuthorId !== currentAuthorId) {
200
200
  return false;
201
201
  }
202
+ const previousItemIcon = (_e = (_d = this.items[index - 1]) === null || _d === void 0 ? void 0 : _d.icon) === null || _e === void 0 ? void 0 : _e.name;
203
+ const currentItemIcon = (_f = item === null || item === void 0 ? void 0 : item.icon) === null || _f === void 0 ? void 0 : _f.name;
204
+ if (previousItemIcon !== currentItemIcon) {
205
+ return false;
206
+ }
202
207
  const currentIndexDate = new Date(item.timestamp);
203
208
  const previousIndexDate = new Date(this.items[index - 1].timestamp);
204
209
  const previousItemDate = new Date(previousIndexDate);
@@ -187,7 +187,7 @@ const Feed = class {
187
187
  */
188
188
  this.totalCount = 0;
189
189
  this.isBundled = (item, index) => {
190
- var _a, _b, _c;
190
+ var _a, _b, _c, _d, _e, _f;
191
191
  if (index === 0) {
192
192
  return false;
193
193
  }
@@ -196,6 +196,11 @@ const Feed = class {
196
196
  if (previousAuthorId !== currentAuthorId) {
197
197
  return false;
198
198
  }
199
+ const previousItemIcon = (_e = (_d = this.items[index - 1]) === null || _d === void 0 ? void 0 : _d.icon) === null || _e === void 0 ? void 0 : _e.name;
200
+ const currentItemIcon = (_f = item === null || item === void 0 ? void 0 : item.icon) === null || _f === void 0 ? void 0 : _f.name;
201
+ if (previousItemIcon !== currentItemIcon) {
202
+ return false;
203
+ }
199
204
  const currentIndexDate = new Date(item.timestamp);
200
205
  const previousIndexDate = new Date(this.items[index - 1].timestamp);
201
206
  const previousItemDate = new Date(previousIndexDate);
@@ -1 +1 @@
1
- import{p as e,b as t}from"./p-2912b7e7.js";(()=>{const t=import.meta.url,l={};return""!==t&&(l.resourcesUrl=new URL(".",t).href),e(l)})().then((e=>t([["p-81bfe796",[[1,"limebb-date-range",{platform:[16],context:[16],startTime:[16],endTime:[16],startTimeLabel:[1,"start-time-label"],endTimeLabel:[1,"end-time-label"],language:[1],timeFormat:[1,"time-format"],type:[1]}]]],["p-6b4d3117",[[1,"limebb-feed",{platform:[16],context:[16],items:[16],emptyStateMessage:[1,"empty-state-message"],loading:[4],minutesOfProximity:[2,"minutes-of-proximity"],totalCount:[2,"total-count"]}]]],["p-86ded1d6",[[1,"limebb-currency-picker",{label:[513],platform:[16],currencies:[16],helperText:[513,"helper-text"],required:[516],readonly:[516],invalid:[516],disabled:[516],value:[8]}]]],["p-0f8928a9",[[1,"limebb-dashboard-widget",{heading:[513],subheading:[513],supportingText:[513,"supporting-text"],icon:[513]}]]],["p-44a09a10",[[1,"limebb-icon-picker",{value:[1],required:[4],readonly:[4],invalid:[4],disabled:[4],label:[1],helperText:[1,"helper-text"]}]]],["p-21414a6b",[[1,"limebb-locale-picker",{platform:[16],context:[16],value:[1],required:[4],disabled:[4],label:[1],helperText:[1,"helper-text"],readonly:[4],multipleChoice:[4,"multiple-choice"],allLanguages:[32]}]]],["p-6ad70097",[[1,"limebb-navigation-button",{href:[513],tooltipLabel:[513,"tooltip-label"],tooltipHelperLabel:[513,"tooltip-helper-label"],type:[513]}]]],["p-225c0001",[[1,"limebb-date-picker",{platform:[16],context:[16],disabled:[516],readonly:[516],invalid:[516],label:[513],placeholder:[513],helperText:[513,"helper-text"],required:[516],value:[1],type:[513]}]]],["p-6dc6addd",[[1,"limebb-feed-timeline-item",{platform:[16],context:[16],item:[16],type:[513],isBundled:[516,"is-bundled"],showMore:[32],isTall:[32]}]]]],e)));
1
+ import{p as e,b as t}from"./p-2912b7e7.js";(()=>{const t=import.meta.url,l={};return""!==t&&(l.resourcesUrl=new URL(".",t).href),e(l)})().then((e=>t([["p-81bfe796",[[1,"limebb-date-range",{platform:[16],context:[16],startTime:[16],endTime:[16],startTimeLabel:[1,"start-time-label"],endTimeLabel:[1,"end-time-label"],language:[1],timeFormat:[1,"time-format"],type:[1]}]]],["p-461451b1",[[1,"limebb-feed",{platform:[16],context:[16],items:[16],emptyStateMessage:[1,"empty-state-message"],loading:[4],minutesOfProximity:[2,"minutes-of-proximity"],totalCount:[2,"total-count"]}]]],["p-86ded1d6",[[1,"limebb-currency-picker",{label:[513],platform:[16],currencies:[16],helperText:[513,"helper-text"],required:[516],readonly:[516],invalid:[516],disabled:[516],value:[8]}]]],["p-0f8928a9",[[1,"limebb-dashboard-widget",{heading:[513],subheading:[513],supportingText:[513,"supporting-text"],icon:[513]}]]],["p-44a09a10",[[1,"limebb-icon-picker",{value:[1],required:[4],readonly:[4],invalid:[4],disabled:[4],label:[1],helperText:[1,"helper-text"]}]]],["p-21414a6b",[[1,"limebb-locale-picker",{platform:[16],context:[16],value:[1],required:[4],disabled:[4],label:[1],helperText:[1,"helper-text"],readonly:[4],multipleChoice:[4,"multiple-choice"],allLanguages:[32]}]]],["p-6ad70097",[[1,"limebb-navigation-button",{href:[513],tooltipLabel:[513,"tooltip-label"],tooltipHelperLabel:[513,"tooltip-helper-label"],type:[513]}]]],["p-225c0001",[[1,"limebb-date-picker",{platform:[16],context:[16],disabled:[516],readonly:[516],invalid:[516],label:[513],placeholder:[513],helperText:[513,"helper-text"],required:[516],value:[1],type:[513]}]]],["p-6dc6addd",[[1,"limebb-feed-timeline-item",{platform:[16],context:[16],item:[16],type:[513],isBundled:[516,"is-bundled"],showMore:[32],isTall:[32]}]]]],e)));
@@ -0,0 +1 @@
1
+ import{r as e,c as t,h as r}from"./p-2912b7e7.js";import{P as i}from"./p-bc052012.js";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function s(e){o(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===n(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}function a(e,t){return o(2,arguments),s(e).getTime()-s(t).getTime()}var l={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function d(e){return e?l[e]:l.trunc}const u=class{constructor(r){e(this,r),this.promotedActionSelected=t(this,"promotedActionSelected",7),this.loadMore=t(this,"loadMore",7),this.items=[],this.minutesOfProximity=5,this.totalCount=0,this.isBundled=(e,t)=>{var r,i,n,s,l,u;if(0===t)return!1;if((null===(i=null===(r=this.items[t-1])||void 0===r?void 0:r.author)||void 0===i?void 0:i.id)!==(null===(n=null==e?void 0:e.author)||void 0===n?void 0:n.id))return!1;if((null===(l=null===(s=this.items[t-1])||void 0===s?void 0:s.icon)||void 0===l?void 0:l.name)!==(null===(u=null==e?void 0:e.icon)||void 0===u?void 0:u.name))return!1;const c=new Date(e.timestamp),m=new Date(this.items[t-1].timestamp),f=new Date(m);return function(e,t,r){o(2,arguments);var i=a(e,t)/6e4;return d(null==r?void 0:r.roundingMethod)(i)}(new Date(c),f)<=this.minutesOfProximity},this.handleLoadMore=e=>{e.stopPropagation(),this.loadMore.emit()}}render(){return[this.renderLoadMore(),this.renderEmptyFeedMessage(),this.renderSpinner(),this.renderFeedItems()]}renderSpinner(){if(this.loading)return r("limel-spinner",{size:"small"})}renderEmptyFeedMessage(){if(!this.loading)return 0===this.items.length?r("p",{class:"empty-state"},this.emptyStateMessage):void 0}renderFeedItems(){return this.items.map(((e,t)=>[this.renderDateHeader(e.timestamp,t),r("limebb-feed-timeline-item",{platform:this.platform,context:this.context,item:e,key:e.id,type:null==e?void 0:e.type,isBundled:this.isBundled(e,t)})]))}renderDateHeader(e,t){const i=this.dateTimeFormatter.format(e,"date");return 0===t||this.dateTimeFormatter.format(this.items[t-1].timestamp,"date")!==i?r("a",{class:"date-heading"},i):void 0}renderLoadMore(){if(this.items.length&&!(this.totalCount<=this.items.length))return r("limel-icon-button",{class:"view-load-more_button",icon:"more",onClick:this.handleLoadMore,elevated:!0,label:"Load more"})}get dateTimeFormatter(){return this.platform.get(i.DateTimeFormatter)}};u.style=":host(limebb-feed){--limebb-feed-background-color:var(\n --feed-background-color,\n rgb(var(--contrast-100))\n );--limebb-feed-item-background-color:var(--contrast-300);display:flex;flex-direction:column;gap:0.25rem;max-width:45rem;background-color:var(--limebb-feed-background-color)}.empty-state{text-align:center}limel-spinner{align-self:center;justify-self:center;margin:auto}.date-heading{font-weight:600;font-size:0.875rem;margin:1.25rem 0 0.5rem 0;color:rgb(var(--contrast-900))}limebb-feed-timeline-item:has(+limebb-feed-timeline-item[is-bundled]){--limebb-feed-item-action-bar-grid-template-rows:0fr}";export{u as limebb_feed}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-crm-building-blocks",
3
- "version": "1.25.1",
3
+ "version": "1.25.2",
4
4
  "description": "A home for shared components meant for use with Lime CRM",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -41,7 +41,7 @@
41
41
  "access": "public"
42
42
  },
43
43
  "devDependencies": {
44
- "@limetech/lime-elements": "^37.1.0-next.84",
44
+ "@limetech/lime-elements": "^37.1.0-next.86",
45
45
  "@limetech/lime-web-components": "^5.21.0",
46
46
  "@lundalogik/lime-icons8": "^2.16.0",
47
47
  "@lundalogik/limeclient.js": "^1.53.2",
@@ -1 +0,0 @@
1
- import{r as e,c as t,h as r}from"./p-2912b7e7.js";import{P as n}from"./p-bc052012.js";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function s(e){o(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===i(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}function a(e,t){return o(2,arguments),s(e).getTime()-s(t).getTime()}var l={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function d(e){return e?l[e]:l.trunc}const c=class{constructor(r){e(this,r),this.promotedActionSelected=t(this,"promotedActionSelected",7),this.loadMore=t(this,"loadMore",7),this.items=[],this.minutesOfProximity=5,this.totalCount=0,this.isBundled=(e,t)=>{var r,n,i;if(0===t)return!1;if((null===(n=null===(r=this.items[t-1])||void 0===r?void 0:r.author)||void 0===n?void 0:n.id)!==(null===(i=null==e?void 0:e.author)||void 0===i?void 0:i.id))return!1;const s=new Date(e.timestamp),l=new Date(this.items[t-1].timestamp),c=new Date(l);return function(e,t,r){o(2,arguments);var n=a(e,t)/6e4;return d(null==r?void 0:r.roundingMethod)(n)}(new Date(s),c)<=this.minutesOfProximity},this.handleLoadMore=e=>{e.stopPropagation(),this.loadMore.emit()}}render(){return[this.renderLoadMore(),this.renderEmptyFeedMessage(),this.renderSpinner(),this.renderFeedItems()]}renderSpinner(){if(this.loading)return r("limel-spinner",{size:"small"})}renderEmptyFeedMessage(){if(!this.loading)return 0===this.items.length?r("p",{class:"empty-state"},this.emptyStateMessage):void 0}renderFeedItems(){return this.items.map(((e,t)=>[this.renderDateHeader(e.timestamp,t),r("limebb-feed-timeline-item",{platform:this.platform,context:this.context,item:e,key:e.id,type:null==e?void 0:e.type,isBundled:this.isBundled(e,t)})]))}renderDateHeader(e,t){const n=this.dateTimeFormatter.format(e,"date");return 0===t||this.dateTimeFormatter.format(this.items[t-1].timestamp,"date")!==n?r("a",{class:"date-heading"},n):void 0}renderLoadMore(){if(this.items.length&&!(this.totalCount<=this.items.length))return r("limel-icon-button",{class:"view-load-more_button",icon:"more",onClick:this.handleLoadMore,elevated:!0,label:"Load more"})}get dateTimeFormatter(){return this.platform.get(n.DateTimeFormatter)}};c.style=":host(limebb-feed){--limebb-feed-background-color:var(\n --feed-background-color,\n rgb(var(--contrast-100))\n );--limebb-feed-item-background-color:var(--contrast-300);display:flex;flex-direction:column;gap:0.25rem;max-width:45rem;background-color:var(--limebb-feed-background-color)}.empty-state{text-align:center}limel-spinner{align-self:center;justify-self:center;margin:auto}.date-heading{font-weight:600;font-size:0.875rem;margin:1.25rem 0 0.5rem 0;color:rgb(var(--contrast-900))}limebb-feed-timeline-item:has(+limebb-feed-timeline-item[is-bundled]){--limebb-feed-item-action-bar-grid-template-rows:0fr}";export{c as limebb_feed}