@trycourier/courier-ui-inbox 1.0.11-beta → 1.0.13-beta
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/README.md +1 -1
- package/dist/components/courier-inbox-list-item.d.ts +2 -1
- package/dist/components/courier-inbox-list.d.ts +6 -0
- package/dist/components/courier-inbox-menu-button.d.ts +2 -2
- package/dist/components/courier-inbox-popup-menu.d.ts +0 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +98 -86
- package/dist/index.mjs.map +1 -1
- package/dist/types/courier-inbox-theme.d.ts +10 -3
- package/package.json +1 -3
package/dist/index.mjs
CHANGED
|
@@ -1578,7 +1578,7 @@ const _CourierInboxDatastore = class _CourierInboxDatastore {
|
|
|
1578
1578
|
__publicField(_CourierInboxDatastore, "instance");
|
|
1579
1579
|
let CourierInboxDatastore = _CourierInboxDatastore;
|
|
1580
1580
|
class CourierInboxListItem extends CourierBaseElement {
|
|
1581
|
-
constructor(themeManager) {
|
|
1581
|
+
constructor(themeManager, canClick, _canLongPress) {
|
|
1582
1582
|
super();
|
|
1583
1583
|
// State
|
|
1584
1584
|
__publicField(this, "_themeManager");
|
|
@@ -1586,6 +1586,8 @@ class CourierInboxListItem extends CourierBaseElement {
|
|
|
1586
1586
|
__publicField(this, "_message", null);
|
|
1587
1587
|
__publicField(this, "_feedType", "inbox");
|
|
1588
1588
|
__publicField(this, "_isMobile", false);
|
|
1589
|
+
__publicField(this, "_canClick", false);
|
|
1590
|
+
// private _canLongPress: boolean = false; // Unused for now. But we can use this in the future if needed.
|
|
1589
1591
|
// Elements
|
|
1590
1592
|
__publicField(this, "_titleElement");
|
|
1591
1593
|
__publicField(this, "_subtitleElement");
|
|
@@ -1600,6 +1602,7 @@ class CourierInboxListItem extends CourierBaseElement {
|
|
|
1600
1602
|
__publicField(this, "onItemClick", null);
|
|
1601
1603
|
__publicField(this, "onItemLongPress", null);
|
|
1602
1604
|
__publicField(this, "onItemActionClick", null);
|
|
1605
|
+
this._canClick = canClick;
|
|
1603
1606
|
this._themeManager = themeManager;
|
|
1604
1607
|
this._theme = themeManager.getTheme();
|
|
1605
1608
|
this._isMobile = "ontouchstart" in window;
|
|
@@ -1635,6 +1638,7 @@ class CourierInboxListItem extends CourierBaseElement {
|
|
|
1635
1638
|
this._menu.addEventListener("pointerdown", cancelPropagation);
|
|
1636
1639
|
this._menu.addEventListener("click", cancelPropagation);
|
|
1637
1640
|
this.addEventListener("click", (e) => {
|
|
1641
|
+
if (!this._canClick) return;
|
|
1638
1642
|
if (this._menu && (this._menu.contains(e.target) || e.composedPath().includes(this._menu))) {
|
|
1639
1643
|
return;
|
|
1640
1644
|
}
|
|
@@ -1644,6 +1648,9 @@ class CourierInboxListItem extends CourierBaseElement {
|
|
|
1644
1648
|
});
|
|
1645
1649
|
this._setupHoverBehavior();
|
|
1646
1650
|
this._setupLongPressBehavior();
|
|
1651
|
+
if (this._canClick) {
|
|
1652
|
+
this.classList.add("clickable");
|
|
1653
|
+
}
|
|
1647
1654
|
}
|
|
1648
1655
|
static getStyles(theme2) {
|
|
1649
1656
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
@@ -1656,7 +1663,7 @@ class CourierInboxListItem extends CourierBaseElement {
|
|
|
1656
1663
|
justify-content: space-between;
|
|
1657
1664
|
border-bottom: ${((_b = list == null ? void 0 : list.item) == null ? void 0 : _b.divider) ?? "1px solid red"};
|
|
1658
1665
|
font-family: inherit;
|
|
1659
|
-
cursor:
|
|
1666
|
+
cursor: default;
|
|
1660
1667
|
transition: background-color 0.2s ease;
|
|
1661
1668
|
margin: 0;
|
|
1662
1669
|
width: 100%;
|
|
@@ -1671,25 +1678,27 @@ class CourierInboxListItem extends CourierBaseElement {
|
|
|
1671
1678
|
touch-action: manipulation;
|
|
1672
1679
|
}
|
|
1673
1680
|
|
|
1674
|
-
/*
|
|
1681
|
+
/* Only apply hover/active background if clickable */
|
|
1675
1682
|
@media (hover: hover) {
|
|
1676
|
-
${CourierInboxListItem.id}:hover {
|
|
1683
|
+
${CourierInboxListItem.id}.clickable:hover {
|
|
1684
|
+
cursor: pointer;
|
|
1677
1685
|
background-color: ${((_d = list == null ? void 0 : list.item) == null ? void 0 : _d.hoverBackgroundColor) ?? "red"};
|
|
1678
1686
|
}
|
|
1679
1687
|
}
|
|
1680
1688
|
|
|
1681
|
-
${CourierInboxListItem.id}:active {
|
|
1689
|
+
${CourierInboxListItem.id}.clickable:active {
|
|
1690
|
+
cursor: pointer;
|
|
1682
1691
|
background-color: ${((_e = list == null ? void 0 : list.item) == null ? void 0 : _e.activeBackgroundColor) ?? "red"};
|
|
1683
1692
|
}
|
|
1684
1693
|
|
|
1685
1694
|
/* Menu hover / active */
|
|
1686
1695
|
@media (hover: hover) {
|
|
1687
|
-
${CourierInboxListItem.id}:hover:has(courier-inbox-list-item-menu:hover, courier-inbox-list-item-menu *:hover, courier-button:hover, courier-button *:hover) {
|
|
1696
|
+
${CourierInboxListItem.id}.clickable:hover:has(courier-inbox-list-item-menu:hover, courier-inbox-list-item-menu *:hover, courier-button:hover, courier-button *:hover) {
|
|
1688
1697
|
background-color: ${((_f = list == null ? void 0 : list.item) == null ? void 0 : _f.backgroundColor) ?? "transparent"};
|
|
1689
1698
|
}
|
|
1690
1699
|
}
|
|
1691
1700
|
|
|
1692
|
-
${CourierInboxListItem.id}:active:has(courier-inbox-list-item-menu:active, courier-inbox-list-item-menu *:active, courier-button:active, courier-button *:active) {
|
|
1701
|
+
${CourierInboxListItem.id}.clickable:active:has(courier-inbox-list-item-menu:active, courier-inbox-list-item-menu *:active, courier-button:active, courier-button *:active) {
|
|
1693
1702
|
background-color: ${((_g = list == null ? void 0 : list.item) == null ? void 0 : _g.backgroundColor) ?? "transparent"};
|
|
1694
1703
|
}
|
|
1695
1704
|
|
|
@@ -1922,6 +1931,7 @@ class CourierInboxListItem extends CourierBaseElement {
|
|
|
1922
1931
|
}
|
|
1923
1932
|
const actionsTheme = (_c = (_b = (_a = this._theme.inbox) == null ? void 0 : _a.list) == null ? void 0 : _b.item) == null ? void 0 : _c.actions;
|
|
1924
1933
|
if (this._actionsContainer && this._message.actions) {
|
|
1934
|
+
this._actionsContainer.innerHTML = "";
|
|
1925
1935
|
this._message.actions.forEach((action) => {
|
|
1926
1936
|
var _a2, _b2, _c2, _d, _e;
|
|
1927
1937
|
const actionButton = new CourierButton({
|
|
@@ -2204,6 +2214,8 @@ class CourierInboxList extends CourierBaseElement {
|
|
|
2204
2214
|
__publicField(this, "_isLoading", true);
|
|
2205
2215
|
__publicField(this, "_error", null);
|
|
2206
2216
|
__publicField(this, "_canPaginate", false);
|
|
2217
|
+
__publicField(this, "_canClickListItems", false);
|
|
2218
|
+
__publicField(this, "_canLongPressListItems", false);
|
|
2207
2219
|
// Callbacks
|
|
2208
2220
|
__publicField(this, "_onMessageClick", null);
|
|
2209
2221
|
__publicField(this, "_onMessageActionClick", null);
|
|
@@ -2254,6 +2266,12 @@ class CourierInboxList extends CourierBaseElement {
|
|
|
2254
2266
|
(_b = this._listItemStyles) == null ? void 0 : _b.remove();
|
|
2255
2267
|
(_c = this._listItemMenuStyles) == null ? void 0 : _c.remove();
|
|
2256
2268
|
}
|
|
2269
|
+
setCanClickListItems(canClick) {
|
|
2270
|
+
this._canClickListItems = canClick;
|
|
2271
|
+
}
|
|
2272
|
+
setCanLongPressListItems(canLongPress) {
|
|
2273
|
+
this._canLongPressListItems = canLongPress;
|
|
2274
|
+
}
|
|
2257
2275
|
static getStyles(theme2) {
|
|
2258
2276
|
var _a;
|
|
2259
2277
|
const list = (_a = theme2.inbox) == null ? void 0 : _a.list;
|
|
@@ -2428,7 +2446,7 @@ class CourierInboxList extends CourierBaseElement {
|
|
|
2428
2446
|
list.appendChild(this._listItemFactory({ message, index }));
|
|
2429
2447
|
return;
|
|
2430
2448
|
}
|
|
2431
|
-
const listItem = new CourierInboxListItem(this._themeSubscription.manager);
|
|
2449
|
+
const listItem = new CourierInboxListItem(this._themeSubscription.manager, this._canClickListItems, this._canLongPressListItems);
|
|
2432
2450
|
listItem.setMessage(message, this._feedType);
|
|
2433
2451
|
listItem.setOnItemClick((message2) => {
|
|
2434
2452
|
var _a2;
|
|
@@ -2748,31 +2766,26 @@ class CourierUnreadCountBadge extends CourierBaseElement {
|
|
|
2748
2766
|
(_a = this._style) == null ? void 0 : _a.remove();
|
|
2749
2767
|
}
|
|
2750
2768
|
static getStyles(theme2) {
|
|
2751
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v
|
|
2769
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
2752
2770
|
return `
|
|
2753
2771
|
${CourierUnreadCountBadge.id} {
|
|
2754
2772
|
display: inline-block;
|
|
2755
2773
|
}
|
|
2756
2774
|
|
|
2757
2775
|
${CourierUnreadCountBadge.id} .unread-badge {
|
|
2758
|
-
padding:
|
|
2776
|
+
padding: 3px 8px;
|
|
2777
|
+
font-size: 12px;
|
|
2759
2778
|
text-align: center;
|
|
2760
2779
|
display: none;
|
|
2761
2780
|
pointer-events: none;
|
|
2762
2781
|
}
|
|
2763
2782
|
|
|
2764
|
-
${CourierUnreadCountBadge.id} .button {
|
|
2765
|
-
background-color: ${(_c = (_b = (_a = theme2.popup) == null ? void 0 : _a.button) == null ? void 0 : _b.unreadIndicator) == null ? void 0 : _c.backgroundColor};
|
|
2766
|
-
color: ${(_g = (_f = (_e = (_d = theme2.popup) == null ? void 0 : _d.button) == null ? void 0 : _e.unreadIndicator) == null ? void 0 : _f.font) == null ? void 0 : _g.color};
|
|
2767
|
-
border-radius: ${(_j = (_i = (_h = theme2.popup) == null ? void 0 : _h.button) == null ? void 0 : _i.unreadIndicator) == null ? void 0 : _j.borderRadius};
|
|
2768
|
-
font-size: ${(_n = (_m = (_l = (_k = theme2.popup) == null ? void 0 : _k.button) == null ? void 0 : _l.unreadIndicator) == null ? void 0 : _m.font) == null ? void 0 : _n.size};
|
|
2769
|
-
}
|
|
2770
|
-
|
|
2771
2783
|
${CourierUnreadCountBadge.id} .header {
|
|
2772
|
-
background-color: ${(
|
|
2773
|
-
color: ${(
|
|
2774
|
-
border-radius: ${(
|
|
2775
|
-
font-size: ${(
|
|
2784
|
+
background-color: ${(_d = (_c = (_b = (_a = theme2.inbox) == null ? void 0 : _a.header) == null ? void 0 : _b.filters) == null ? void 0 : _c.unreadIndicator) == null ? void 0 : _d.backgroundColor};
|
|
2785
|
+
color: ${(_i = (_h = (_g = (_f = (_e = theme2.inbox) == null ? void 0 : _e.header) == null ? void 0 : _f.filters) == null ? void 0 : _g.unreadIndicator) == null ? void 0 : _h.font) == null ? void 0 : _i.color};
|
|
2786
|
+
border-radius: ${(_m = (_l = (_k = (_j = theme2.inbox) == null ? void 0 : _j.header) == null ? void 0 : _k.filters) == null ? void 0 : _l.unreadIndicator) == null ? void 0 : _m.borderRadius};
|
|
2787
|
+
font-size: ${(_r = (_q = (_p = (_o = (_n = theme2.inbox) == null ? void 0 : _n.header) == null ? void 0 : _o.filters) == null ? void 0 : _p.unreadIndicator) == null ? void 0 : _q.font) == null ? void 0 : _r.size};
|
|
2788
|
+
padding: ${(_v = (_u = (_t = (_s = theme2.inbox) == null ? void 0 : _s.header) == null ? void 0 : _t.filters) == null ? void 0 : _u.unreadIndicator) == null ? void 0 : _v.padding};
|
|
2776
2789
|
}
|
|
2777
2790
|
`;
|
|
2778
2791
|
}
|
|
@@ -3127,15 +3140,11 @@ const defaultLightTheme = {
|
|
|
3127
3140
|
backgroundColor: "transparent",
|
|
3128
3141
|
hoverBackgroundColor: CourierColors.black[50010],
|
|
3129
3142
|
activeBackgroundColor: CourierColors.black[50020],
|
|
3130
|
-
|
|
3131
|
-
font: {
|
|
3132
|
-
color: CourierColors.white[500],
|
|
3133
|
-
size: "14px",
|
|
3134
|
-
family: void 0,
|
|
3135
|
-
weight: void 0
|
|
3136
|
-
},
|
|
3143
|
+
unreadDotIndicator: {
|
|
3137
3144
|
backgroundColor: CourierColors.blue[500],
|
|
3138
|
-
borderRadius: "
|
|
3145
|
+
borderRadius: "50%",
|
|
3146
|
+
height: "8px",
|
|
3147
|
+
width: "8px"
|
|
3139
3148
|
}
|
|
3140
3149
|
},
|
|
3141
3150
|
window: {
|
|
@@ -3173,10 +3182,11 @@ const defaultLightTheme = {
|
|
|
3173
3182
|
font: {
|
|
3174
3183
|
color: CourierColors.white[500],
|
|
3175
3184
|
family: void 0,
|
|
3176
|
-
size: "
|
|
3185
|
+
size: "12px"
|
|
3177
3186
|
},
|
|
3178
3187
|
backgroundColor: CourierColors.blue[500],
|
|
3179
|
-
borderRadius: "
|
|
3188
|
+
borderRadius: "4px",
|
|
3189
|
+
padding: "2px 6px"
|
|
3180
3190
|
}
|
|
3181
3191
|
},
|
|
3182
3192
|
menus: {
|
|
@@ -3374,15 +3384,11 @@ const defaultDarkTheme = {
|
|
|
3374
3384
|
backgroundColor: "transparent",
|
|
3375
3385
|
hoverBackgroundColor: CourierColors.white[50010],
|
|
3376
3386
|
activeBackgroundColor: CourierColors.white[50020],
|
|
3377
|
-
|
|
3378
|
-
font: {
|
|
3379
|
-
color: CourierColors.white[500],
|
|
3380
|
-
size: "14px",
|
|
3381
|
-
family: void 0,
|
|
3382
|
-
weight: void 0
|
|
3383
|
-
},
|
|
3387
|
+
unreadDotIndicator: {
|
|
3384
3388
|
backgroundColor: CourierColors.blue[500],
|
|
3385
|
-
borderRadius: "
|
|
3389
|
+
borderRadius: "50%",
|
|
3390
|
+
height: "8px",
|
|
3391
|
+
width: "8px"
|
|
3386
3392
|
}
|
|
3387
3393
|
},
|
|
3388
3394
|
window: {
|
|
@@ -3420,10 +3426,11 @@ const defaultDarkTheme = {
|
|
|
3420
3426
|
font: {
|
|
3421
3427
|
color: CourierColors.white[500],
|
|
3422
3428
|
family: void 0,
|
|
3423
|
-
size: "
|
|
3429
|
+
size: "12px"
|
|
3424
3430
|
},
|
|
3425
3431
|
backgroundColor: CourierColors.blue[500],
|
|
3426
|
-
borderRadius: "
|
|
3432
|
+
borderRadius: "4px",
|
|
3433
|
+
padding: "3px 8px"
|
|
3427
3434
|
}
|
|
3428
3435
|
},
|
|
3429
3436
|
menus: {
|
|
@@ -3623,9 +3630,9 @@ const mergeTheme = (mode, theme2) => {
|
|
|
3623
3630
|
...(_d = (_c = defaultTheme.popup) == null ? void 0 : _c.button) == null ? void 0 : _d.icon,
|
|
3624
3631
|
...(_f = (_e = theme2.popup) == null ? void 0 : _e.button) == null ? void 0 : _f.icon
|
|
3625
3632
|
},
|
|
3626
|
-
|
|
3627
|
-
...(_h = (_g = defaultTheme.popup) == null ? void 0 : _g.button) == null ? void 0 : _h.
|
|
3628
|
-
...(_j = (_i = theme2.popup) == null ? void 0 : _i.button) == null ? void 0 : _j.
|
|
3633
|
+
unreadDotIndicator: {
|
|
3634
|
+
...(_h = (_g = defaultTheme.popup) == null ? void 0 : _g.button) == null ? void 0 : _h.unreadDotIndicator,
|
|
3635
|
+
...(_j = (_i = theme2.popup) == null ? void 0 : _i.button) == null ? void 0 : _j.unreadDotIndicator
|
|
3629
3636
|
}
|
|
3630
3637
|
},
|
|
3631
3638
|
window: {
|
|
@@ -3950,6 +3957,8 @@ class CourierInbox extends CourierBaseElement {
|
|
|
3950
3957
|
this.appendChild(this._header);
|
|
3951
3958
|
this._list = new CourierInboxList({
|
|
3952
3959
|
themeManager: this._themeManager,
|
|
3960
|
+
canClickListItems: false,
|
|
3961
|
+
canLongPressListItems: false,
|
|
3953
3962
|
onRefresh: () => {
|
|
3954
3963
|
this.refresh();
|
|
3955
3964
|
},
|
|
@@ -4114,13 +4123,17 @@ class CourierInbox extends CourierBaseElement {
|
|
|
4114
4123
|
(_a = this._list) == null ? void 0 : _a.setPaginationItemFactory(factory);
|
|
4115
4124
|
}
|
|
4116
4125
|
onMessageClick(handler) {
|
|
4126
|
+
var _a;
|
|
4117
4127
|
this._onMessageClick = handler;
|
|
4128
|
+
(_a = this._list) == null ? void 0 : _a.setCanClickListItems(handler !== void 0);
|
|
4118
4129
|
}
|
|
4119
4130
|
onMessageActionClick(handler) {
|
|
4120
4131
|
this._onMessageActionClick = handler;
|
|
4121
4132
|
}
|
|
4122
4133
|
onMessageLongPress(handler) {
|
|
4134
|
+
var _a;
|
|
4123
4135
|
this._onMessageLongPress = handler;
|
|
4136
|
+
(_a = this._list) == null ? void 0 : _a.setCanLongPressListItems(handler !== void 0);
|
|
4124
4137
|
}
|
|
4125
4138
|
setFeedType(feedType) {
|
|
4126
4139
|
var _a;
|
|
@@ -4227,7 +4240,7 @@ class CourierInboxMenuButton extends CourierFactoryElement {
|
|
|
4227
4240
|
__publicField(this, "_style");
|
|
4228
4241
|
__publicField(this, "_container");
|
|
4229
4242
|
__publicField(this, "_triggerButton");
|
|
4230
|
-
__publicField(this, "
|
|
4243
|
+
__publicField(this, "_unreadBadge");
|
|
4231
4244
|
this._themeSubscription = themeBus.subscribe((_) => {
|
|
4232
4245
|
this.refreshTheme();
|
|
4233
4246
|
});
|
|
@@ -4250,45 +4263,50 @@ class CourierInboxMenuButton extends CourierFactoryElement {
|
|
|
4250
4263
|
this._container = document.createElement("div");
|
|
4251
4264
|
this._container.className = "menu-button-container";
|
|
4252
4265
|
this._triggerButton = new CourierIconButton(CourierIconSVGs.inbox);
|
|
4253
|
-
this.
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
});
|
|
4257
|
-
this._unreadCountBadge.id = "unread-badge";
|
|
4266
|
+
this._unreadBadge = document.createElement("div");
|
|
4267
|
+
this._unreadBadge.className = "unread-badge";
|
|
4268
|
+
this._unreadBadge.style.display = "none";
|
|
4258
4269
|
this._container.appendChild(this._triggerButton);
|
|
4259
|
-
this._container.appendChild(this.
|
|
4270
|
+
this._container.appendChild(this._unreadBadge);
|
|
4260
4271
|
this.appendChild(this._container);
|
|
4261
4272
|
this.refreshTheme();
|
|
4262
4273
|
return this._container;
|
|
4263
4274
|
}
|
|
4264
|
-
static getStyles(
|
|
4275
|
+
static getStyles(theme2) {
|
|
4276
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
4265
4277
|
return `
|
|
4266
4278
|
${CourierInboxMenuButton.id} .menu-button-container {
|
|
4267
4279
|
position: relative;
|
|
4268
4280
|
display: inline-block;
|
|
4269
4281
|
}
|
|
4270
4282
|
|
|
4271
|
-
${CourierInboxMenuButton.id}
|
|
4283
|
+
${CourierInboxMenuButton.id} .unread-badge {
|
|
4272
4284
|
position: absolute;
|
|
4273
|
-
top:
|
|
4274
|
-
|
|
4285
|
+
top: 2px;
|
|
4286
|
+
right: 2px;
|
|
4275
4287
|
pointer-events: none;
|
|
4288
|
+
width: ${((_c = (_b = (_a = theme2.popup) == null ? void 0 : _a.button) == null ? void 0 : _b.unreadDotIndicator) == null ? void 0 : _c.height) ?? "8px"};
|
|
4289
|
+
height: ${((_f = (_e = (_d = theme2.popup) == null ? void 0 : _d.button) == null ? void 0 : _e.unreadDotIndicator) == null ? void 0 : _f.width) ?? "8px"};
|
|
4290
|
+
background: ${((_i = (_h = (_g = theme2.popup) == null ? void 0 : _g.button) == null ? void 0 : _h.unreadDotIndicator) == null ? void 0 : _i.backgroundColor) ?? "red"};
|
|
4291
|
+
border-radius: ${((_l = (_k = (_j = theme2.popup) == null ? void 0 : _j.button) == null ? void 0 : _k.unreadDotIndicator) == null ? void 0 : _l.borderRadius) ?? "50%"};
|
|
4292
|
+
display: none;
|
|
4293
|
+
z-index: 1;
|
|
4276
4294
|
}
|
|
4277
4295
|
`;
|
|
4278
4296
|
}
|
|
4279
4297
|
onUnreadCountChange(unreadCount) {
|
|
4280
|
-
|
|
4281
|
-
|
|
4298
|
+
if (this._unreadBadge) {
|
|
4299
|
+
this._unreadBadge.style.display = unreadCount > 0 ? "block" : "none";
|
|
4300
|
+
}
|
|
4282
4301
|
this.refreshTheme();
|
|
4283
4302
|
}
|
|
4284
4303
|
refreshTheme() {
|
|
4285
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v
|
|
4304
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
4286
4305
|
(_e = this._triggerButton) == null ? void 0 : _e.updateIconColor(((_d = (_c = (_b = (_a = this.theme) == null ? void 0 : _a.popup) == null ? void 0 : _b.button) == null ? void 0 : _c.icon) == null ? void 0 : _d.color) ?? CourierColors.black[500]);
|
|
4287
4306
|
(_j = this._triggerButton) == null ? void 0 : _j.updateIconSVG(((_i = (_h = (_g = (_f = this.theme) == null ? void 0 : _f.popup) == null ? void 0 : _g.button) == null ? void 0 : _h.icon) == null ? void 0 : _i.svg) ?? CourierIconSVGs.inbox);
|
|
4288
4307
|
(_n = this._triggerButton) == null ? void 0 : _n.updateBackgroundColor(((_m = (_l = (_k = this.theme) == null ? void 0 : _k.popup) == null ? void 0 : _l.button) == null ? void 0 : _m.backgroundColor) ?? "transparent");
|
|
4289
4308
|
(_r = this._triggerButton) == null ? void 0 : _r.updateHoverBackgroundColor(((_q = (_p = (_o = this.theme) == null ? void 0 : _o.popup) == null ? void 0 : _p.button) == null ? void 0 : _q.hoverBackgroundColor) ?? CourierColors.black[50010]);
|
|
4290
4309
|
(_v = this._triggerButton) == null ? void 0 : _v.updateActiveBackgroundColor(((_u = (_t = (_s = this.theme) == null ? void 0 : _s.popup) == null ? void 0 : _t.button) == null ? void 0 : _u.activeBackgroundColor) ?? CourierColors.black[50020]);
|
|
4291
|
-
(_w = this._unreadCountBadge) == null ? void 0 : _w.refreshTheme("button");
|
|
4292
4310
|
}
|
|
4293
4311
|
}
|
|
4294
4312
|
registerElement(CourierInboxMenuButton);
|
|
@@ -4310,10 +4328,6 @@ class CourierInboxPopupMenu extends CourierBaseElement {
|
|
|
4310
4328
|
__publicField(this, "_popup");
|
|
4311
4329
|
__publicField(this, "_inbox");
|
|
4312
4330
|
__publicField(this, "_style");
|
|
4313
|
-
// Inbox Handlers
|
|
4314
|
-
__publicField(this, "_onMessageClick");
|
|
4315
|
-
__publicField(this, "_onMessageActionClick");
|
|
4316
|
-
__publicField(this, "_onMessageLongPress");
|
|
4317
4331
|
// Listeners
|
|
4318
4332
|
__publicField(this, "_datastoreListener");
|
|
4319
4333
|
// Factories
|
|
@@ -4361,26 +4375,6 @@ class CourierInboxPopupMenu extends CourierBaseElement {
|
|
|
4361
4375
|
this._popup.className = "popup";
|
|
4362
4376
|
this._inbox = new CourierInbox(this._themeManager);
|
|
4363
4377
|
this._inbox.setAttribute("height", "100%");
|
|
4364
|
-
if (this._inbox) {
|
|
4365
|
-
this._inbox.onMessageClick((props) => {
|
|
4366
|
-
if (this._onMessageClick) {
|
|
4367
|
-
this._onMessageClick(props);
|
|
4368
|
-
}
|
|
4369
|
-
this.closePopup();
|
|
4370
|
-
});
|
|
4371
|
-
this._inbox.onMessageActionClick((props) => {
|
|
4372
|
-
if (this._onMessageActionClick) {
|
|
4373
|
-
this._onMessageActionClick(props);
|
|
4374
|
-
}
|
|
4375
|
-
this.closePopup();
|
|
4376
|
-
});
|
|
4377
|
-
this._inbox.onMessageLongPress((props) => {
|
|
4378
|
-
if (this._onMessageLongPress) {
|
|
4379
|
-
this._onMessageLongPress(props);
|
|
4380
|
-
}
|
|
4381
|
-
this.closePopup();
|
|
4382
|
-
});
|
|
4383
|
-
}
|
|
4384
4378
|
this.refreshTheme();
|
|
4385
4379
|
this.appendChild(this._triggerButton);
|
|
4386
4380
|
this.appendChild(this._popup);
|
|
@@ -4493,13 +4487,31 @@ class CourierInboxPopupMenu extends CourierBaseElement {
|
|
|
4493
4487
|
this.render();
|
|
4494
4488
|
}
|
|
4495
4489
|
onMessageClick(handler) {
|
|
4496
|
-
|
|
4490
|
+
var _a;
|
|
4491
|
+
(_a = this._inbox) == null ? void 0 : _a.onMessageClick((props) => {
|
|
4492
|
+
if (handler) {
|
|
4493
|
+
handler(props);
|
|
4494
|
+
}
|
|
4495
|
+
this.closePopup();
|
|
4496
|
+
});
|
|
4497
4497
|
}
|
|
4498
4498
|
onMessageActionClick(handler) {
|
|
4499
|
-
|
|
4499
|
+
var _a;
|
|
4500
|
+
(_a = this._inbox) == null ? void 0 : _a.onMessageActionClick((props) => {
|
|
4501
|
+
if (handler) {
|
|
4502
|
+
handler(props);
|
|
4503
|
+
}
|
|
4504
|
+
this.closePopup();
|
|
4505
|
+
});
|
|
4500
4506
|
}
|
|
4501
4507
|
onMessageLongPress(handler) {
|
|
4502
|
-
|
|
4508
|
+
var _a;
|
|
4509
|
+
(_a = this._inbox) == null ? void 0 : _a.onMessageLongPress((props) => {
|
|
4510
|
+
if (handler) {
|
|
4511
|
+
handler(props);
|
|
4512
|
+
}
|
|
4513
|
+
this.closePopup();
|
|
4514
|
+
});
|
|
4503
4515
|
}
|
|
4504
4516
|
isValidPosition(value) {
|
|
4505
4517
|
const validPositions = [
|