@telia-ace/knowledge-widget-components-notification-row 1.0.47-next.0 → 1.1.1-rc.0
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-19df0eec.js +1757 -0
- package/index-373df3a5.js +6 -0
- package/index-5c9c2abf.mjs +883 -0
- package/index-750561ea.mjs +11103 -0
- package/index.js +1 -0
- package/index.mjs +7 -0
- package/notification-row-4b11636a.js +114 -0
- package/notification-row-ce337619.mjs +311 -0
- package/package.json +16 -40
- package/LICENSE.txt +0 -6
- package/README.md +0 -3
- package/dist/index.js +0 -80
- package/dist/index.js.map +0 -1
- package/dist/notification-row.5162cdbf.js +0 -325
- package/dist/notification-row.5162cdbf.js.map +0 -1
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/notification-row-component.d.ts → notification-row-component.d.ts} +0 -0
- /package/{dist/notification-row.d.ts → notification-row.d.ts} +0 -0
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./index-19df0eec.js");require("react/jsx-runtime");require("react");require("react-dom");module.exports=e.NotificationRowComponent;
|
package/index.mjs
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),a=require("./index-19df0eec.js"),c=require("react");require("react-dom");const j=(e,t)=>e.get("seoConfiguration")?o.jsx(a.Empty,{...t}):null,T=()=>c.useContext(a.ComponentPropertyContext),S="closed-notifications",q={transform:{a:({children:e,...t})=>o.jsx("a",{...t,tabIndex:-1,children:e})}},H=({className:e,...t})=>{const{types:l=[],allowPaging:m=!0,notifications:E=[],expandable:p=!1,closeAriaLabel:P="",pageNextAriaLabel:N="",pagePreviousAriaLabel:O="",expandAriaLabel:B=""}=T(),[u,A]=c.useState(!1),[g,$]=c.useState([]),[i,h]=c.useState(0),s=a.useContainer(),[y,R]=c.useState();c.useEffect(()=>{s&&(a.readStorage(s,S,a.StorageMedium.Session).then((n=[])=>$(n)),a.createStorageWriter(s,S,a.StorageCategory.Functional).then(n=>R(()=>n)))},[s]),c.useEffect(()=>{s&&a.readStorage(s,S,a.StorageMedium.Session).then((n=[])=>{g.forEach(r=>n.indexOf(r)===-1&&n.push(r)),y&&y(n)})},[g,s,y]);const d=E.filter(({id:n})=>g.indexOf(n)===-1),{length:f}=d;if(!d.length)return j(s,{...t,className:a.appendClassNames(e,"humany-notification-row")});if(m){const n=d[i]||d[i+1]||d[i-1];if(!n)return j(s,{...t,className:a.appendClassNames(e,"humany-notification-row")});const{id:r,body:b}=n||{},v=()=>A(!u);return o.jsxs(C,{...t,"aria-expanded":p?u:!0,"aria-label":B,tabIndex:p?0:-1,className:a.appendClassNames(e,"humany-notification-row"),"data-pageable":f>1,"data-types":l,"data-allow-paging":m,"data-expandable":p,onKeyDown:x=>{x.key==="Enter"&&v()},onClick:v,children:[o.jsx(L,{"aria-label":P,onClick:()=>{h(d.indexOf(n)),$([...g,r])},children:o.jsx(a.SymbolBadge,{symbol:{type:"Svg",content:"close"}})}),o.jsx(k,{htmlParseInstruction:!p||u?void 0:q,"data-pageable":f>1,"data-notification":r,"data-expandable":p,"data-expanded":u,html:b}),f>1&&o.jsxs(I,{children:[o.jsx(w,{"aria-label":O,"data-disabled":i===0,onClick:x=>{x.stopPropagation(),i>0&&h(i-1)},children:o.jsx(z,{size:10,symbol:{type:"Svg",content:"caret-left"}})}),o.jsxs("span",{children:[i+1,"/",f]}),o.jsx(w,{"aria-label":N,"data-disabled":i+1>=f,onClick:x=>{x.stopPropagation(),i<f-1&&h(i+1)},children:o.jsx(z,{size:10,symbol:{type:"Svg",content:"caret-right"}})})]})]})}return o.jsx(C,{...t,className:a.appendClassNames(e,"humany-notification-row"),"data-pageable":!1,"data-types":l,"data-allow-paging":!1,children:d.map(n=>{if(!n)return null;const{id:r,body:b}=n;return o.jsx(k,{"data-pageable":!1,"data-expandable":p,"data-expanded":u,"data-notification":r,html:b},r)})})},C=a.newStyled.div`
|
|
2
|
+
${a.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,m;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:(m=e.theme.colors)==null?void 0:m.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
|
+
${a.linkTabStyle}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
${e=>{var t;return!e["data-allow-paging"]&&a.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=>a.css`
|
|
35
|
+
&:focus-visible {
|
|
36
|
+
.humany-html {
|
|
37
|
+
${a.borderTabStyle(e)}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
`}
|
|
41
|
+
`,k=a.newStyled(a.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"]&&a.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
|
+
`,I=a.newStyled.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
|
+
`,w=a.newStyled(a.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
|
+
${a.borderTabStyle}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
${e=>e["data-disabled"]?a.css`
|
|
86
|
+
opacity: 0.8;
|
|
87
|
+
`:a.css`
|
|
88
|
+
@media (hover) {
|
|
89
|
+
&:hover {
|
|
90
|
+
opacity: 0.5;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
`}
|
|
94
|
+
`,L=a.newStyled(w)`
|
|
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
|
+
`,z=a.newStyled(a.SymbolBadge)`
|
|
109
|
+
line {
|
|
110
|
+
stroke: #ffffff;
|
|
111
|
+
}
|
|
112
|
+
`;a.newStyled.div`
|
|
113
|
+
display: none;
|
|
114
|
+
`;exports.default=H;
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { jsx as n, jsxs as v } from "react/jsx-runtime";
|
|
2
|
+
import { E as G, C as M, u as Y, r as E, S as P, c as _, a as q, b, d as L, n as d, g as J, l as Q, e as h, f as N, H as U, B as V } from "./index-750561ea.mjs";
|
|
3
|
+
import { useContext as X, useState as x, useEffect as B } from "react";
|
|
4
|
+
import "react-dom";
|
|
5
|
+
const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) : null, Z = () => X(M), S = "closed-notifications", ee = {
|
|
6
|
+
transform: {
|
|
7
|
+
a: ({ children: e, ...t }) => /* @__PURE__ */ n("a", { ...t, tabIndex: -1, children: e })
|
|
8
|
+
}
|
|
9
|
+
}, le = ({ className: e, ...t }) => {
|
|
10
|
+
const {
|
|
11
|
+
types: s = [],
|
|
12
|
+
allowPaging: f = !0,
|
|
13
|
+
notifications: j = [],
|
|
14
|
+
expandable: c = !1,
|
|
15
|
+
closeAriaLabel: R = "",
|
|
16
|
+
pageNextAriaLabel: T = "",
|
|
17
|
+
pagePreviousAriaLabel: W = "",
|
|
18
|
+
expandAriaLabel: K = ""
|
|
19
|
+
} = Z(), [m, D] = x(!1), [u, C] = x([]), [o, y] = x(0), i = Y(), [w, F] = x();
|
|
20
|
+
B(() => {
|
|
21
|
+
i && (E(i, S, P.Session).then(
|
|
22
|
+
(a = []) => C(a)
|
|
23
|
+
), _(i, S, q.Functional).then(
|
|
24
|
+
(a) => F(() => a)
|
|
25
|
+
));
|
|
26
|
+
}, [i]), B(() => {
|
|
27
|
+
i && E(i, S, P.Session).then(
|
|
28
|
+
(a = []) => {
|
|
29
|
+
u.forEach(
|
|
30
|
+
(l) => a.indexOf(l) === -1 && a.push(l)
|
|
31
|
+
), w && w(a);
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}, [u, i, w]);
|
|
35
|
+
const r = j.filter(({ id: a }) => u.indexOf(a) === -1), { length: p } = r;
|
|
36
|
+
if (!r.length)
|
|
37
|
+
return O(i, {
|
|
38
|
+
...t,
|
|
39
|
+
className: b(e, "humany-notification-row")
|
|
40
|
+
});
|
|
41
|
+
if (f) {
|
|
42
|
+
const a = r[o] || r[o + 1] || r[o - 1];
|
|
43
|
+
if (!a)
|
|
44
|
+
return O(i, {
|
|
45
|
+
...t,
|
|
46
|
+
className: b(e, "humany-notification-row")
|
|
47
|
+
});
|
|
48
|
+
const { id: l, body: $ } = a || {}, z = () => D(!m);
|
|
49
|
+
return /* @__PURE__ */ v(
|
|
50
|
+
A,
|
|
51
|
+
{
|
|
52
|
+
...t,
|
|
53
|
+
"aria-expanded": c ? m : !0,
|
|
54
|
+
"aria-label": K,
|
|
55
|
+
tabIndex: c ? 0 : -1,
|
|
56
|
+
className: b(e, "humany-notification-row"),
|
|
57
|
+
"data-pageable": p > 1,
|
|
58
|
+
"data-types": s,
|
|
59
|
+
"data-allow-paging": f,
|
|
60
|
+
"data-expandable": c,
|
|
61
|
+
onKeyDown: (g) => {
|
|
62
|
+
g.key === "Enter" && z();
|
|
63
|
+
},
|
|
64
|
+
onClick: z,
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ n(
|
|
67
|
+
ae,
|
|
68
|
+
{
|
|
69
|
+
"aria-label": R,
|
|
70
|
+
onClick: () => {
|
|
71
|
+
y(r.indexOf(a)), C([...u, l]);
|
|
72
|
+
},
|
|
73
|
+
children: /* @__PURE__ */ n(L, { symbol: { type: "Svg", content: "close" } })
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ n(
|
|
77
|
+
H,
|
|
78
|
+
{
|
|
79
|
+
htmlParseInstruction: !c || m ? void 0 : ee,
|
|
80
|
+
"data-pageable": p > 1,
|
|
81
|
+
"data-notification": l,
|
|
82
|
+
"data-expandable": c,
|
|
83
|
+
"data-expanded": m,
|
|
84
|
+
html: $
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
p > 1 && /* @__PURE__ */ v(te, { children: [
|
|
88
|
+
/* @__PURE__ */ n(
|
|
89
|
+
k,
|
|
90
|
+
{
|
|
91
|
+
"aria-label": W,
|
|
92
|
+
"data-disabled": o === 0,
|
|
93
|
+
onClick: (g) => {
|
|
94
|
+
g.stopPropagation(), o > 0 && y(o - 1);
|
|
95
|
+
},
|
|
96
|
+
children: /* @__PURE__ */ n(
|
|
97
|
+
I,
|
|
98
|
+
{
|
|
99
|
+
size: 10,
|
|
100
|
+
symbol: { type: "Svg", content: "caret-left" }
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ v("span", { children: [
|
|
106
|
+
o + 1,
|
|
107
|
+
"/",
|
|
108
|
+
p
|
|
109
|
+
] }),
|
|
110
|
+
/* @__PURE__ */ n(
|
|
111
|
+
k,
|
|
112
|
+
{
|
|
113
|
+
"aria-label": T,
|
|
114
|
+
"data-disabled": o + 1 >= p,
|
|
115
|
+
onClick: (g) => {
|
|
116
|
+
g.stopPropagation(), o < p - 1 && y(o + 1);
|
|
117
|
+
},
|
|
118
|
+
children: /* @__PURE__ */ n(
|
|
119
|
+
I,
|
|
120
|
+
{
|
|
121
|
+
size: 10,
|
|
122
|
+
symbol: { type: "Svg", content: "caret-right" }
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
] })
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
return /* @__PURE__ */ n(
|
|
133
|
+
A,
|
|
134
|
+
{
|
|
135
|
+
...t,
|
|
136
|
+
className: b(e, "humany-notification-row"),
|
|
137
|
+
"data-pageable": !1,
|
|
138
|
+
"data-types": s,
|
|
139
|
+
"data-allow-paging": !1,
|
|
140
|
+
children: r.map((a) => {
|
|
141
|
+
if (!a)
|
|
142
|
+
return null;
|
|
143
|
+
const { id: l, body: $ } = a;
|
|
144
|
+
return /* @__PURE__ */ n(
|
|
145
|
+
H,
|
|
146
|
+
{
|
|
147
|
+
"data-pageable": !1,
|
|
148
|
+
"data-expandable": c,
|
|
149
|
+
"data-expanded": m,
|
|
150
|
+
"data-notification": l,
|
|
151
|
+
html: $
|
|
152
|
+
},
|
|
153
|
+
l
|
|
154
|
+
);
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
}, A = d.div`
|
|
159
|
+
${J}
|
|
160
|
+
padding: ${(e) => {
|
|
161
|
+
var t;
|
|
162
|
+
return (t = e.theme.sizes) == null ? void 0 : t.normal;
|
|
163
|
+
}} ${(e) => {
|
|
164
|
+
var t;
|
|
165
|
+
return ((t = e.theme.sizes) == null ? void 0 : t.cardinal) * 12;
|
|
166
|
+
}}px;
|
|
167
|
+
background-color: ${(e) => {
|
|
168
|
+
var t, s, f;
|
|
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" : (s = e.theme.colors) == null ? void 0 : s.primary : (f = e.theme.colors) == null ? void 0 : f.warning;
|
|
170
|
+
}};
|
|
171
|
+
color: ${(e) => {
|
|
172
|
+
var t;
|
|
173
|
+
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
174
|
+
}};
|
|
175
|
+
border-radius: ${(e) => e.theme.borderRadius};
|
|
176
|
+
text-align: center;
|
|
177
|
+
display: flex;
|
|
178
|
+
flex-direction: column;
|
|
179
|
+
position: relative;
|
|
180
|
+
cursor: ${(e) => e["data-expandable"] ? "pointer" : "default"};
|
|
181
|
+
overflow: hidden;
|
|
182
|
+
|
|
183
|
+
i {
|
|
184
|
+
color: ${(e) => {
|
|
185
|
+
var t;
|
|
186
|
+
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
187
|
+
}};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
a {
|
|
191
|
+
color: ${(e) => {
|
|
192
|
+
var t;
|
|
193
|
+
return (t = e.theme.colors) == null ? void 0 : t.link;
|
|
194
|
+
}};
|
|
195
|
+
&:focus-visible {
|
|
196
|
+
${Q}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
${(e) => {
|
|
201
|
+
var t;
|
|
202
|
+
return !e["data-allow-paging"] && h`
|
|
203
|
+
flex-wrap: wrap;
|
|
204
|
+
|
|
205
|
+
> div {
|
|
206
|
+
min-width: 100%;
|
|
207
|
+
margin: ${((t = e.theme.sizes) == null ? void 0 : t.cardinal) * 2}px;
|
|
208
|
+
}
|
|
209
|
+
`;
|
|
210
|
+
}};
|
|
211
|
+
|
|
212
|
+
${(e) => h`
|
|
213
|
+
&:focus-visible {
|
|
214
|
+
.humany-html {
|
|
215
|
+
${N(e)}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
`}
|
|
219
|
+
`, H = d(U)`
|
|
220
|
+
flex: 1;
|
|
221
|
+
font-size: ${(e) => {
|
|
222
|
+
var t;
|
|
223
|
+
return (t = e.theme.fonts) == null ? void 0 : t.normal;
|
|
224
|
+
}};
|
|
225
|
+
line-height: 1.6em;
|
|
226
|
+
font-weight: 300;
|
|
227
|
+
|
|
228
|
+
${(e) => e["data-expandable"] && !e["data-expanded"] && h`
|
|
229
|
+
max-width: 100%;
|
|
230
|
+
|
|
231
|
+
p {
|
|
232
|
+
display: none;
|
|
233
|
+
&:first-child {
|
|
234
|
+
display: block;
|
|
235
|
+
margin-bottom: 0;
|
|
236
|
+
white-space: nowrap;
|
|
237
|
+
overflow: hidden;
|
|
238
|
+
text-overflow: ellipsis;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
`}
|
|
242
|
+
`, te = d.div`
|
|
243
|
+
text-align: center;
|
|
244
|
+
width: 100%;
|
|
245
|
+
span {
|
|
246
|
+
font-size: ${(e) => {
|
|
247
|
+
var t;
|
|
248
|
+
return (t = e.theme.fonts) == null ? void 0 : t.small;
|
|
249
|
+
}};
|
|
250
|
+
display: inline-block;
|
|
251
|
+
width: 30px;
|
|
252
|
+
text-align: center;
|
|
253
|
+
}
|
|
254
|
+
`, k = d(V)`
|
|
255
|
+
background-color: transparent;
|
|
256
|
+
border: none;
|
|
257
|
+
cursor: pointer;
|
|
258
|
+
transition: opacity 200ms ease-out;
|
|
259
|
+
justify-self: flex-end;
|
|
260
|
+
align-self: flex-start;
|
|
261
|
+
padding: ${(e) => {
|
|
262
|
+
var t;
|
|
263
|
+
return (t = e.theme.sizes) == null ? void 0 : t.small;
|
|
264
|
+
}} svg {
|
|
265
|
+
display: block;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
&:focus-visible {
|
|
269
|
+
${N}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
${(e) => e["data-disabled"] ? h`
|
|
273
|
+
opacity: 0.8;
|
|
274
|
+
` : h`
|
|
275
|
+
@media (hover) {
|
|
276
|
+
&:hover {
|
|
277
|
+
opacity: 0.5;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
`}
|
|
281
|
+
`, ae = d(k)`
|
|
282
|
+
position: absolute;
|
|
283
|
+
top: 7.5px;
|
|
284
|
+
right: 7.5px;
|
|
285
|
+
width: 25px;
|
|
286
|
+
height: auto;
|
|
287
|
+
padding: ${(e) => {
|
|
288
|
+
var t, s;
|
|
289
|
+
return `calc(${(t = e.theme.sizes) == null ? void 0 : t.small}/2) ${(s = e.theme.sizes) == null ? void 0 : s.small}`;
|
|
290
|
+
}};
|
|
291
|
+
svg {
|
|
292
|
+
vertical-align: middle;
|
|
293
|
+
line,
|
|
294
|
+
path {
|
|
295
|
+
stroke: ${(e) => {
|
|
296
|
+
var t;
|
|
297
|
+
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
298
|
+
}};
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
`, I = d(L)`
|
|
302
|
+
line {
|
|
303
|
+
stroke: #ffffff;
|
|
304
|
+
}
|
|
305
|
+
`;
|
|
306
|
+
d.div`
|
|
307
|
+
display: none;
|
|
308
|
+
`;
|
|
309
|
+
export {
|
|
310
|
+
le as default
|
|
311
|
+
};
|
package/package.json
CHANGED
|
@@ -1,49 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/knowledge-widget-components-notification-row",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"sourceMain": "src/index.ts",
|
|
12
|
-
"type": "module",
|
|
13
|
-
"types": "dist/index.d.ts",
|
|
14
|
-
"files": [
|
|
15
|
-
"LICENSE.txt",
|
|
16
|
-
"README.md",
|
|
17
|
-
"dist/"
|
|
18
|
-
],
|
|
19
|
-
"publishConfig": {
|
|
20
|
-
"access": "public"
|
|
3
|
+
"version": "1.1.1-rc.0",
|
|
4
|
+
"main": "./index.js",
|
|
5
|
+
"types": "./index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./index.mjs",
|
|
9
|
+
"require": "./index.js"
|
|
10
|
+
}
|
|
21
11
|
},
|
|
22
|
-
"sideEffects": false,
|
|
23
12
|
"dependencies": {
|
|
24
|
-
"@telia-ace/knowledge-
|
|
25
|
-
"@telia-ace/knowledge-widget-
|
|
26
|
-
"@telia-ace/
|
|
27
|
-
"@telia-ace/widget-
|
|
28
|
-
"@telia-ace/
|
|
13
|
+
"@telia-ace/knowledge-widget-core": "^1.1.1-rc.0",
|
|
14
|
+
"@telia-ace/knowledge-widget-ui": "^1.1.1-rc.0",
|
|
15
|
+
"@telia-ace/widget-services": "^1.1.1-rc.0",
|
|
16
|
+
"@telia-ace/widget-utilities": "^1.1.1-rc.0",
|
|
17
|
+
"@telia-ace/knowledge-data-client": "^1.1.1-rc.0",
|
|
29
18
|
"@webprovisions/platform": "^1.1.4"
|
|
30
19
|
},
|
|
31
20
|
"peerDependencies": {
|
|
32
|
-
"@emotion/react": "
|
|
33
|
-
"@emotion/styled": "
|
|
34
|
-
"react": "
|
|
35
|
-
"react-dom": "^18.2.0"
|
|
36
|
-
},
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"@emotion/react": "^11.11.1",
|
|
39
|
-
"@emotion/styled": "^11.11.0",
|
|
40
|
-
"@types/react": "^18.2.22",
|
|
41
|
-
"@types/react-dom": "^18.2.7",
|
|
42
|
-
"react": "^18.2.0",
|
|
43
|
-
"react-dom": "^18.2.0"
|
|
44
|
-
},
|
|
45
|
-
"scripts": {
|
|
46
|
-
"clean": "rimraf ./dist",
|
|
47
|
-
"build": "rimraf ./dist && tsc -emitDeclarationOnly && vite build"
|
|
21
|
+
"@emotion/react": "11.11.1",
|
|
22
|
+
"@emotion/styled": "11.11.0",
|
|
23
|
+
"react": "18.2.0"
|
|
48
24
|
}
|
|
49
25
|
}
|
package/LICENSE.txt
DELETED
package/README.md
DELETED
package/dist/index.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
var m = Object.defineProperty, b = Object.defineProperties;
|
|
2
|
-
var C = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var g = Object.getOwnPropertySymbols;
|
|
4
|
-
var y = Object.prototype.hasOwnProperty, R = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var p = (t, e, i) => e in t ? m(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i, h = (t, e) => {
|
|
6
|
-
for (var i in e || (e = {}))
|
|
7
|
-
y.call(e, i) && p(t, i, e[i]);
|
|
8
|
-
if (g)
|
|
9
|
-
for (var i of g(e))
|
|
10
|
-
R.call(e, i) && p(t, i, e[i]);
|
|
11
|
-
return t;
|
|
12
|
-
}, d = (t, e) => b(t, C(e));
|
|
13
|
-
import { DataClient as v, DataType as x } from "@telia-ace/knowledge-data-client";
|
|
14
|
-
import { createEventSubscriber as D, extendComponent as N } from "@telia-ace/knowledge-widget-core";
|
|
15
|
-
import { createReactComponent as O } from "@telia-ace/knowledge-widget-ui";
|
|
16
|
-
const P = (t) => {
|
|
17
|
-
const { events: e } = t.get("$widget"), [i, u] = D(e);
|
|
18
|
-
return O(
|
|
19
|
-
t,
|
|
20
|
-
"notification-row",
|
|
21
|
-
import("./notification-row.5162cdbf.js"),
|
|
22
|
-
(r) => {
|
|
23
|
-
const s = (a) => {
|
|
24
|
-
r.writeProperties(d(h({}, r.properties()), {
|
|
25
|
-
loading: !0,
|
|
26
|
-
error: void 0,
|
|
27
|
-
notifications: []
|
|
28
|
-
})), r.actions.dispatch("fetch", { params: a });
|
|
29
|
-
};
|
|
30
|
-
return r.actions.create(
|
|
31
|
-
"fetch",
|
|
32
|
-
({
|
|
33
|
-
error: a,
|
|
34
|
-
topNotifications: o,
|
|
35
|
-
bottomNotifications: f,
|
|
36
|
-
middleNotifications: l
|
|
37
|
-
}) => {
|
|
38
|
-
if (a)
|
|
39
|
-
return r.actions.dispatch("fetched", {
|
|
40
|
-
error: a,
|
|
41
|
-
loading: !0,
|
|
42
|
-
notifications: []
|
|
43
|
-
});
|
|
44
|
-
let n = [];
|
|
45
|
-
const { notifications: w, types: c = [] } = r.properties();
|
|
46
|
-
return c.length ? (c.indexOf("top") > -1 && (n = n.concat(o)), c.indexOf("middle") > -1 && (n = n.concat(l)), c.indexOf("bottom") > -1 && (n = n.concat(f))) : n = o, r.actions.dispatch("fetched", {
|
|
47
|
-
notifications: n.length ? n : w,
|
|
48
|
-
loading: !1
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
), r.actions.create("fetched", (a) => r.writeProperties(d(h({}, a), { loading: !1 }))), t.getAsync("router").then((a) => {
|
|
52
|
-
const { params: o } = a.getRouteData();
|
|
53
|
-
s(o);
|
|
54
|
-
}), i("router:changed", (a, { current: o }) => {
|
|
55
|
-
s(o.routeData.params);
|
|
56
|
-
}), () => {
|
|
57
|
-
u();
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
).then(() => N(t, "notification-row", (r) => {
|
|
61
|
-
r.actions.watch("notification-row.fetch", (s, a) => v.getInstance(t).then(
|
|
62
|
-
(o) => o.fetch(x.RowNotifications, {
|
|
63
|
-
categories: [
|
|
64
|
-
s.params.guideCategory,
|
|
65
|
-
s.params.contactCategory
|
|
66
|
-
].filter((f) => !!f),
|
|
67
|
-
searchPhrase: s.params.phrase
|
|
68
|
-
})
|
|
69
|
-
).then(a).catch((o) => {
|
|
70
|
-
if (o)
|
|
71
|
-
return a(o);
|
|
72
|
-
}));
|
|
73
|
-
})).then(() => {
|
|
74
|
-
u();
|
|
75
|
-
});
|
|
76
|
-
}, S = P;
|
|
77
|
-
export {
|
|
78
|
-
S as default
|
|
79
|
-
};
|
|
80
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/notification-row-component.ts"],"sourcesContent":["import { DataClient, DataType, NotificationResults } from '@telia-ace/knowledge-data-client';\nimport {\n createEventSubscriber,\n extendComponent,\n Notification,\n} from '@telia-ace/knowledge-widget-core';\nimport { createReactComponent } from '@telia-ace/knowledge-widget-ui';\nimport { Container, Widget } from '@webprovisions/platform';\n\ntype NotificationType = 'top' | 'middle' | 'bottom';\nexport type NotificationRowComponentProps = {\n types: NotificationType[];\n allowPaging?: boolean;\n notifications?: Notification[]; // internal\n expandable?: boolean;\n pageNextAriaLabel?: string;\n pagePreviousAriaLabel?: string;\n closeAriaLabel?: string;\n expandAriaLabel?: string;\n};\n\ntype FetchResults = NotificationResults & { error: any };\n\nexport const NotificationRowComponent = (container: Container) => {\n const { events }: Widget = container.get('$widget');\n const [subscribe, unsubscribe] = createEventSubscriber(events);\n\n return createReactComponent(\n container,\n 'notification-row',\n import('./notification-row'),\n (component) => {\n const fetch = (params: { [key: string]: any }) => {\n component.writeProperties({\n ...component.properties<NotificationRowComponentProps>(),\n loading: true,\n error: undefined,\n notifications: [],\n });\n component.actions.dispatch('fetch', { params });\n };\n\n component.actions.create(\n 'fetch',\n ({\n error,\n topNotifications,\n bottomNotifications,\n middleNotifications,\n }: FetchResults) => {\n if (error) {\n return component.actions.dispatch('fetched', {\n error,\n loading: true,\n notifications: [],\n });\n }\n\n let newNotifications: Notification[] = [];\n const { notifications, types = [] } =\n component.properties<NotificationRowComponentProps>();\n if (types.length) {\n if (types.indexOf('top') > -1) {\n newNotifications = newNotifications.concat(topNotifications);\n }\n if (types.indexOf('middle') > -1) {\n newNotifications = newNotifications.concat(middleNotifications);\n }\n if (types.indexOf('bottom') > -1) {\n newNotifications = newNotifications.concat(bottomNotifications);\n }\n } else {\n newNotifications = topNotifications;\n }\n\n return component.actions.dispatch('fetched', {\n notifications: newNotifications.length ? newNotifications : notifications,\n loading: false,\n });\n }\n );\n\n component.actions.create('fetched', (input) => {\n return component.writeProperties({ ...input, loading: false });\n });\n\n container.getAsync('router').then((router) => {\n const { params } = router.getRouteData();\n fetch(params);\n });\n\n subscribe('router:changed', (event: any, { current }: any) => {\n fetch(current.routeData.params);\n });\n\n return () => {\n unsubscribe();\n };\n }\n )\n .then(() => {\n return extendComponent(container, 'notification-row', (component) => {\n component.actions.watch('notification-row.fetch', (input, next) => {\n return DataClient.getInstance(container)\n .then((dataClient: DataClient) =>\n dataClient.fetch(DataType.RowNotifications, {\n categories: [\n input.params.guideCategory,\n input.params.contactCategory,\n ].filter((c) => !!c),\n searchPhrase: input.params.phrase,\n })\n )\n .then(next)\n .catch((error) => {\n if (error) {\n return next(error);\n }\n });\n });\n });\n })\n .then(() => {\n unsubscribe();\n });\n};\n\nexport default NotificationRowComponent;\n"],"names":["NotificationRowComponent","container","events","subscribe","unsubscribe","createEventSubscriber","createReactComponent","component","fetch","params","__spreadProps","__spreadValues","error","topNotifications","bottomNotifications","middleNotifications","newNotifications","notifications","types","input","router","event","current","extendComponent","next","DataClient","dataClient","DataType","c","NotificationRowComponent$1"],"mappings":";;;;;;;;;;;;;;;AAuBa,MAAAA,IAA2B,CAACC,MAAyB;AAC9D,QAAM,EAAE,QAAAC,EAAmB,IAAAD,EAAU,IAAI,SAAS,GAC5C,CAACE,GAAWC,CAAW,IAAIC,EAAsBH,CAAM;AAEtD,SAAAI;AAAA,IACHL;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,CAACM,MAAc;AACL,YAAAC,IAAQ,CAACC,MAAmC;AAC9C,QAAAF,EAAU,gBAAgBG,EAAAC,EAAA,IACnBJ,EAAU,WAA0C,IADjC;AAAA,UAEtB,SAAS;AAAA,UACT,OAAO;AAAA,UACP,eAAe,CAAC;AAAA,QAAA,EACnB,GACDA,EAAU,QAAQ,SAAS,SAAS,EAAE,QAAAE,EAAQ,CAAA;AAAA,MAAA;AAGlD,aAAAF,EAAU,QAAQ;AAAA,QACd;AAAA,QACA,CAAC;AAAA,UACG,OAAAK;AAAA,UACA,kBAAAC;AAAA,UACA,qBAAAC;AAAA,UACA,qBAAAC;AAAA,QAAA,MACgB;AAChB,cAAIH;AACO,mBAAAL,EAAU,QAAQ,SAAS,WAAW;AAAA,cACzC,OAAAK;AAAA,cACA,SAAS;AAAA,cACT,eAAe,CAAC;AAAA,YAAA,CACnB;AAGL,cAAII,IAAmC,CAAA;AACvC,gBAAM,EAAE,eAAAC,GAAe,OAAAC,IAAQ,CAAG,EAAA,IAC9BX,EAAU;AACd,iBAAIW,EAAM,UACFA,EAAM,QAAQ,KAAK,IAAI,OACJF,IAAAA,EAAiB,OAAOH,CAAgB,IAE3DK,EAAM,QAAQ,QAAQ,IAAI,OACPF,IAAAA,EAAiB,OAAOD,CAAmB,IAE9DG,EAAM,QAAQ,QAAQ,IAAI,OACPF,IAAAA,EAAiB,OAAOF,CAAmB,MAG/CE,IAAAH,GAGhBN,EAAU,QAAQ,SAAS,WAAW;AAAA,YACzC,eAAeS,EAAiB,SAASA,IAAmBC;AAAA,YAC5D,SAAS;AAAA,UAAA,CACZ;AAAA,QACL;AAAA,MAAA,GAGJV,EAAU,QAAQ,OAAO,WAAW,CAACY,MAC1BZ,EAAU,gBAAgBG,EAAAC,EAAA,IAAKQ,IAAL,EAAY,SAAS,KAAO,CAChE,GAEDlB,EAAU,SAAS,QAAQ,EAAE,KAAK,CAACmB,MAAW;AAC1C,cAAM,EAAE,QAAAX,EAAA,IAAWW,EAAO,aAAa;AACvC,QAAAZ,EAAMC,CAAM;AAAA,MAAA,CACf,GAEDN,EAAU,kBAAkB,CAACkB,GAAY,EAAE,SAAAC,QAAmB;AACpD,QAAAd,EAAAc,EAAQ,UAAU,MAAM;AAAA,MAAA,CACjC,GAEM,MAAM;AACG,QAAAlB;MAAA;AAAA,IAEpB;AAAA,EACJ,EACK,KAAK,MACKmB,EAAgBtB,GAAW,oBAAoB,CAACM,MAAc;AACjE,IAAAA,EAAU,QAAQ,MAAM,0BAA0B,CAACY,GAAOK,MAC/CC,EAAW,YAAYxB,CAAS,EAClC;AAAA,MAAK,CAACyB,MACHA,EAAW,MAAMC,EAAS,kBAAkB;AAAA,QACxC,YAAY;AAAA,UACRR,EAAM,OAAO;AAAA,UACbA,EAAM,OAAO;AAAA,UACf,OAAO,CAACS,MAAM,CAAC,CAACA,CAAC;AAAA,QACnB,cAAcT,EAAM,OAAO;AAAA,MAAA,CAC9B;AAAA,MAEJ,KAAKK,CAAI,EACT,MAAM,CAACZ,MAAU;AACd,UAAIA;AACA,eAAOY,EAAKZ,CAAK;AAAA,IACrB,CACH,CACR;AAAA,EAAA,CACJ,CACJ,EACA,KAAK,MAAM;AACI,IAAAR;EAAA,CACf;AACT,GAEAyB,IAAe7B;"}
|