@limetech/lime-crm-building-blocks 1.21.12 → 1.21.13
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/cjs/limebb-feed_2.cjs.entry.js +7 -2
- package/dist/collection/components/feed/feed-item/feed-timeline-item.js +7 -2
- package/dist/components/feed-timeline-item.js +7 -2
- package/dist/esm/limebb-feed_2.entry.js +7 -2
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/p-e35e1007.entry.js +1 -0
- package/dist/types/components/feed/feed-item/feed-timeline-item.d.ts +2 -1
- package/package.json +1 -1
- package/dist/lime-crm-building-blocks/p-137aa83c.entry.js +0 -1
|
@@ -350,10 +350,11 @@ const FeedTimelineItem = class {
|
|
|
350
350
|
];
|
|
351
351
|
}
|
|
352
352
|
toggleShowMoreLabel() {
|
|
353
|
+
var _a, _b;
|
|
353
354
|
if (this.showMore) {
|
|
354
|
-
return '
|
|
355
|
+
return (_a = this.translator) === null || _a === void 0 ? void 0 : _a.get('webclient.show-less');
|
|
355
356
|
}
|
|
356
|
-
return '
|
|
357
|
+
return (_b = this.translator) === null || _b === void 0 ? void 0 : _b.get('webclient.show-more');
|
|
357
358
|
}
|
|
358
359
|
renderUnpromotedActionsMenu() {
|
|
359
360
|
var _a;
|
|
@@ -379,6 +380,10 @@ const FeedTimelineItem = class {
|
|
|
379
380
|
get dateTimeFormatter() {
|
|
380
381
|
return this.platform.get(types.PlatformServiceName.DateTimeFormatter);
|
|
381
382
|
}
|
|
383
|
+
get translator() {
|
|
384
|
+
var _a;
|
|
385
|
+
return (_a = this.platform) === null || _a === void 0 ? void 0 : _a.get(types.PlatformServiceName.Translate);
|
|
386
|
+
}
|
|
382
387
|
get el() { return index$1.getElement(this); }
|
|
383
388
|
};
|
|
384
389
|
FeedTimelineItem.style = feedTimelineItemCss;
|
|
@@ -152,10 +152,11 @@ export class FeedTimelineItem {
|
|
|
152
152
|
];
|
|
153
153
|
}
|
|
154
154
|
toggleShowMoreLabel() {
|
|
155
|
+
var _a, _b;
|
|
155
156
|
if (this.showMore) {
|
|
156
|
-
return '
|
|
157
|
+
return (_a = this.translator) === null || _a === void 0 ? void 0 : _a.get('webclient.show-less');
|
|
157
158
|
}
|
|
158
|
-
return '
|
|
159
|
+
return (_b = this.translator) === null || _b === void 0 ? void 0 : _b.get('webclient.show-more');
|
|
159
160
|
}
|
|
160
161
|
renderUnpromotedActionsMenu() {
|
|
161
162
|
var _a;
|
|
@@ -181,6 +182,10 @@ export class FeedTimelineItem {
|
|
|
181
182
|
get dateTimeFormatter() {
|
|
182
183
|
return this.platform.get(PlatformServiceName.DateTimeFormatter);
|
|
183
184
|
}
|
|
185
|
+
get translator() {
|
|
186
|
+
var _a;
|
|
187
|
+
return (_a = this.platform) === null || _a === void 0 ? void 0 : _a.get(PlatformServiceName.Translate);
|
|
188
|
+
}
|
|
184
189
|
static get is() { return "limebb-feed-timeline-item"; }
|
|
185
190
|
static get encapsulation() { return "shadow"; }
|
|
186
191
|
static get originalStyleUrls() {
|
|
@@ -155,10 +155,11 @@ const FeedTimelineItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
155
155
|
];
|
|
156
156
|
}
|
|
157
157
|
toggleShowMoreLabel() {
|
|
158
|
+
var _a, _b;
|
|
158
159
|
if (this.showMore) {
|
|
159
|
-
return '
|
|
160
|
+
return (_a = this.translator) === null || _a === void 0 ? void 0 : _a.get('webclient.show-less');
|
|
160
161
|
}
|
|
161
|
-
return '
|
|
162
|
+
return (_b = this.translator) === null || _b === void 0 ? void 0 : _b.get('webclient.show-more');
|
|
162
163
|
}
|
|
163
164
|
renderUnpromotedActionsMenu() {
|
|
164
165
|
var _a;
|
|
@@ -184,6 +185,10 @@ const FeedTimelineItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
184
185
|
get dateTimeFormatter() {
|
|
185
186
|
return this.platform.get(PlatformServiceName.DateTimeFormatter);
|
|
186
187
|
}
|
|
188
|
+
get translator() {
|
|
189
|
+
var _a;
|
|
190
|
+
return (_a = this.platform) === null || _a === void 0 ? void 0 : _a.get(PlatformServiceName.Translate);
|
|
191
|
+
}
|
|
187
192
|
get el() { return this; }
|
|
188
193
|
static get style() { return feedTimelineItemCss; }
|
|
189
194
|
}, [1, "limebb-feed-timeline-item", {
|
|
@@ -346,10 +346,11 @@ const FeedTimelineItem = class {
|
|
|
346
346
|
];
|
|
347
347
|
}
|
|
348
348
|
toggleShowMoreLabel() {
|
|
349
|
+
var _a, _b;
|
|
349
350
|
if (this.showMore) {
|
|
350
|
-
return '
|
|
351
|
+
return (_a = this.translator) === null || _a === void 0 ? void 0 : _a.get('webclient.show-less');
|
|
351
352
|
}
|
|
352
|
-
return '
|
|
353
|
+
return (_b = this.translator) === null || _b === void 0 ? void 0 : _b.get('webclient.show-more');
|
|
353
354
|
}
|
|
354
355
|
renderUnpromotedActionsMenu() {
|
|
355
356
|
var _a;
|
|
@@ -375,6 +376,10 @@ const FeedTimelineItem = class {
|
|
|
375
376
|
get dateTimeFormatter() {
|
|
376
377
|
return this.platform.get(PlatformServiceName.DateTimeFormatter);
|
|
377
378
|
}
|
|
379
|
+
get translator() {
|
|
380
|
+
var _a;
|
|
381
|
+
return (_a = this.platform) === null || _a === void 0 ? void 0 : _a.get(PlatformServiceName.Translate);
|
|
382
|
+
}
|
|
378
383
|
get el() { return getElement(this); }
|
|
379
384
|
};
|
|
380
385
|
FeedTimelineItem.style = feedTimelineItemCss;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as a}from"./p-2912b7e7.js";(()=>{const a=import.meta.url,l={};return""!==a&&(l.resourcesUrl=new URL(".",a).href),e(l)})().then((e=>a([["p-23d68f3e",[[1,"limebb-example-date-picker-date",{value:[32]}]]],["p-02ed3a92",[[1,"limebb-example-date-picker-datetime",{value:[32]}]]],["p-c7e749f8",[[1,"limebb-example-date-picker-time",{value:[32]}]]],["p-c4da03cb",[[1,"limebb-example-date-picker-week",{value:[32]}]]],["p-24a19099",[[1,"limebb-example-date-range"]]],["p-e37e8e1a",[[1,"limebb-example-feed"]]],["p-eb122f28",[[1,"limebb-example-feed-author"]]],["p-b0ca91ce",[[1,"limebb-example-feed-author-picture"]]],["p-33174280",[[1,"limebb-example-feed-item-heading"]]],["p-5faf8443",[[1,"limebb-example-feed-load-more",{objectIds:[32]}]]],["p-d768ffbb",[[1,"limebb-example-feed-promoted-actions"]]],["p-3372d170",[[1,"limebb-example-feed-relations"]]],["p-5e8d501a",[[1,"limebb-example-feed-tall-item"]]],["p-c362a46c",[[1,"limebb-example-feed-unpromoted-actions"]]],["p-a437678e",[[1,"limebb-example-currency-picker",{selectedCurrency:[32]}]]],["p-e0627848",[[1,"limebb-example-currency-picker-european",{selectedCurrency:[32]}]]],["p-57e53a2d",[[1,"limebb-example-currency-picker-nordic",{selectedCurrency:[32]}]]],["p-0f8928a9",[[1,"limebb-dashboard-widget",{heading:[513],subheading:[513],supportingText:[513,"supporting-text"],icon:[513]}]]],["p-43a286a7",[[1,"limebb-example-dashboard-widget"]]],["p-0aaaaca0",[[1,"limebb-example-dashboard-widget-slots",{filterMyDeals:[32]}]]],["p-56ba707b",[[1,"limebb-example-dashboard-widget-styles"]]],["p-791741c6",[[1,"limebb-example-icon-picker",{value:[32]}]]],["p-11f8f221",[[1,"limebb-example-locale-picker",{value:[1]}]]],["p-d5f700c5",[[1,"limebb-example-locale-picker-multiple",{value:[1]}]]],["p-6ad70097",[[1,"limebb-navigation-button",{href:[513],tooltipLabel:[513,"tooltip-label"],tooltipHelperLabel:[513,"tooltip-helper-label"],type:[513]}]]],["p-79de4c38",[[1,"limebb-example-navigation-button-back"]]],["p-e7607495",[[1,"limebb-example-navigation-button-close"]]],["p-1ffc17ec",[[1,"limebb-example-navigation-button-expand"]]],["p-94fb580f",[[1,"limebb-example-navigation-button-float"]]],["p-7c3e338d",[[1,"limebb-example-navigation-button-maximize"]]],["p-bca75a1a",[[1,"limebb-example-navigation-button-minimize"]]],["p-6b000acf",[[1,"limebb-example-navigation-button-new-tab"]]],["p-636a38e8",[[1,"limebb-example-navigation-button-shrink"]]],["p-9e026e05",[[0,"limebb-example-value",{label:[513],value:[8]}],[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-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-3998474e",[[1,"limebb-icon-picker",{value:[1],required:[4],readonly:[4],invalid:[4],disabled:[4],label:[1],helperText:[1,"helper-text"]}]]],["p-32e4364a",[[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-354078b7",[[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-
|
|
1
|
+
import{p as e,b as a}from"./p-2912b7e7.js";(()=>{const a=import.meta.url,l={};return""!==a&&(l.resourcesUrl=new URL(".",a).href),e(l)})().then((e=>a([["p-23d68f3e",[[1,"limebb-example-date-picker-date",{value:[32]}]]],["p-02ed3a92",[[1,"limebb-example-date-picker-datetime",{value:[32]}]]],["p-c7e749f8",[[1,"limebb-example-date-picker-time",{value:[32]}]]],["p-c4da03cb",[[1,"limebb-example-date-picker-week",{value:[32]}]]],["p-24a19099",[[1,"limebb-example-date-range"]]],["p-e37e8e1a",[[1,"limebb-example-feed"]]],["p-eb122f28",[[1,"limebb-example-feed-author"]]],["p-b0ca91ce",[[1,"limebb-example-feed-author-picture"]]],["p-33174280",[[1,"limebb-example-feed-item-heading"]]],["p-5faf8443",[[1,"limebb-example-feed-load-more",{objectIds:[32]}]]],["p-d768ffbb",[[1,"limebb-example-feed-promoted-actions"]]],["p-3372d170",[[1,"limebb-example-feed-relations"]]],["p-5e8d501a",[[1,"limebb-example-feed-tall-item"]]],["p-c362a46c",[[1,"limebb-example-feed-unpromoted-actions"]]],["p-a437678e",[[1,"limebb-example-currency-picker",{selectedCurrency:[32]}]]],["p-e0627848",[[1,"limebb-example-currency-picker-european",{selectedCurrency:[32]}]]],["p-57e53a2d",[[1,"limebb-example-currency-picker-nordic",{selectedCurrency:[32]}]]],["p-0f8928a9",[[1,"limebb-dashboard-widget",{heading:[513],subheading:[513],supportingText:[513,"supporting-text"],icon:[513]}]]],["p-43a286a7",[[1,"limebb-example-dashboard-widget"]]],["p-0aaaaca0",[[1,"limebb-example-dashboard-widget-slots",{filterMyDeals:[32]}]]],["p-56ba707b",[[1,"limebb-example-dashboard-widget-styles"]]],["p-791741c6",[[1,"limebb-example-icon-picker",{value:[32]}]]],["p-11f8f221",[[1,"limebb-example-locale-picker",{value:[1]}]]],["p-d5f700c5",[[1,"limebb-example-locale-picker-multiple",{value:[1]}]]],["p-6ad70097",[[1,"limebb-navigation-button",{href:[513],tooltipLabel:[513,"tooltip-label"],tooltipHelperLabel:[513,"tooltip-helper-label"],type:[513]}]]],["p-79de4c38",[[1,"limebb-example-navigation-button-back"]]],["p-e7607495",[[1,"limebb-example-navigation-button-close"]]],["p-1ffc17ec",[[1,"limebb-example-navigation-button-expand"]]],["p-94fb580f",[[1,"limebb-example-navigation-button-float"]]],["p-7c3e338d",[[1,"limebb-example-navigation-button-maximize"]]],["p-bca75a1a",[[1,"limebb-example-navigation-button-minimize"]]],["p-6b000acf",[[1,"limebb-example-navigation-button-new-tab"]]],["p-636a38e8",[[1,"limebb-example-navigation-button-shrink"]]],["p-9e026e05",[[0,"limebb-example-value",{label:[513],value:[8]}],[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-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-3998474e",[[1,"limebb-icon-picker",{value:[1],required:[4],readonly:[4],invalid:[4],disabled:[4],label:[1],helperText:[1,"helper-text"]}]]],["p-32e4364a",[[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-354078b7",[[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-e35e1007",[[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"],unpromotedActionsMenuLabel:[1,"unpromoted-actions-menu-label"]}],[1,"limebb-feed-timeline-item",{platform:[16],context:[16],item:[16],isBundled:[516,"is-bundled"],unpromotedActionsMenuLabel:[1,"unpromoted-actions-menu-label"],showMore:[32],isTall:[32]}]]]],e)));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,c as t,h as i,H as o,g as r}from"./p-2912b7e7.js";import{P as s}from"./p-bc052012.js";import{r as a,t as n}from"./p-1095efdb.js";function l(e,t){return a(2,arguments),n(e).getTime()-n(t).getTime()}var d={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function m(e){return e?d[e]:d.trunc}const h=class{constructor(i){e(this,i),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 i,o,r;if(0===t)return!1;if((null===(o=null===(i=this.items[t-1])||void 0===i?void 0:i.author)||void 0===o?void 0:o.id)!==(null===(r=null==e?void 0:e.author)||void 0===r?void 0:r.id))return!1;const s=new Date(e.timestamp),n=new Date(this.items[t-1].timestamp),d=new Date(n);return function(e,t,i){a(2,arguments);var o=l(e,t)/6e4;return m(null==i?void 0:i.roundingMethod)(o)}(new Date(s),d)<=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 i("limel-spinner",{size:"small"})}renderEmptyFeedMessage(){if(!this.loading)return 0===this.items.length?i("p",{class:"empty-state"},this.emptyStateMessage):void 0}renderFeedItems(){return this.items.map(((e,t)=>[this.renderDateHeader(e.timestamp,t),i("limebb-feed-timeline-item",{platform:this.platform,context:this.context,item:e,key:e.id,isBundled:this.isBundled(e,t),unpromotedActionsMenuLabel:this.unpromotedActionsMenuLabel})]))}renderDateHeader(e,t){const o=this.dateTimeFormatter.format(e,"date");return 0===t||this.dateTimeFormatter.format(this.items[t-1].timestamp,"date")!==o?i("a",{class:"date-heading"},o):void 0}renderLoadMore(){if(this.items.length&&!(this.totalCount<=this.items.length))return i("limel-icon-button",{class:"view-load-more_button",icon:"more",onClick:this.handleLoadMore,elevated:!0,label:"Load more"})}get dateTimeFormatter(){return this.platform.get(s.DateTimeFormatter)}};h.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}";const c=class{constructor(o){e(this,o),this.itemSelected=t(this,"itemSelected",7),this.promotedActionSelected=t(this,"promotedActionSelected",7),this.isBundled=!1,this.showMore=!1,this.isTall=!1,this.bodyTextTall=e=>{if(!(null==e?void 0:e.length))return;const t=e[0].contentRect.height;this.isTall=t>160,void 0===this.bodyTextHeight&&(this.bodyTextHeight=t)},this.renderHeader=()=>{if((!this.isBundled||this.item.heading)&&(this.item.author||this.item.heading))return i("div",{class:"header"},this.renderAuthor(),this.renderHeading())},this.renderRelations=()=>{var e,t;if(null===(e=this.item)||void 0===e?void 0:e.relations)return i("limel-chip-set",{value:null===(t=this.item)||void 0===t?void 0:t.relations})},this.setBodyTextElement=e=>{this.bodyTextElement=e},this.toggleShowMore=()=>{this.showMore=!this.showMore},this.handleMenuItemSelect=e=>{e.stopPropagation(),this.itemSelected.emit(e.detail)},this.handleActionBarItemSelect=e=>{e.stopPropagation(),this.promotedActionSelected.emit(e.detail)}}componentDidLoad(){this.bodyTextElement&&(this.resizeObserver=new ResizeObserver(this.bodyTextTall),this.resizeObserver.observe(this.bodyTextElement))}disconnectedCallback(){var e;null===(e=this.resizeObserver)||void 0===e||e.disconnect()}render(){var e,t;return i(o,{id:this.item.id,class:{"has-unpromoted-actions":!!(null===(e=this.item.unpromotedActions)||void 0===e?void 0:e.length),"has-author-picture":!!(null===(t=this.item.author)||void 0===t?void 0:t.picture),"shows-less":!this.showMore,"shows-more":this.showMore,"is-tall":this.isTall},style:{"--body-text-height":`${this.bodyTextHeight}`}},this.renderBadgeAndTimestamp(),this.renderContent())}renderBadgeAndTimestamp(){return i("div",{class:"left"},i("div",{class:"info"},this.renderAuthorPicture(),this.renderIcon(),i("span",{class:"timestamp"},this.renderTimestamp())))}renderIcon(){var e,t,o,r,s;if(!this.isBundled&&(this.item.icon||!(null===(e=this.item.author)||void 0===e?void 0:e.picture)))return i("limel-icon",{class:"icon",badge:!0,name:null!==(o=null===(t=this.item.icon)||void 0===t?void 0:t.name)&&void 0!==o?o:"dot_circle",style:{color:`${null===(r=this.item.icon)||void 0===r?void 0:r.color}`,"background-color":`${null===(s=this.item.icon)||void 0===s?void 0:s.backgroundColor}`}})}renderContent(){return i("div",{class:"right"},i("div",{class:"content"},this.renderHeader(),this.renderUnpromotedActionsMenu(),this.renderValue(),this.renderRelations()),this.renderPromotedActions())}renderAuthor(){if(this.item.author&&(!this.isBundled||this.item.heading)){if("string"==typeof this.item.author.name)return i("span",{class:"author"},this.item.author.name);if("object"==typeof this.item.author.name){const{href:e,title:t,text:o}=this.item.author.name;return i("a",{class:"author",href:e,title:t},o)}}}renderAuthorPicture(){var e;if(null===(e=this.item.author)||void 0===e?void 0:e.picture)return i("img",{loading:"lazy",src:this.item.author.picture})}renderHeading(){if(this.item.heading)return i("limel-markdown",{class:"heading truncate-paragraphs",value:this.item.heading})}renderValue(){if(this.item.value)return[i("div",{class:"markdown-container"},i("limel-markdown",{class:"body-text",value:this.item.value,ref:this.setBodyTextElement}),this.renderShowMoreButton())]}renderShowMoreButton(){if(this.isTall)return[i("button",{id:"show-more-button",type:"button",onClick:this.toggleShowMore},i("limel-icon",{name:"angle_down"})),i("limel-tooltip",{label:this.toggleShowMoreLabel(),elementId:"show-more-button",openDirection:"top"})]}toggleShowMoreLabel(){var e,t;return this.showMore?null===(e=this.translator)||void 0===e?void 0:e.get("webclient.show-less"):null===(t=this.translator)||void 0===t?void 0:t.get("webclient.show-more")}renderUnpromotedActionsMenu(){var e;if(null===(e=this.item.unpromotedActions)||void 0===e?void 0:e.length)return i("limel-menu",{class:"unpromoted-actions-menu",items:this.item.unpromotedActions,openDirection:"bottom-end",onSelect:this.handleMenuItemSelect},i("limel-icon-button",{icon:"menu_2",slot:"trigger",label:this.unpromotedActionsMenuLabel}))}renderPromotedActions(){var e;if(null===(e=this.item.promotedActions)||void 0===e?void 0:e.length)return i("div",{class:"action-bar"},i("div",{class:"action-bar-hider"},i("limel-action-bar",{accessibleLabel:"Action bar",actions:this.item.promotedActions,layout:"fullWidth",onItemSelected:this.handleActionBarItemSelect})))}renderTimestamp(){const e=this.item.timestamp;if(e)return this.dateTimeFormatter.format(e,"timeofday")}get dateTimeFormatter(){return this.platform.get(s.DateTimeFormatter)}get translator(){var e;return null===(e=this.platform)||void 0===e?void 0:e.get(s.Translate)}get el(){return r(this)}};c.style='@charset "UTF-8";*{box-sizing:border-box}:host(limebb-feed-timeline-item){--limebb-feed-item-paddings:0.75rem;display:flex;gap:0.75rem;position:relative;isolation:isolate}:host(limebb-feed-timeline-item:hover) .timestamp{color:rgb(var(--contrast-1100))}:host(limebb-feed-timeline-item[is-bundled]:hover){--limebb-feed-item-timestamp-opacity-delay:0.5s}:host(limebb-feed-timeline-item[is-bundled]:hover) .timestamp{opacity:1}:host(limebb-feed-timeline-item[is-bundled]) .timestamp{opacity:0}.left:before{content:"";position:absolute;z-index:0;top:-0.25rem;bottom:-0.25rem;left:1rem;width:1px;background-color:rgb(var(--contrast-600));z-index:-1}.info{position:sticky;top:0.5rem;display:flex;flex-direction:column;align-items:center;gap:0.25rem}.right,.content{display:flex;flex-direction:column;flex-grow:1;min-width:0}.content{border-radius:1rem;gap:0.25rem;background-color:rgb(var(--limebb-feed-item-background-color));padding:var(--limebb-feed-item-paddings)}.header{display:flex;align-items:center;gap:0.25rem;padding-bottom:0.25rem;margin-top:-0.25rem;color:rgb(var(--contrast-900));font-size:smaller}:host(.has-unpromoted-actions) .header{padding-right:2rem}.heading{flex-grow:1;overflow:hidden;white-space:nowrap}.unpromoted-actions-menu{position:absolute;top:0;right:0}.timestamp{transition:color 0.4s ease, opacity 0.2s ease;transition-delay:var(--limebb-feed-item-timestamp-opacity-delay, 0s);font-size:0.75rem;text-align:center;color:rgb(var(--contrast-800));background-color:var(--limebb-feed-background-color);padding:0.125rem 0}.icon{--icon-background-color:var(--limebb-feed-background-color);width:2rem;padding:0.125rem}:host(.has-author-picture) .icon{width:1.5rem}img{border-radius:50%;width:2rem;height:2rem;object-fit:cover;box-shadow:0 0 0 1px rgb(var(--contrast-600))}.author{font-weight:bold;text-decoration:none}a.author{position:relative;cursor:pointer;transition:color 0.2s ease;color:rgb(var(--color-blue-default))}a.author:before{transition:opacity 0.2s ease, transform 0.3s ease-out;content:"";position:absolute;inset:auto 0 0 0;width:calc(100% - 0.5rem);margin:auto;height:0.125rem;border-radius:1rem;background-color:currentColor;opacity:0;transform:scale(0.6)}a.author:hover{color:rgb(var(--color-blue-default))}a.author:hover:before{opacity:0.3;transform:scale(1)}limel-chip-set{margin-left:-1rem;margin-bottom:-0.5rem}limel-action-bar{--action-bar-item-height:1.75rem;transition:opacity 0.2s ease;justify-content:flex-start;opacity:0.8}.action-bar{display:grid;transition:grid-template-rows var(--limebb-feed-item-action-bar-grid-template-rows-transition-speed, 0.2s) cubic-bezier(1, 0.09, 0, 0.89) var(--limebb-feed-item-action-bar-grid-template-rows-transition-delay, 0s);grid-template-rows:var(--limebb-feed-item-action-bar-grid-template-rows, 1fr)}.action-bar-hider{overflow:hidden}limel-action-bar{transition:padding var(--limebb-feed-item-action-bar-grid-template-rows-transition-speed) cubic-bezier(1, 0.09, 0, 0.89) var(--limebb-feed-item-action-bar-grid-template-rows-transition-delay);padding-bottom:0.5rem}:host(limebb-feed-timeline-item:hover) .action-bar,:host(limebb-feed-timeline-item:focus-within) .action-bar,:host(limebb-feed-timeline-item:focus-visible) .action-bar{--limebb-feed-item-action-bar-grid-template-rows:1fr;will-change:grid-template-rows}:host(limebb-feed-timeline-item:hover) limel-action-bar,:host(limebb-feed-timeline-item:focus-within) limel-action-bar,:host(limebb-feed-timeline-item:focus-visible) limel-action-bar{will-change:opacity;opacity:1}:host(limebb-feed-timeline-item:hover){--limebb-feed-item-action-bar-grid-template-rows-transition-speed:0.46s;--limebb-feed-item-action-bar-grid-template-rows-transition-delay:0.5s}:host(limebb-feed-timeline-item.is-tall) .markdown-container{margin-bottom:0.5rem}:host(limebb-feed-timeline-item.is-tall) .body-text{min-height:10.25rem}:host(limebb-feed-timeline-item.is-tall) .body-text:after{transition:opacity 0.6s ease;content:"";opacity:0.26;pointer-events:none;position:absolute;bottom:-0.125rem;right:-0.125rem;left:-0.125rem;height:2.5rem;background:radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0)) 0 100%, linear-gradient(to bottom, rgb(var(--limebb-feed-item-background-color), 0) 0%, rgb(var(--limebb-feed-item-background-color), 90%) 100%);background-repeat:no-repeat;background-size:100% 0.5rem, 100% 100%}:host(limebb-feed-timeline-item.is-tall.shows-less) .markdown-container{grid-template-rows:0fr}:host(limebb-feed-timeline-item.is-tall.shows-less) .body-text:after{opacity:1}:host(limebb-feed-timeline-item.is-tall.shows-more) .markdown-container{grid-template-rows:1fr}:host(limebb-feed-timeline-item.is-tall.shows-more) #show-more-button limel-icon{rotate:180deg}.markdown-container{transition:grid-template-rows calc(var(--body-text-height) * 1.2ms) cubic-bezier(1, 0.09, 0, 0.89);position:relative;display:grid}.body-text{display:block;overflow:hidden}#show-more-button{all:unset;transition:color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out;cursor:pointer;color:var(--mdc-theme-on-surface);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-normal);z-index:1;position:absolute;right:0;bottom:-0.6rem;left:0;margin:0 auto;display:flex;align-items:center;justify-content:center;border-radius:3rem;width:2rem;height:1rem}#show-more-button:hover{color:var(--mdc-theme-on-surface);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-hovered)}#show-more-button:active{box-shadow:var(--button-shadow-pressed);transform:translate3d(0, 0.08rem, 0)}#show-more-button:focus{outline:none}#show-more-button:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}#show-more-button limel-icon{transition:rotate 0.2s ease 0.5s;color:var(--mdc-theme-primary);width:0.75rem}';export{h as limebb_feed,c as limebb_feed_timeline_item}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
2
2
|
import { FeedItem } from './feed-item.types';
|
|
3
|
-
import { LimeWebComponent, LimeWebComponentContext, LimeWebComponentPlatform } from '@limetech/lime-web-components';
|
|
3
|
+
import { LimeWebComponent, LimeWebComponentContext, LimeWebComponentPlatform, Translator as TranslateService } from '@limetech/lime-web-components';
|
|
4
4
|
import { MenuItem, ActionBarItem } from '@limetech/lime-elements';
|
|
5
5
|
/**
|
|
6
6
|
* Feed item
|
|
@@ -77,4 +77,5 @@ export declare class FeedTimelineItem implements LimeWebComponent {
|
|
|
77
77
|
private handleMenuItemSelect;
|
|
78
78
|
private handleActionBarItemSelect;
|
|
79
79
|
private get dateTimeFormatter();
|
|
80
|
+
get translator(): TranslateService;
|
|
80
81
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,c as t,h as i,H as o,g as r}from"./p-2912b7e7.js";import{P as s}from"./p-bc052012.js";import{r as a,t as n}from"./p-1095efdb.js";function l(e,t){return a(2,arguments),n(e).getTime()-n(t).getTime()}var d={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function m(e){return e?d[e]:d.trunc}const h=class{constructor(i){e(this,i),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 i,o,r;if(0===t)return!1;if((null===(o=null===(i=this.items[t-1])||void 0===i?void 0:i.author)||void 0===o?void 0:o.id)!==(null===(r=null==e?void 0:e.author)||void 0===r?void 0:r.id))return!1;const s=new Date(e.timestamp),n=new Date(this.items[t-1].timestamp),d=new Date(n);return function(e,t,i){a(2,arguments);var o=l(e,t)/6e4;return m(null==i?void 0:i.roundingMethod)(o)}(new Date(s),d)<=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 i("limel-spinner",{size:"small"})}renderEmptyFeedMessage(){if(!this.loading)return 0===this.items.length?i("p",{class:"empty-state"},this.emptyStateMessage):void 0}renderFeedItems(){return this.items.map(((e,t)=>[this.renderDateHeader(e.timestamp,t),i("limebb-feed-timeline-item",{platform:this.platform,context:this.context,item:e,key:e.id,isBundled:this.isBundled(e,t),unpromotedActionsMenuLabel:this.unpromotedActionsMenuLabel})]))}renderDateHeader(e,t){const o=this.dateTimeFormatter.format(e,"date");return 0===t||this.dateTimeFormatter.format(this.items[t-1].timestamp,"date")!==o?i("a",{class:"date-heading"},o):void 0}renderLoadMore(){if(this.items.length&&!(this.totalCount<=this.items.length))return i("limel-icon-button",{class:"view-load-more_button",icon:"more",onClick:this.handleLoadMore,elevated:!0,label:"Load more"})}get dateTimeFormatter(){return this.platform.get(s.DateTimeFormatter)}};h.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}";const c=class{constructor(o){e(this,o),this.itemSelected=t(this,"itemSelected",7),this.promotedActionSelected=t(this,"promotedActionSelected",7),this.isBundled=!1,this.showMore=!1,this.isTall=!1,this.bodyTextTall=e=>{if(!(null==e?void 0:e.length))return;const t=e[0].contentRect.height;this.isTall=t>160,void 0===this.bodyTextHeight&&(this.bodyTextHeight=t)},this.renderHeader=()=>{if((!this.isBundled||this.item.heading)&&(this.item.author||this.item.heading))return i("div",{class:"header"},this.renderAuthor(),this.renderHeading())},this.renderRelations=()=>{var e,t;if(null===(e=this.item)||void 0===e?void 0:e.relations)return i("limel-chip-set",{value:null===(t=this.item)||void 0===t?void 0:t.relations})},this.setBodyTextElement=e=>{this.bodyTextElement=e},this.toggleShowMore=()=>{this.showMore=!this.showMore},this.handleMenuItemSelect=e=>{e.stopPropagation(),this.itemSelected.emit(e.detail)},this.handleActionBarItemSelect=e=>{e.stopPropagation(),this.promotedActionSelected.emit(e.detail)}}componentDidLoad(){this.bodyTextElement&&(this.resizeObserver=new ResizeObserver(this.bodyTextTall),this.resizeObserver.observe(this.bodyTextElement))}disconnectedCallback(){var e;null===(e=this.resizeObserver)||void 0===e||e.disconnect()}render(){var e,t;return i(o,{id:this.item.id,class:{"has-unpromoted-actions":!!(null===(e=this.item.unpromotedActions)||void 0===e?void 0:e.length),"has-author-picture":!!(null===(t=this.item.author)||void 0===t?void 0:t.picture),"shows-less":!this.showMore,"shows-more":this.showMore,"is-tall":this.isTall},style:{"--body-text-height":`${this.bodyTextHeight}`}},this.renderBadgeAndTimestamp(),this.renderContent())}renderBadgeAndTimestamp(){return i("div",{class:"left"},i("div",{class:"info"},this.renderAuthorPicture(),this.renderIcon(),i("span",{class:"timestamp"},this.renderTimestamp())))}renderIcon(){var e,t,o,r,s;if(!this.isBundled&&(this.item.icon||!(null===(e=this.item.author)||void 0===e?void 0:e.picture)))return i("limel-icon",{class:"icon",badge:!0,name:null!==(o=null===(t=this.item.icon)||void 0===t?void 0:t.name)&&void 0!==o?o:"dot_circle",style:{color:`${null===(r=this.item.icon)||void 0===r?void 0:r.color}`,"background-color":`${null===(s=this.item.icon)||void 0===s?void 0:s.backgroundColor}`}})}renderContent(){return i("div",{class:"right"},i("div",{class:"content"},this.renderHeader(),this.renderUnpromotedActionsMenu(),this.renderValue(),this.renderRelations()),this.renderPromotedActions())}renderAuthor(){if(this.item.author&&(!this.isBundled||this.item.heading)){if("string"==typeof this.item.author.name)return i("span",{class:"author"},this.item.author.name);if("object"==typeof this.item.author.name){const{href:e,title:t,text:o}=this.item.author.name;return i("a",{class:"author",href:e,title:t},o)}}}renderAuthorPicture(){var e;if(null===(e=this.item.author)||void 0===e?void 0:e.picture)return i("img",{loading:"lazy",src:this.item.author.picture})}renderHeading(){if(this.item.heading)return i("limel-markdown",{class:"heading truncate-paragraphs",value:this.item.heading})}renderValue(){if(this.item.value)return[i("div",{class:"markdown-container"},i("limel-markdown",{class:"body-text",value:this.item.value,ref:this.setBodyTextElement}),this.renderShowMoreButton())]}renderShowMoreButton(){if(this.isTall)return[i("button",{id:"show-more-button",type:"button",onClick:this.toggleShowMore},i("limel-icon",{name:"angle_down"})),i("limel-tooltip",{label:this.toggleShowMoreLabel(),elementId:"show-more-button",openDirection:"top"})]}toggleShowMoreLabel(){return this.showMore?"Show less":"Show more"}renderUnpromotedActionsMenu(){var e;if(null===(e=this.item.unpromotedActions)||void 0===e?void 0:e.length)return i("limel-menu",{class:"unpromoted-actions-menu",items:this.item.unpromotedActions,openDirection:"bottom-end",onSelect:this.handleMenuItemSelect},i("limel-icon-button",{icon:"menu_2",slot:"trigger",label:this.unpromotedActionsMenuLabel}))}renderPromotedActions(){var e;if(null===(e=this.item.promotedActions)||void 0===e?void 0:e.length)return i("div",{class:"action-bar"},i("div",{class:"action-bar-hider"},i("limel-action-bar",{accessibleLabel:"Action bar",actions:this.item.promotedActions,layout:"fullWidth",onItemSelected:this.handleActionBarItemSelect})))}renderTimestamp(){const e=this.item.timestamp;if(e)return this.dateTimeFormatter.format(e,"timeofday")}get dateTimeFormatter(){return this.platform.get(s.DateTimeFormatter)}get el(){return r(this)}};c.style='@charset "UTF-8";*{box-sizing:border-box}:host(limebb-feed-timeline-item){--limebb-feed-item-paddings:0.75rem;display:flex;gap:0.75rem;position:relative;isolation:isolate}:host(limebb-feed-timeline-item:hover) .timestamp{color:rgb(var(--contrast-1100))}:host(limebb-feed-timeline-item[is-bundled]:hover){--limebb-feed-item-timestamp-opacity-delay:0.5s}:host(limebb-feed-timeline-item[is-bundled]:hover) .timestamp{opacity:1}:host(limebb-feed-timeline-item[is-bundled]) .timestamp{opacity:0}.left:before{content:"";position:absolute;z-index:0;top:-0.25rem;bottom:-0.25rem;left:1rem;width:1px;background-color:rgb(var(--contrast-600));z-index:-1}.info{position:sticky;top:0.5rem;display:flex;flex-direction:column;align-items:center;gap:0.25rem}.right,.content{display:flex;flex-direction:column;flex-grow:1;min-width:0}.content{border-radius:1rem;gap:0.25rem;background-color:rgb(var(--limebb-feed-item-background-color));padding:var(--limebb-feed-item-paddings)}.header{display:flex;align-items:center;gap:0.25rem;padding-bottom:0.25rem;margin-top:-0.25rem;color:rgb(var(--contrast-900));font-size:smaller}:host(.has-unpromoted-actions) .header{padding-right:2rem}.heading{flex-grow:1;overflow:hidden;white-space:nowrap}.unpromoted-actions-menu{position:absolute;top:0;right:0}.timestamp{transition:color 0.4s ease, opacity 0.2s ease;transition-delay:var(--limebb-feed-item-timestamp-opacity-delay, 0s);font-size:0.75rem;text-align:center;color:rgb(var(--contrast-800));background-color:var(--limebb-feed-background-color);padding:0.125rem 0}.icon{--icon-background-color:var(--limebb-feed-background-color);width:2rem;padding:0.125rem}:host(.has-author-picture) .icon{width:1.5rem}img{border-radius:50%;width:2rem;height:2rem;object-fit:cover;box-shadow:0 0 0 1px rgb(var(--contrast-600))}.author{font-weight:bold;text-decoration:none}a.author{position:relative;cursor:pointer;transition:color 0.2s ease;color:rgb(var(--color-blue-default))}a.author:before{transition:opacity 0.2s ease, transform 0.3s ease-out;content:"";position:absolute;inset:auto 0 0 0;width:calc(100% - 0.5rem);margin:auto;height:0.125rem;border-radius:1rem;background-color:currentColor;opacity:0;transform:scale(0.6)}a.author:hover{color:rgb(var(--color-blue-default))}a.author:hover:before{opacity:0.3;transform:scale(1)}limel-chip-set{margin-left:-1rem;margin-bottom:-0.5rem}limel-action-bar{--action-bar-item-height:1.75rem;transition:opacity 0.2s ease;justify-content:flex-start;opacity:0.8}.action-bar{display:grid;transition:grid-template-rows var(--limebb-feed-item-action-bar-grid-template-rows-transition-speed, 0.2s) cubic-bezier(1, 0.09, 0, 0.89) var(--limebb-feed-item-action-bar-grid-template-rows-transition-delay, 0s);grid-template-rows:var(--limebb-feed-item-action-bar-grid-template-rows, 1fr)}.action-bar-hider{overflow:hidden}limel-action-bar{transition:padding var(--limebb-feed-item-action-bar-grid-template-rows-transition-speed) cubic-bezier(1, 0.09, 0, 0.89) var(--limebb-feed-item-action-bar-grid-template-rows-transition-delay);padding-bottom:0.5rem}:host(limebb-feed-timeline-item:hover) .action-bar,:host(limebb-feed-timeline-item:focus-within) .action-bar,:host(limebb-feed-timeline-item:focus-visible) .action-bar{--limebb-feed-item-action-bar-grid-template-rows:1fr;will-change:grid-template-rows}:host(limebb-feed-timeline-item:hover) limel-action-bar,:host(limebb-feed-timeline-item:focus-within) limel-action-bar,:host(limebb-feed-timeline-item:focus-visible) limel-action-bar{will-change:opacity;opacity:1}:host(limebb-feed-timeline-item:hover){--limebb-feed-item-action-bar-grid-template-rows-transition-speed:0.46s;--limebb-feed-item-action-bar-grid-template-rows-transition-delay:0.5s}:host(limebb-feed-timeline-item.is-tall) .markdown-container{margin-bottom:0.5rem}:host(limebb-feed-timeline-item.is-tall) .body-text{min-height:10.25rem}:host(limebb-feed-timeline-item.is-tall) .body-text:after{transition:opacity 0.6s ease;content:"";opacity:0.26;pointer-events:none;position:absolute;bottom:-0.125rem;right:-0.125rem;left:-0.125rem;height:2.5rem;background:radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0)) 0 100%, linear-gradient(to bottom, rgb(var(--limebb-feed-item-background-color), 0) 0%, rgb(var(--limebb-feed-item-background-color), 90%) 100%);background-repeat:no-repeat;background-size:100% 0.5rem, 100% 100%}:host(limebb-feed-timeline-item.is-tall.shows-less) .markdown-container{grid-template-rows:0fr}:host(limebb-feed-timeline-item.is-tall.shows-less) .body-text:after{opacity:1}:host(limebb-feed-timeline-item.is-tall.shows-more) .markdown-container{grid-template-rows:1fr}:host(limebb-feed-timeline-item.is-tall.shows-more) #show-more-button limel-icon{rotate:180deg}.markdown-container{transition:grid-template-rows calc(var(--body-text-height) * 1.2ms) cubic-bezier(1, 0.09, 0, 0.89);position:relative;display:grid}.body-text{display:block;overflow:hidden}#show-more-button{all:unset;transition:color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out;cursor:pointer;color:var(--mdc-theme-on-surface);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-normal);z-index:1;position:absolute;right:0;bottom:-0.6rem;left:0;margin:0 auto;display:flex;align-items:center;justify-content:center;border-radius:3rem;width:2rem;height:1rem}#show-more-button:hover{color:var(--mdc-theme-on-surface);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-hovered)}#show-more-button:active{box-shadow:var(--button-shadow-pressed);transform:translate3d(0, 0.08rem, 0)}#show-more-button:focus{outline:none}#show-more-button:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}#show-more-button limel-icon{transition:rotate 0.2s ease 0.5s;color:var(--mdc-theme-primary);width:0.75rem}';export{h as limebb_feed,c as limebb_feed_timeline_item}
|