@telia-ace/knowledge-widget-components-notification-row 0.0.1
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.d.ts +3 -0
- package/index.js +1 -0
- package/index.mjs +68 -0
- package/notification-row-7a9d4926.js +114 -0
- package/notification-row-a3660cfb.mjs +328 -0
- package/notification-row-component.d.ts +16 -0
- package/notification-row.d.ts +7 -0
- package/package.json +25 -0
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
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-7a9d4926.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
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
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-a3660cfb.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
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
v as default
|
|
68
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),y=require("@emotion/react"),f=require("@emotion/styled"),o=require("@telia-ace/knowledge-widget-ui"),m=require("@telia-ace/widget-services"),S=require("@telia-ace/widget-utilities"),r=require("react"),C="closed-notifications",K={transform:{a:({children:e,...t})=>i.jsx("a",{...t,tabIndex:-1,children:e})}},U=({className:e,...t})=>{const{types:d=[],allowPaging:b=!0,notifications:B=[],closeAriaLabel:A="",pageNextAriaLabel:I="",pagePreviousAriaLabel:T="",expandAriaLabel:N=""}=o.useProperties(),[x,H]=r.useState(!1),[w,R]=r.useState([]),[s,v]=r.useState(0),l=o.useContainer(),[$,L]=r.useState();r.useEffect(()=>{l&&(m.readStorage(l,C,m.StorageMedium.Session).then((a=[])=>R(a)),m.createStorageWriter(l,C,m.StorageCategory.Functional).then(a=>L(()=>a)))},[l]),r.useEffect(()=>{l&&m.readStorage(l,C,m.StorageMedium.Session).then((a=[])=>{w.forEach(n=>a.indexOf(n)===-1&&a.push(n)),$&&$(a)})},[w,l,$]);const p=B.filter(({id:a})=>w.indexOf(a)===-1),{length:u}=p,[c,j]=r.useState(o.useProperties().expandable),W=r.useRef(null),g=l.get("$widget"),M=r.useRef(t.id);if(r.useEffect(()=>{g.events.subscribe("notification:expandable",(a,n)=>{n.notificationRowId===M.current&&j(n.expandable)})},[g.events]),!p.length)return o.createEmptyComponent(l,{...t,className:S.appendClassNames(e,"humany-notification-row")});const z=()=>H(!x);if(b){const a=p[s]||p[s+1]||p[s-1];if(!a)return o.createEmptyComponent(l,{...t,className:S.appendClassNames(e,"humany-notification-row")});const{id:n,body:k}=a||{};return!c&&g.container.expandableNotifications&&g.container.expandableNotifications.has(n)&&j(!0),i.jsxs(P,{...t,...c?{"aria-expanded":x,role:"button"}:{},...N?{"aria-label":N}:{},tabIndex:c?0:-1,className:S.appendClassNames(e,"humany-notification-row"),"data-pageable":u>1,"data-types":d,"data-allow-paging":b,"data-expandable":c,ref:W,onKeyDown:h=>{h.key==="Enter"&&z()},onClick:z,children:[i.jsx(F,{"aria-label":A,onClick:()=>{v(p.indexOf(a)),R([...w,n])},children:i.jsx(o.SymbolBadge,{symbol:{type:"Svg",content:"close"}})}),i.jsx(q,{htmlParseInstruction:!c||x?void 0:K,"data-pageable":u>1,"data-notification":n,"data-expandable":c,"data-expanded":x,html:k}),u>1&&i.jsxs(D,{children:[i.jsx(E,{"data-testid":"page-left-button","aria-label":T,"data-disabled":s===0,onClick:h=>{h.stopPropagation(),s>0&&v(s-1)},children:i.jsx(O,{size:10,symbol:{type:"Svg",content:"caret-left"}})}),i.jsxs("span",{children:[s+1,"/",u]}),i.jsx(E,{"data-testid":"page-right-button","aria-label":I,"data-disabled":s+1>=u,onClick:h=>{h.stopPropagation(),s<u-1&&v(s+1)},children:i.jsx(O,{size:10,symbol:{type:"Svg",content:"caret-right"}})})]})]})}return i.jsx(P,{...t,className:S.appendClassNames(e,"humany-notification-row"),"data-pageable":!1,"data-types":d,"data-allow-paging":!1,children:p.map(a=>{if(!a)return null;const{id:n,body:k}=a;return!c&&g.container.expandableNotifications&&g.container.expandableNotifications.has(n)&&j(!0),i.jsx(q,{"data-pageable":!1,"data-expandable":c,"data-expanded":x,"data-notification":n,html:k},n)})})},P=f.div`
|
|
2
|
+
${o.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,d,b;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":(d=e.theme.colors)==null?void 0:d.primary:(b=e.theme.colors)==null?void 0:b.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
|
+
${o.linkTabStyle}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
${e=>{var t;return!e["data-allow-paging"]&&y.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=>y.css`
|
|
35
|
+
&:focus-visible {
|
|
36
|
+
.humany-html {
|
|
37
|
+
${o.borderTabStyle(e)}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
`}
|
|
41
|
+
`,q=f(o.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"]&&y.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
|
+
`,D=f.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
|
+
`,E=f(o.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
|
+
${o.borderTabStyle}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
${e=>e["data-disabled"]?y.css`
|
|
86
|
+
opacity: 0.8;
|
|
87
|
+
`:y.css`
|
|
88
|
+
@media (hover) {
|
|
89
|
+
&:hover {
|
|
90
|
+
opacity: 0.5;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
`}
|
|
94
|
+
`,F=f(E)`
|
|
95
|
+
position: absolute;
|
|
96
|
+
top: 7.5px;
|
|
97
|
+
right: 7.5px;
|
|
98
|
+
width: 25px;
|
|
99
|
+
height: auto;
|
|
100
|
+
padding: ${e=>{var t,d;return`calc(${(t=e.theme.sizes)==null?void 0:t.small}/2) ${(d=e.theme.sizes)==null?void 0:d.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
|
+
`,O=f(o.SymbolBadge)`
|
|
109
|
+
line {
|
|
110
|
+
stroke: #ffffff;
|
|
111
|
+
}
|
|
112
|
+
`;f.div`
|
|
113
|
+
display: none;
|
|
114
|
+
`;exports.default=U;
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { jsxs as k, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { css as u } from "@emotion/react";
|
|
3
|
+
import c from "@emotion/styled";
|
|
4
|
+
import { useProperties as O, useContainer as J, createEmptyComponent as A, SymbolBadge as T, genericHtml as Q, linkTabStyle as U, borderTabStyle as W, Html as V, Button as X } from "@telia-ace/knowledge-widget-ui";
|
|
5
|
+
import { readStorage as B, StorageMedium as I, createStorageWriter as Z, StorageCategory as ee } from "@telia-ace/widget-services";
|
|
6
|
+
import { appendClassNames as y } from "@telia-ace/widget-utilities";
|
|
7
|
+
import te, { useState as h, useEffect as z, useRef as ae } from "react";
|
|
8
|
+
const R = "closed-notifications", ne = {
|
|
9
|
+
transform: {
|
|
10
|
+
a: ({ children: e, ...t }) => /* @__PURE__ */ l("a", { ...t, tabIndex: -1, children: e })
|
|
11
|
+
}
|
|
12
|
+
}, me = ({ className: e, ...t }) => {
|
|
13
|
+
const {
|
|
14
|
+
types: r = [],
|
|
15
|
+
allowPaging: m = !0,
|
|
16
|
+
notifications: K = [],
|
|
17
|
+
closeAriaLabel: D = "",
|
|
18
|
+
pageNextAriaLabel: F = "",
|
|
19
|
+
pagePreviousAriaLabel: G = "",
|
|
20
|
+
expandAriaLabel: C = ""
|
|
21
|
+
} = O(), [b, M] = h(!1), [x, N] = h([]), [i, w] = h(0), o = J(), [$, Y] = h();
|
|
22
|
+
z(() => {
|
|
23
|
+
o && (B(o, R, I.Session).then(
|
|
24
|
+
(a = []) => N(a)
|
|
25
|
+
), Z(
|
|
26
|
+
o,
|
|
27
|
+
R,
|
|
28
|
+
ee.Functional
|
|
29
|
+
).then((a) => Y(() => a)));
|
|
30
|
+
}, [o]), z(() => {
|
|
31
|
+
o && B(o, R, I.Session).then(
|
|
32
|
+
(a = []) => {
|
|
33
|
+
x.forEach(
|
|
34
|
+
(n) => a.indexOf(n) === -1 && a.push(n)
|
|
35
|
+
), $ && $(a);
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}, [x, o, $]);
|
|
39
|
+
const d = K.filter(({ id: a }) => x.indexOf(a) === -1), { length: p } = d, [s, v] = h(
|
|
40
|
+
O().expandable
|
|
41
|
+
), _ = te.useRef(null), f = o.get("$widget"), q = ae(t.id);
|
|
42
|
+
if (z(() => {
|
|
43
|
+
f.events.subscribe(
|
|
44
|
+
"notification:expandable",
|
|
45
|
+
(a, n) => {
|
|
46
|
+
n.notificationRowId === q.current && v(n.expandable);
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}, [f.events]), !d.length)
|
|
50
|
+
return A(o, {
|
|
51
|
+
...t,
|
|
52
|
+
className: y(e, "humany-notification-row")
|
|
53
|
+
});
|
|
54
|
+
const P = () => M(!b);
|
|
55
|
+
if (m) {
|
|
56
|
+
const a = d[i] || d[i + 1] || d[i - 1];
|
|
57
|
+
if (!a)
|
|
58
|
+
return A(o, {
|
|
59
|
+
...t,
|
|
60
|
+
className: y(e, "humany-notification-row")
|
|
61
|
+
});
|
|
62
|
+
const { id: n, body: S } = a || {};
|
|
63
|
+
return !s && f.container.expandableNotifications && f.container.expandableNotifications.has(n) && v(!0), /* @__PURE__ */ k(
|
|
64
|
+
H,
|
|
65
|
+
{
|
|
66
|
+
...t,
|
|
67
|
+
...s ? { "aria-expanded": b, role: "button" } : {},
|
|
68
|
+
...C ? { "aria-label": C } : {},
|
|
69
|
+
tabIndex: s ? 0 : -1,
|
|
70
|
+
className: y(e, "humany-notification-row"),
|
|
71
|
+
"data-pageable": p > 1,
|
|
72
|
+
"data-types": r,
|
|
73
|
+
"data-allow-paging": m,
|
|
74
|
+
"data-expandable": s,
|
|
75
|
+
ref: _,
|
|
76
|
+
onKeyDown: (g) => {
|
|
77
|
+
g.key === "Enter" && P();
|
|
78
|
+
},
|
|
79
|
+
onClick: P,
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ l(
|
|
82
|
+
oe,
|
|
83
|
+
{
|
|
84
|
+
"aria-label": D,
|
|
85
|
+
onClick: () => {
|
|
86
|
+
w(d.indexOf(a)), N([...x, n]);
|
|
87
|
+
},
|
|
88
|
+
children: /* @__PURE__ */ l(T, { symbol: { type: "Svg", content: "close" } })
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
/* @__PURE__ */ l(
|
|
92
|
+
L,
|
|
93
|
+
{
|
|
94
|
+
htmlParseInstruction: !s || b ? void 0 : ne,
|
|
95
|
+
"data-pageable": p > 1,
|
|
96
|
+
"data-notification": n,
|
|
97
|
+
"data-expandable": s,
|
|
98
|
+
"data-expanded": b,
|
|
99
|
+
html: S
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
p > 1 && /* @__PURE__ */ k(ie, { children: [
|
|
103
|
+
/* @__PURE__ */ l(
|
|
104
|
+
E,
|
|
105
|
+
{
|
|
106
|
+
"data-testid": "page-left-button",
|
|
107
|
+
"aria-label": G,
|
|
108
|
+
"data-disabled": i === 0,
|
|
109
|
+
onClick: (g) => {
|
|
110
|
+
g.stopPropagation(), i > 0 && w(i - 1);
|
|
111
|
+
},
|
|
112
|
+
children: /* @__PURE__ */ l(
|
|
113
|
+
j,
|
|
114
|
+
{
|
|
115
|
+
size: 10,
|
|
116
|
+
symbol: { type: "Svg", content: "caret-left" }
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
/* @__PURE__ */ k("span", { children: [
|
|
122
|
+
i + 1,
|
|
123
|
+
"/",
|
|
124
|
+
p
|
|
125
|
+
] }),
|
|
126
|
+
/* @__PURE__ */ l(
|
|
127
|
+
E,
|
|
128
|
+
{
|
|
129
|
+
"data-testid": "page-right-button",
|
|
130
|
+
"aria-label": F,
|
|
131
|
+
"data-disabled": i + 1 >= p,
|
|
132
|
+
onClick: (g) => {
|
|
133
|
+
g.stopPropagation(), i < p - 1 && w(i + 1);
|
|
134
|
+
},
|
|
135
|
+
children: /* @__PURE__ */ l(
|
|
136
|
+
j,
|
|
137
|
+
{
|
|
138
|
+
size: 10,
|
|
139
|
+
symbol: { type: "Svg", content: "caret-right" }
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
] })
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
return /* @__PURE__ */ l(
|
|
150
|
+
H,
|
|
151
|
+
{
|
|
152
|
+
...t,
|
|
153
|
+
className: y(e, "humany-notification-row"),
|
|
154
|
+
"data-pageable": !1,
|
|
155
|
+
"data-types": r,
|
|
156
|
+
"data-allow-paging": !1,
|
|
157
|
+
children: d.map((a) => {
|
|
158
|
+
if (!a)
|
|
159
|
+
return null;
|
|
160
|
+
const { id: n, body: S } = a;
|
|
161
|
+
return !s && f.container.expandableNotifications && f.container.expandableNotifications.has(n) && v(!0), /* @__PURE__ */ l(
|
|
162
|
+
L,
|
|
163
|
+
{
|
|
164
|
+
"data-pageable": !1,
|
|
165
|
+
"data-expandable": s,
|
|
166
|
+
"data-expanded": b,
|
|
167
|
+
"data-notification": n,
|
|
168
|
+
html: S
|
|
169
|
+
},
|
|
170
|
+
n
|
|
171
|
+
);
|
|
172
|
+
})
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
}, H = c.div`
|
|
176
|
+
${Q}
|
|
177
|
+
padding: ${(e) => {
|
|
178
|
+
var t;
|
|
179
|
+
return (t = e.theme.sizes) == null ? void 0 : t.normal;
|
|
180
|
+
}} ${(e) => {
|
|
181
|
+
var t;
|
|
182
|
+
return ((t = e.theme.sizes) == null ? void 0 : t.cardinal) * 12;
|
|
183
|
+
}}px;
|
|
184
|
+
background-color: ${(e) => {
|
|
185
|
+
var t, r, m;
|
|
186
|
+
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" : (r = e.theme.colors) == null ? void 0 : r.primary : (m = e.theme.colors) == null ? void 0 : m.warning;
|
|
187
|
+
}};
|
|
188
|
+
color: ${(e) => {
|
|
189
|
+
var t;
|
|
190
|
+
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
191
|
+
}};
|
|
192
|
+
border-radius: ${(e) => e.theme.borderRadius};
|
|
193
|
+
text-align: center;
|
|
194
|
+
display: flex;
|
|
195
|
+
flex-direction: column;
|
|
196
|
+
position: relative;
|
|
197
|
+
cursor: ${(e) => e["data-expandable"] ? "pointer" : "default"};
|
|
198
|
+
overflow: hidden;
|
|
199
|
+
|
|
200
|
+
i {
|
|
201
|
+
color: ${(e) => {
|
|
202
|
+
var t;
|
|
203
|
+
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
204
|
+
}};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
a {
|
|
208
|
+
color: ${(e) => {
|
|
209
|
+
var t;
|
|
210
|
+
return (t = e.theme.colors) == null ? void 0 : t.link;
|
|
211
|
+
}};
|
|
212
|
+
&:focus-visible {
|
|
213
|
+
${U}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
${(e) => {
|
|
218
|
+
var t;
|
|
219
|
+
return !e["data-allow-paging"] && u`
|
|
220
|
+
flex-wrap: wrap;
|
|
221
|
+
|
|
222
|
+
> div {
|
|
223
|
+
min-width: 100%;
|
|
224
|
+
margin: ${((t = e.theme.sizes) == null ? void 0 : t.cardinal) * 2}px;
|
|
225
|
+
}
|
|
226
|
+
`;
|
|
227
|
+
}};
|
|
228
|
+
|
|
229
|
+
${(e) => u`
|
|
230
|
+
&:focus-visible {
|
|
231
|
+
.humany-html {
|
|
232
|
+
${W(e)}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
`}
|
|
236
|
+
`, L = c(V)`
|
|
237
|
+
flex: 1;
|
|
238
|
+
font-size: ${(e) => {
|
|
239
|
+
var t;
|
|
240
|
+
return (t = e.theme.fonts) == null ? void 0 : t.normal;
|
|
241
|
+
}};
|
|
242
|
+
line-height: 1.6em;
|
|
243
|
+
font-weight: 300;
|
|
244
|
+
|
|
245
|
+
${(e) => e["data-expandable"] && !e["data-expanded"] && u`
|
|
246
|
+
max-width: 100%;
|
|
247
|
+
|
|
248
|
+
p {
|
|
249
|
+
display: none;
|
|
250
|
+
&:first-child {
|
|
251
|
+
display: block;
|
|
252
|
+
margin-bottom: 0;
|
|
253
|
+
white-space: nowrap;
|
|
254
|
+
overflow: hidden;
|
|
255
|
+
text-overflow: ellipsis;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
`}
|
|
259
|
+
`, ie = c.div`
|
|
260
|
+
text-align: center;
|
|
261
|
+
width: 100%;
|
|
262
|
+
span {
|
|
263
|
+
font-size: ${(e) => {
|
|
264
|
+
var t;
|
|
265
|
+
return (t = e.theme.fonts) == null ? void 0 : t.small;
|
|
266
|
+
}};
|
|
267
|
+
display: inline-block;
|
|
268
|
+
width: 30px;
|
|
269
|
+
text-align: center;
|
|
270
|
+
}
|
|
271
|
+
`, E = c(X)`
|
|
272
|
+
background-color: transparent;
|
|
273
|
+
border: none;
|
|
274
|
+
cursor: pointer;
|
|
275
|
+
transition: opacity 200ms ease-out;
|
|
276
|
+
justify-self: flex-end;
|
|
277
|
+
align-self: flex-start;
|
|
278
|
+
padding: ${(e) => {
|
|
279
|
+
var t;
|
|
280
|
+
return (t = e.theme.sizes) == null ? void 0 : t.small;
|
|
281
|
+
}} svg {
|
|
282
|
+
display: block;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
&:focus-visible {
|
|
286
|
+
${W}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
${(e) => e["data-disabled"] ? u`
|
|
290
|
+
opacity: 0.8;
|
|
291
|
+
` : u`
|
|
292
|
+
@media (hover) {
|
|
293
|
+
&:hover {
|
|
294
|
+
opacity: 0.5;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
`}
|
|
298
|
+
`, oe = c(E)`
|
|
299
|
+
position: absolute;
|
|
300
|
+
top: 7.5px;
|
|
301
|
+
right: 7.5px;
|
|
302
|
+
width: 25px;
|
|
303
|
+
height: auto;
|
|
304
|
+
padding: ${(e) => {
|
|
305
|
+
var t, r;
|
|
306
|
+
return `calc(${(t = e.theme.sizes) == null ? void 0 : t.small}/2) ${(r = e.theme.sizes) == null ? void 0 : r.small}`;
|
|
307
|
+
}};
|
|
308
|
+
svg {
|
|
309
|
+
vertical-align: middle;
|
|
310
|
+
line,
|
|
311
|
+
path {
|
|
312
|
+
stroke: ${(e) => {
|
|
313
|
+
var t;
|
|
314
|
+
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
315
|
+
}};
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
`, j = c(T)`
|
|
319
|
+
line {
|
|
320
|
+
stroke: #ffffff;
|
|
321
|
+
}
|
|
322
|
+
`;
|
|
323
|
+
c.div`
|
|
324
|
+
display: none;
|
|
325
|
+
`;
|
|
326
|
+
export {
|
|
327
|
+
me as default
|
|
328
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Notification } from '../../../knowledge/core/src/index.ts';
|
|
2
|
+
import { Container } from '@webprovisions/platform';
|
|
3
|
+
|
|
4
|
+
type NotificationType = 'top' | 'middle' | 'bottom';
|
|
5
|
+
export type NotificationRowComponentProps = {
|
|
6
|
+
types: NotificationType[];
|
|
7
|
+
allowPaging?: boolean;
|
|
8
|
+
notifications?: Notification[];
|
|
9
|
+
expandable?: boolean;
|
|
10
|
+
pageNextAriaLabel?: string;
|
|
11
|
+
pagePreviousAriaLabel?: string;
|
|
12
|
+
closeAriaLabel?: string;
|
|
13
|
+
expandAriaLabel?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const NotificationRowComponent: (container: Container) => Promise<void>;
|
|
16
|
+
export default NotificationRowComponent;
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@telia-ace/knowledge-widget-components-notification-row",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "./index.js",
|
|
5
|
+
"types": "./index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./index.mjs",
|
|
9
|
+
"require": "./index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@telia-ace/knowledge-widget-core": "*",
|
|
14
|
+
"@telia-ace/knowledge-widget-ui": "*",
|
|
15
|
+
"@telia-ace/widget-services": "*",
|
|
16
|
+
"@telia-ace/widget-utilities": "*",
|
|
17
|
+
"@telia-ace/knowledge-data-client": "*",
|
|
18
|
+
"@webprovisions/platform": "^1.1.4"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"@emotion/react": "11.11.1",
|
|
22
|
+
"@emotion/styled": "11.11.0",
|
|
23
|
+
"react": "18.2.0"
|
|
24
|
+
}
|
|
25
|
+
}
|