@telia-ace/knowledge-widget-components-notification-row 1.1.1-rc.1 → 1.1.1-rc.3
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/index.js +1 -1
- package/index.mjs +66 -5
- package/{notification-row-ce337619.mjs → notification-row-03145cb0.mjs} +80 -77
- package/notification-row-cc822106.js +114 -0
- package/package.json +6 -6
- package/index-19df0eec.js +0 -1757
- package/index-373df3a5.js +0 -6
- package/index-5c9c2abf.mjs +0 -883
- package/index-750561ea.mjs +0 -11103
- package/notification-row-4b11636a.js +0 -114
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const f=require("@telia-ace/knowledge-data-client"),d=require("@telia-ace/knowledge-widget-core"),w=require("@telia-ace/knowledge-widget-ui"),p=s=>{const{events:h}=s.get("$widget"),[u,c]=d.createEventSubscriber(h);return w.createReactComponent(s,"notification-row",Promise.resolve().then(()=>require("./notification-row-cc822106.js")),t=>{const a=e=>{t.writeProperties({...t.properties(),loading:!0,error:void 0,notifications:[]}),t.actions.dispatch("fetch",{params:e})};return t.actions.create("fetch",({error:e,topNotifications:i,bottomNotifications:o,middleNotifications:g})=>{if(e)return t.actions.dispatch("fetched",{error:e,loading:!0,notifications:[]});let r=[];const{notifications:l,types:n=[]}=t.properties();return n.length?(n.indexOf("top")>-1&&(r=r.concat(i)),n.indexOf("middle")>-1&&(r=r.concat(g)),n.indexOf("bottom")>-1&&(r=r.concat(o))):r=i,t.actions.dispatch("fetched",{notifications:r.length?r:l,loading:!1})}),t.actions.create("fetched",e=>t.writeProperties({...e,loading:!1})),s.getAsync("router").then(e=>{const{params:i}=e.getRouteData();a(i)}),u("router:changed",(e,{current:i})=>{a(i.routeData.params)}),()=>{c()}}).then(()=>d.extendComponent(s,"notification-row",t=>{t.actions.watch("notification-row.fetch",(a,e)=>f.DataClient.getInstance(s).then(i=>i.fetch(f.DataType.RowNotifications,{categories:[a.params.guideCategory,a.params.contactCategory].filter(o=>!!o),searchPhrase:a.params.phrase})).then(e).catch(i=>{if(i)return e(i)}))})).then(()=>{c()})};module.exports=p;
|
package/index.mjs
CHANGED
|
@@ -1,7 +1,68 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
3
|
-
import "
|
|
4
|
-
|
|
1
|
+
import { DataClient as g, DataType as p } from "@telia-ace/knowledge-data-client";
|
|
2
|
+
import { createEventSubscriber as l, extendComponent as w } from "@telia-ace/knowledge-widget-core";
|
|
3
|
+
import { createReactComponent as m } from "@telia-ace/knowledge-widget-ui";
|
|
4
|
+
const v = (o) => {
|
|
5
|
+
const { events: f } = o.get("$widget"), [h, n] = l(f);
|
|
6
|
+
return m(
|
|
7
|
+
o,
|
|
8
|
+
"notification-row",
|
|
9
|
+
import("./notification-row-03145cb0.mjs"),
|
|
10
|
+
(e) => {
|
|
11
|
+
const r = (t) => {
|
|
12
|
+
e.writeProperties({
|
|
13
|
+
...e.properties(),
|
|
14
|
+
loading: !0,
|
|
15
|
+
error: void 0,
|
|
16
|
+
notifications: []
|
|
17
|
+
}), e.actions.dispatch("fetch", { params: t });
|
|
18
|
+
};
|
|
19
|
+
return e.actions.create(
|
|
20
|
+
"fetch",
|
|
21
|
+
({
|
|
22
|
+
error: t,
|
|
23
|
+
topNotifications: i,
|
|
24
|
+
bottomNotifications: c,
|
|
25
|
+
middleNotifications: d
|
|
26
|
+
}) => {
|
|
27
|
+
if (t)
|
|
28
|
+
return e.actions.dispatch("fetched", {
|
|
29
|
+
error: t,
|
|
30
|
+
loading: !0,
|
|
31
|
+
notifications: []
|
|
32
|
+
});
|
|
33
|
+
let a = [];
|
|
34
|
+
const { notifications: u, types: s = [] } = e.properties();
|
|
35
|
+
return s.length ? (s.indexOf("top") > -1 && (a = a.concat(i)), s.indexOf("middle") > -1 && (a = a.concat(d)), s.indexOf("bottom") > -1 && (a = a.concat(c))) : a = i, e.actions.dispatch("fetched", {
|
|
36
|
+
notifications: a.length ? a : u,
|
|
37
|
+
loading: !1
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
), e.actions.create("fetched", (t) => e.writeProperties({ ...t, loading: !1 })), o.getAsync("router").then((t) => {
|
|
41
|
+
const { params: i } = t.getRouteData();
|
|
42
|
+
r(i);
|
|
43
|
+
}), h("router:changed", (t, { current: i }) => {
|
|
44
|
+
r(i.routeData.params);
|
|
45
|
+
}), () => {
|
|
46
|
+
n();
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
).then(() => w(o, "notification-row", (e) => {
|
|
50
|
+
e.actions.watch("notification-row.fetch", (r, t) => g.getInstance(o).then(
|
|
51
|
+
(i) => i.fetch(p.RowNotifications, {
|
|
52
|
+
categories: [
|
|
53
|
+
r.params.guideCategory,
|
|
54
|
+
r.params.contactCategory
|
|
55
|
+
].filter((c) => !!c),
|
|
56
|
+
searchPhrase: r.params.phrase
|
|
57
|
+
})
|
|
58
|
+
).then(t).catch((i) => {
|
|
59
|
+
if (i)
|
|
60
|
+
return t(i);
|
|
61
|
+
}));
|
|
62
|
+
})).then(() => {
|
|
63
|
+
n();
|
|
64
|
+
});
|
|
65
|
+
};
|
|
5
66
|
export {
|
|
6
|
-
|
|
67
|
+
v as default
|
|
7
68
|
};
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import "
|
|
5
|
-
|
|
1
|
+
import { jsxs as v, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { css as g } from "@emotion/react";
|
|
3
|
+
import d from "@emotion/styled";
|
|
4
|
+
import { useProperties as G, useContainer as M, createEmptyComponent as E, SymbolBadge as L, genericHtml as Y, linkTabStyle as _, borderTabStyle as N, Html as q, Button as J } from "@telia-ace/knowledge-widget-ui";
|
|
5
|
+
import { readStorage as P, StorageMedium as O, createStorageWriter as Q, StorageCategory as U } from "@telia-ace/widget-services";
|
|
6
|
+
import { appendClassNames as u } from "@telia-ace/widget-utilities";
|
|
7
|
+
import { useState as x, useEffect as A } from "react";
|
|
8
|
+
const S = "closed-notifications", V = {
|
|
6
9
|
transform: {
|
|
7
|
-
a: ({ children: e, ...t }) => /* @__PURE__ */
|
|
10
|
+
a: ({ children: e, ...t }) => /* @__PURE__ */ i("a", { ...t, tabIndex: -1, children: e })
|
|
8
11
|
}
|
|
9
|
-
},
|
|
12
|
+
}, re = ({ className: e, ...t }) => {
|
|
10
13
|
const {
|
|
11
|
-
types:
|
|
14
|
+
types: l = [],
|
|
12
15
|
allowPaging: f = !0,
|
|
13
16
|
notifications: j = [],
|
|
14
17
|
expandable: c = !1,
|
|
@@ -16,84 +19,84 @@ const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) :
|
|
|
16
19
|
pageNextAriaLabel: T = "",
|
|
17
20
|
pagePreviousAriaLabel: W = "",
|
|
18
21
|
expandAriaLabel: K = ""
|
|
19
|
-
} =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
(a = []) =>
|
|
23
|
-
),
|
|
22
|
+
} = G(), [m, D] = x(!1), [b, z] = x([]), [n, y] = x(0), o = M(), [w, F] = x();
|
|
23
|
+
A(() => {
|
|
24
|
+
o && (P(o, S, O.Session).then(
|
|
25
|
+
(a = []) => z(a)
|
|
26
|
+
), Q(o, S, U.Functional).then(
|
|
24
27
|
(a) => F(() => a)
|
|
25
28
|
));
|
|
26
|
-
}, [
|
|
27
|
-
|
|
29
|
+
}, [o]), A(() => {
|
|
30
|
+
o && P(o, S, O.Session).then(
|
|
28
31
|
(a = []) => {
|
|
29
|
-
|
|
30
|
-
(
|
|
32
|
+
b.forEach(
|
|
33
|
+
(r) => a.indexOf(r) === -1 && a.push(r)
|
|
31
34
|
), w && w(a);
|
|
32
35
|
}
|
|
33
36
|
);
|
|
34
|
-
}, [
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
37
|
-
return
|
|
37
|
+
}, [b, o, w]);
|
|
38
|
+
const s = j.filter(({ id: a }) => b.indexOf(a) === -1), { length: p } = s;
|
|
39
|
+
if (!s.length)
|
|
40
|
+
return E(o, {
|
|
38
41
|
...t,
|
|
39
|
-
className:
|
|
42
|
+
className: u(e, "humany-notification-row")
|
|
40
43
|
});
|
|
41
44
|
if (f) {
|
|
42
|
-
const a =
|
|
45
|
+
const a = s[n] || s[n + 1] || s[n - 1];
|
|
43
46
|
if (!a)
|
|
44
|
-
return
|
|
47
|
+
return E(o, {
|
|
45
48
|
...t,
|
|
46
|
-
className:
|
|
49
|
+
className: u(e, "humany-notification-row")
|
|
47
50
|
});
|
|
48
|
-
const { id:
|
|
51
|
+
const { id: r, body: $ } = a || {}, C = () => D(!m);
|
|
49
52
|
return /* @__PURE__ */ v(
|
|
50
|
-
|
|
53
|
+
B,
|
|
51
54
|
{
|
|
52
55
|
...t,
|
|
53
56
|
"aria-expanded": c ? m : !0,
|
|
54
57
|
"aria-label": K,
|
|
55
58
|
tabIndex: c ? 0 : -1,
|
|
56
|
-
className:
|
|
59
|
+
className: u(e, "humany-notification-row"),
|
|
57
60
|
"data-pageable": p > 1,
|
|
58
|
-
"data-types":
|
|
61
|
+
"data-types": l,
|
|
59
62
|
"data-allow-paging": f,
|
|
60
63
|
"data-expandable": c,
|
|
61
|
-
onKeyDown: (
|
|
62
|
-
|
|
64
|
+
onKeyDown: (h) => {
|
|
65
|
+
h.key === "Enter" && C();
|
|
63
66
|
},
|
|
64
|
-
onClick:
|
|
67
|
+
onClick: C,
|
|
65
68
|
children: [
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
|
|
69
|
+
/* @__PURE__ */ i(
|
|
70
|
+
Z,
|
|
68
71
|
{
|
|
69
72
|
"aria-label": R,
|
|
70
73
|
onClick: () => {
|
|
71
|
-
y(
|
|
74
|
+
y(s.indexOf(a)), z([...b, r]);
|
|
72
75
|
},
|
|
73
|
-
children: /* @__PURE__ */
|
|
76
|
+
children: /* @__PURE__ */ i(L, { symbol: { type: "Svg", content: "close" } })
|
|
74
77
|
}
|
|
75
78
|
),
|
|
76
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ i(
|
|
77
80
|
H,
|
|
78
81
|
{
|
|
79
|
-
htmlParseInstruction: !c || m ? void 0 :
|
|
82
|
+
htmlParseInstruction: !c || m ? void 0 : V,
|
|
80
83
|
"data-pageable": p > 1,
|
|
81
|
-
"data-notification":
|
|
84
|
+
"data-notification": r,
|
|
82
85
|
"data-expandable": c,
|
|
83
86
|
"data-expanded": m,
|
|
84
87
|
html: $
|
|
85
88
|
}
|
|
86
89
|
),
|
|
87
|
-
p > 1 && /* @__PURE__ */ v(
|
|
88
|
-
/* @__PURE__ */
|
|
90
|
+
p > 1 && /* @__PURE__ */ v(X, { children: [
|
|
91
|
+
/* @__PURE__ */ i(
|
|
89
92
|
k,
|
|
90
93
|
{
|
|
91
94
|
"aria-label": W,
|
|
92
|
-
"data-disabled":
|
|
93
|
-
onClick: (
|
|
94
|
-
|
|
95
|
+
"data-disabled": n === 0,
|
|
96
|
+
onClick: (h) => {
|
|
97
|
+
h.stopPropagation(), n > 0 && y(n - 1);
|
|
95
98
|
},
|
|
96
|
-
children: /* @__PURE__ */
|
|
99
|
+
children: /* @__PURE__ */ i(
|
|
97
100
|
I,
|
|
98
101
|
{
|
|
99
102
|
size: 10,
|
|
@@ -103,19 +106,19 @@ const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) :
|
|
|
103
106
|
}
|
|
104
107
|
),
|
|
105
108
|
/* @__PURE__ */ v("span", { children: [
|
|
106
|
-
|
|
109
|
+
n + 1,
|
|
107
110
|
"/",
|
|
108
111
|
p
|
|
109
112
|
] }),
|
|
110
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ i(
|
|
111
114
|
k,
|
|
112
115
|
{
|
|
113
116
|
"aria-label": T,
|
|
114
|
-
"data-disabled":
|
|
115
|
-
onClick: (
|
|
116
|
-
|
|
117
|
+
"data-disabled": n + 1 >= p,
|
|
118
|
+
onClick: (h) => {
|
|
119
|
+
h.stopPropagation(), n < p - 1 && y(n + 1);
|
|
117
120
|
},
|
|
118
|
-
children: /* @__PURE__ */
|
|
121
|
+
children: /* @__PURE__ */ i(
|
|
119
122
|
I,
|
|
120
123
|
{
|
|
121
124
|
size: 10,
|
|
@@ -129,34 +132,34 @@ const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) :
|
|
|
129
132
|
}
|
|
130
133
|
);
|
|
131
134
|
}
|
|
132
|
-
return /* @__PURE__ */
|
|
133
|
-
|
|
135
|
+
return /* @__PURE__ */ i(
|
|
136
|
+
B,
|
|
134
137
|
{
|
|
135
138
|
...t,
|
|
136
|
-
className:
|
|
139
|
+
className: u(e, "humany-notification-row"),
|
|
137
140
|
"data-pageable": !1,
|
|
138
|
-
"data-types":
|
|
141
|
+
"data-types": l,
|
|
139
142
|
"data-allow-paging": !1,
|
|
140
|
-
children:
|
|
143
|
+
children: s.map((a) => {
|
|
141
144
|
if (!a)
|
|
142
145
|
return null;
|
|
143
|
-
const { id:
|
|
144
|
-
return /* @__PURE__ */
|
|
146
|
+
const { id: r, body: $ } = a;
|
|
147
|
+
return /* @__PURE__ */ i(
|
|
145
148
|
H,
|
|
146
149
|
{
|
|
147
150
|
"data-pageable": !1,
|
|
148
151
|
"data-expandable": c,
|
|
149
152
|
"data-expanded": m,
|
|
150
|
-
"data-notification":
|
|
153
|
+
"data-notification": r,
|
|
151
154
|
html: $
|
|
152
155
|
},
|
|
153
|
-
|
|
156
|
+
r
|
|
154
157
|
);
|
|
155
158
|
})
|
|
156
159
|
}
|
|
157
160
|
);
|
|
158
|
-
},
|
|
159
|
-
${
|
|
161
|
+
}, B = d.div`
|
|
162
|
+
${Y}
|
|
160
163
|
padding: ${(e) => {
|
|
161
164
|
var t;
|
|
162
165
|
return (t = e.theme.sizes) == null ? void 0 : t.normal;
|
|
@@ -165,8 +168,8 @@ const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) :
|
|
|
165
168
|
return ((t = e.theme.sizes) == null ? void 0 : t.cardinal) * 12;
|
|
166
169
|
}}px;
|
|
167
170
|
background-color: ${(e) => {
|
|
168
|
-
var t,
|
|
169
|
-
return e["data-types"].length ? e["data-types"].indexOf("top") > -1 ? (t = e.theme.colors) == null ? void 0 : t.warning : e["data-types"].indexOf("bottom") > -1 ? "transparent" : (
|
|
171
|
+
var t, l, f;
|
|
172
|
+
return e["data-types"].length ? e["data-types"].indexOf("top") > -1 ? (t = e.theme.colors) == null ? void 0 : t.warning : e["data-types"].indexOf("bottom") > -1 ? "transparent" : (l = e.theme.colors) == null ? void 0 : l.primary : (f = e.theme.colors) == null ? void 0 : f.warning;
|
|
170
173
|
}};
|
|
171
174
|
color: ${(e) => {
|
|
172
175
|
var t;
|
|
@@ -193,13 +196,13 @@ const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) :
|
|
|
193
196
|
return (t = e.theme.colors) == null ? void 0 : t.link;
|
|
194
197
|
}};
|
|
195
198
|
&:focus-visible {
|
|
196
|
-
${
|
|
199
|
+
${_}
|
|
197
200
|
}
|
|
198
201
|
}
|
|
199
202
|
|
|
200
203
|
${(e) => {
|
|
201
204
|
var t;
|
|
202
|
-
return !e["data-allow-paging"] &&
|
|
205
|
+
return !e["data-allow-paging"] && g`
|
|
203
206
|
flex-wrap: wrap;
|
|
204
207
|
|
|
205
208
|
> div {
|
|
@@ -209,14 +212,14 @@ const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) :
|
|
|
209
212
|
`;
|
|
210
213
|
}};
|
|
211
214
|
|
|
212
|
-
${(e) =>
|
|
215
|
+
${(e) => g`
|
|
213
216
|
&:focus-visible {
|
|
214
217
|
.humany-html {
|
|
215
218
|
${N(e)}
|
|
216
219
|
}
|
|
217
220
|
}
|
|
218
221
|
`}
|
|
219
|
-
`, H = d(
|
|
222
|
+
`, H = d(q)`
|
|
220
223
|
flex: 1;
|
|
221
224
|
font-size: ${(e) => {
|
|
222
225
|
var t;
|
|
@@ -225,7 +228,7 @@ const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) :
|
|
|
225
228
|
line-height: 1.6em;
|
|
226
229
|
font-weight: 300;
|
|
227
230
|
|
|
228
|
-
${(e) => e["data-expandable"] && !e["data-expanded"] &&
|
|
231
|
+
${(e) => e["data-expandable"] && !e["data-expanded"] && g`
|
|
229
232
|
max-width: 100%;
|
|
230
233
|
|
|
231
234
|
p {
|
|
@@ -239,7 +242,7 @@ const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) :
|
|
|
239
242
|
}
|
|
240
243
|
}
|
|
241
244
|
`}
|
|
242
|
-
`,
|
|
245
|
+
`, X = d.div`
|
|
243
246
|
text-align: center;
|
|
244
247
|
width: 100%;
|
|
245
248
|
span {
|
|
@@ -251,7 +254,7 @@ const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) :
|
|
|
251
254
|
width: 30px;
|
|
252
255
|
text-align: center;
|
|
253
256
|
}
|
|
254
|
-
`, k = d(
|
|
257
|
+
`, k = d(J)`
|
|
255
258
|
background-color: transparent;
|
|
256
259
|
border: none;
|
|
257
260
|
cursor: pointer;
|
|
@@ -269,24 +272,24 @@ const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) :
|
|
|
269
272
|
${N}
|
|
270
273
|
}
|
|
271
274
|
|
|
272
|
-
${(e) => e["data-disabled"] ?
|
|
275
|
+
${(e) => e["data-disabled"] ? g`
|
|
273
276
|
opacity: 0.8;
|
|
274
|
-
` :
|
|
277
|
+
` : g`
|
|
275
278
|
@media (hover) {
|
|
276
279
|
&:hover {
|
|
277
280
|
opacity: 0.5;
|
|
278
281
|
}
|
|
279
282
|
}
|
|
280
283
|
`}
|
|
281
|
-
`,
|
|
284
|
+
`, Z = d(k)`
|
|
282
285
|
position: absolute;
|
|
283
286
|
top: 7.5px;
|
|
284
287
|
right: 7.5px;
|
|
285
288
|
width: 25px;
|
|
286
289
|
height: auto;
|
|
287
290
|
padding: ${(e) => {
|
|
288
|
-
var t,
|
|
289
|
-
return `calc(${(t = e.theme.sizes) == null ? void 0 : t.small}/2) ${(
|
|
291
|
+
var t, l;
|
|
292
|
+
return `calc(${(t = e.theme.sizes) == null ? void 0 : t.small}/2) ${(l = e.theme.sizes) == null ? void 0 : l.small}`;
|
|
290
293
|
}};
|
|
291
294
|
svg {
|
|
292
295
|
vertical-align: middle;
|
|
@@ -307,5 +310,5 @@ d.div`
|
|
|
307
310
|
display: none;
|
|
308
311
|
`;
|
|
309
312
|
export {
|
|
310
|
-
|
|
313
|
+
re as default
|
|
311
314
|
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),b=require("@emotion/react"),c=require("@emotion/styled"),i=require("@telia-ace/knowledge-widget-ui"),m=require("@telia-ace/widget-services"),w=require("@telia-ace/widget-utilities"),g=require("react"),j="closed-notifications",L={transform:{a:({children:e,...t})=>n.jsx("a",{...t,tabIndex:-1,children:e})}},R=({className:e,...t})=>{const{types:l=[],allowPaging:u=!0,notifications:N=[],expandable:p=!1,closeAriaLabel:O="",pageNextAriaLabel:B="",pagePreviousAriaLabel:A="",expandAriaLabel:T=""}=i.useProperties(),[x,H]=g.useState(!1),[y,C]=g.useState([]),[o,S]=g.useState(0),s=i.useContainer(),[$,I]=g.useState();g.useEffect(()=>{s&&(m.readStorage(s,j,m.StorageMedium.Session).then((a=[])=>C(a)),m.createStorageWriter(s,j,m.StorageCategory.Functional).then(a=>I(()=>a)))},[s]),g.useEffect(()=>{s&&m.readStorage(s,j,m.StorageMedium.Session).then((a=[])=>{y.forEach(r=>a.indexOf(r)===-1&&a.push(r)),$&&$(a)})},[y,s,$]);const d=N.filter(({id:a})=>y.indexOf(a)===-1),{length:f}=d;if(!d.length)return i.createEmptyComponent(s,{...t,className:w.appendClassNames(e,"humany-notification-row")});if(u){const a=d[o]||d[o+1]||d[o-1];if(!a)return i.createEmptyComponent(s,{...t,className:w.appendClassNames(e,"humany-notification-row")});const{id:r,body:v}=a||{},z=()=>H(!x);return n.jsxs(E,{...t,"aria-expanded":p?x:!0,"aria-label":T,tabIndex:p?0:-1,className:w.appendClassNames(e,"humany-notification-row"),"data-pageable":f>1,"data-types":l,"data-allow-paging":u,"data-expandable":p,onKeyDown:h=>{h.key==="Enter"&&z()},onClick:z,children:[n.jsx(M,{"aria-label":O,onClick:()=>{S(d.indexOf(a)),C([...y,r])},children:n.jsx(i.SymbolBadge,{symbol:{type:"Svg",content:"close"}})}),n.jsx(P,{htmlParseInstruction:!p||x?void 0:L,"data-pageable":f>1,"data-notification":r,"data-expandable":p,"data-expanded":x,html:v}),f>1&&n.jsxs(W,{children:[n.jsx(k,{"aria-label":A,"data-disabled":o===0,onClick:h=>{h.stopPropagation(),o>0&&S(o-1)},children:n.jsx(q,{size:10,symbol:{type:"Svg",content:"caret-left"}})}),n.jsxs("span",{children:[o+1,"/",f]}),n.jsx(k,{"aria-label":B,"data-disabled":o+1>=f,onClick:h=>{h.stopPropagation(),o<f-1&&S(o+1)},children:n.jsx(q,{size:10,symbol:{type:"Svg",content:"caret-right"}})})]})]})}return n.jsx(E,{...t,className:w.appendClassNames(e,"humany-notification-row"),"data-pageable":!1,"data-types":l,"data-allow-paging":!1,children:d.map(a=>{if(!a)return null;const{id:r,body:v}=a;return n.jsx(P,{"data-pageable":!1,"data-expandable":p,"data-expanded":x,"data-notification":r,html:v},r)})})},E=c.div`
|
|
2
|
+
${i.genericHtml}
|
|
3
|
+
padding: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.normal}} ${e=>{var t;return((t=e.theme.sizes)==null?void 0:t.cardinal)*12}}px;
|
|
4
|
+
background-color: ${e=>{var t,l,u;return e["data-types"].length?e["data-types"].indexOf("top")>-1?(t=e.theme.colors)==null?void 0:t.warning:e["data-types"].indexOf("bottom")>-1?"transparent":(l=e.theme.colors)==null?void 0:l.primary:(u=e.theme.colors)==null?void 0:u.warning}};
|
|
5
|
+
color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
|
|
6
|
+
border-radius: ${e=>e.theme.borderRadius};
|
|
7
|
+
text-align: center;
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
position: relative;
|
|
11
|
+
cursor: ${e=>e["data-expandable"]?"pointer":"default"};
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
|
|
14
|
+
i {
|
|
15
|
+
color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
a {
|
|
19
|
+
color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.link}};
|
|
20
|
+
&:focus-visible {
|
|
21
|
+
${i.linkTabStyle}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
${e=>{var t;return!e["data-allow-paging"]&&b.css`
|
|
26
|
+
flex-wrap: wrap;
|
|
27
|
+
|
|
28
|
+
> div {
|
|
29
|
+
min-width: 100%;
|
|
30
|
+
margin: ${((t=e.theme.sizes)==null?void 0:t.cardinal)*2}px;
|
|
31
|
+
}
|
|
32
|
+
`}};
|
|
33
|
+
|
|
34
|
+
${e=>b.css`
|
|
35
|
+
&:focus-visible {
|
|
36
|
+
.humany-html {
|
|
37
|
+
${i.borderTabStyle(e)}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
`}
|
|
41
|
+
`,P=c(i.Html)`
|
|
42
|
+
flex: 1;
|
|
43
|
+
font-size: ${e=>{var t;return(t=e.theme.fonts)==null?void 0:t.normal}};
|
|
44
|
+
line-height: 1.6em;
|
|
45
|
+
font-weight: 300;
|
|
46
|
+
|
|
47
|
+
${e=>e["data-expandable"]&&!e["data-expanded"]&&b.css`
|
|
48
|
+
max-width: 100%;
|
|
49
|
+
|
|
50
|
+
p {
|
|
51
|
+
display: none;
|
|
52
|
+
&:first-child {
|
|
53
|
+
display: block;
|
|
54
|
+
margin-bottom: 0;
|
|
55
|
+
white-space: nowrap;
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
text-overflow: ellipsis;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`}
|
|
61
|
+
`,W=c.div`
|
|
62
|
+
text-align: center;
|
|
63
|
+
width: 100%;
|
|
64
|
+
span {
|
|
65
|
+
font-size: ${e=>{var t;return(t=e.theme.fonts)==null?void 0:t.small}};
|
|
66
|
+
display: inline-block;
|
|
67
|
+
width: 30px;
|
|
68
|
+
text-align: center;
|
|
69
|
+
}
|
|
70
|
+
`,k=c(i.Button)`
|
|
71
|
+
background-color: transparent;
|
|
72
|
+
border: none;
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
transition: opacity 200ms ease-out;
|
|
75
|
+
justify-self: flex-end;
|
|
76
|
+
align-self: flex-start;
|
|
77
|
+
padding: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.small}} svg {
|
|
78
|
+
display: block;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&:focus-visible {
|
|
82
|
+
${i.borderTabStyle}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
${e=>e["data-disabled"]?b.css`
|
|
86
|
+
opacity: 0.8;
|
|
87
|
+
`:b.css`
|
|
88
|
+
@media (hover) {
|
|
89
|
+
&:hover {
|
|
90
|
+
opacity: 0.5;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
`}
|
|
94
|
+
`,M=c(k)`
|
|
95
|
+
position: absolute;
|
|
96
|
+
top: 7.5px;
|
|
97
|
+
right: 7.5px;
|
|
98
|
+
width: 25px;
|
|
99
|
+
height: auto;
|
|
100
|
+
padding: ${e=>{var t,l;return`calc(${(t=e.theme.sizes)==null?void 0:t.small}/2) ${(l=e.theme.sizes)==null?void 0:l.small}`}};
|
|
101
|
+
svg {
|
|
102
|
+
vertical-align: middle;
|
|
103
|
+
line,
|
|
104
|
+
path {
|
|
105
|
+
stroke: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
`,q=c(i.SymbolBadge)`
|
|
109
|
+
line {
|
|
110
|
+
stroke: #ffffff;
|
|
111
|
+
}
|
|
112
|
+
`;c.div`
|
|
113
|
+
display: none;
|
|
114
|
+
`;exports.default=R;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/knowledge-widget-components-notification-row",
|
|
3
|
-
"version": "1.1.1-rc.
|
|
3
|
+
"version": "1.1.1-rc.3",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@telia-ace/knowledge-widget-core": "^1.1.1-rc.
|
|
14
|
-
"@telia-ace/knowledge-widget-ui": "^1.1.1-rc.
|
|
15
|
-
"@telia-ace/widget-services": "^1.1.1-rc.
|
|
16
|
-
"@telia-ace/widget-utilities": "^1.1.1-rc.
|
|
17
|
-
"@telia-ace/knowledge-data-client": "^1.1.1-rc.
|
|
13
|
+
"@telia-ace/knowledge-widget-core": "^1.1.1-rc.3",
|
|
14
|
+
"@telia-ace/knowledge-widget-ui": "^1.1.1-rc.3",
|
|
15
|
+
"@telia-ace/widget-services": "^1.1.1-rc.3",
|
|
16
|
+
"@telia-ace/widget-utilities": "^1.1.1-rc.3",
|
|
17
|
+
"@telia-ace/knowledge-data-client": "^1.1.1-rc.3",
|
|
18
18
|
"@webprovisions/platform": "^1.1.4"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|