@telia-ace/knowledge-widget-components-notification-row 1.1.1-rc.0 → 1.1.1-rc.2

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 CHANGED
@@ -1 +1 @@
1
- "use strict";const e=require("./index-19df0eec.js");require("react/jsx-runtime");require("react");require("react-dom");module.exports=e.NotificationRowComponent;
1
+ "use strict";const e=require("./index-421eaa7e.js");require("react/jsx-runtime");require("@emotion/styled");require("@emotion/react");require("react");require("react-transition-group");require("react-dom");require("react-router-dom");module.exports=e.NotificationRowComponent;
package/index.mjs CHANGED
@@ -1,7 +1,11 @@
1
- import { N as i } from "./index-750561ea.mjs";
1
+ import { N as d } from "./index-fbfe8881.mjs";
2
2
  import "react/jsx-runtime";
3
+ import "@emotion/styled";
4
+ import "@emotion/react";
3
5
  import "react";
6
+ import "react-transition-group";
4
7
  import "react-dom";
8
+ import "react-router-dom";
5
9
  export {
6
- i as default
10
+ d as default
7
11
  };
@@ -1,14 +1,18 @@
1
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";
2
+ import { css as h } from "@emotion/react";
3
+ import d from "@emotion/styled";
4
+ 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, g as J, l as Q, e as N, H as U, B as V } from "./index-fbfe8881.mjs";
3
5
  import { useContext as X, useState as x, useEffect as B } from "react";
4
6
  import "react-dom";
7
+ import "react-transition-group";
8
+ import "react-router-dom";
5
9
  const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) : null, Z = () => X(M), S = "closed-notifications", ee = {
6
10
  transform: {
7
11
  a: ({ children: e, ...t }) => /* @__PURE__ */ n("a", { ...t, tabIndex: -1, children: e })
8
12
  }
9
- }, le = ({ className: e, ...t }) => {
13
+ }, pe = ({ className: e, ...t }) => {
10
14
  const {
11
- types: s = [],
15
+ types: r = [],
12
16
  allowPaging: f = !0,
13
17
  notifications: j = [],
14
18
  expandable: c = !1,
@@ -27,25 +31,25 @@ const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) :
27
31
  i && E(i, S, P.Session).then(
28
32
  (a = []) => {
29
33
  u.forEach(
30
- (l) => a.indexOf(l) === -1 && a.push(l)
34
+ (s) => a.indexOf(s) === -1 && a.push(s)
31
35
  ), w && w(a);
32
36
  }
33
37
  );
34
38
  }, [u, i, w]);
35
- const r = j.filter(({ id: a }) => u.indexOf(a) === -1), { length: p } = r;
36
- if (!r.length)
39
+ const l = j.filter(({ id: a }) => u.indexOf(a) === -1), { length: p } = l;
40
+ if (!l.length)
37
41
  return O(i, {
38
42
  ...t,
39
43
  className: b(e, "humany-notification-row")
40
44
  });
41
45
  if (f) {
42
- const a = r[o] || r[o + 1] || r[o - 1];
46
+ const a = l[o] || l[o + 1] || l[o - 1];
43
47
  if (!a)
44
48
  return O(i, {
45
49
  ...t,
46
50
  className: b(e, "humany-notification-row")
47
51
  });
48
- const { id: l, body: $ } = a || {}, z = () => D(!m);
52
+ const { id: s, body: $ } = a || {}, z = () => D(!m);
49
53
  return /* @__PURE__ */ v(
50
54
  A,
51
55
  {
@@ -55,7 +59,7 @@ const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) :
55
59
  tabIndex: c ? 0 : -1,
56
60
  className: b(e, "humany-notification-row"),
57
61
  "data-pageable": p > 1,
58
- "data-types": s,
62
+ "data-types": r,
59
63
  "data-allow-paging": f,
60
64
  "data-expandable": c,
61
65
  onKeyDown: (g) => {
@@ -68,7 +72,7 @@ const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) :
68
72
  {
69
73
  "aria-label": R,
70
74
  onClick: () => {
71
- y(r.indexOf(a)), C([...u, l]);
75
+ y(l.indexOf(a)), C([...u, s]);
72
76
  },
73
77
  children: /* @__PURE__ */ n(L, { symbol: { type: "Svg", content: "close" } })
74
78
  }
@@ -78,7 +82,7 @@ const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) :
78
82
  {
79
83
  htmlParseInstruction: !c || m ? void 0 : ee,
80
84
  "data-pageable": p > 1,
81
- "data-notification": l,
85
+ "data-notification": s,
82
86
  "data-expandable": c,
83
87
  "data-expanded": m,
84
88
  html: $
@@ -135,22 +139,22 @@ const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) :
135
139
  ...t,
136
140
  className: b(e, "humany-notification-row"),
137
141
  "data-pageable": !1,
138
- "data-types": s,
142
+ "data-types": r,
139
143
  "data-allow-paging": !1,
140
- children: r.map((a) => {
144
+ children: l.map((a) => {
141
145
  if (!a)
142
146
  return null;
143
- const { id: l, body: $ } = a;
147
+ const { id: s, body: $ } = a;
144
148
  return /* @__PURE__ */ n(
145
149
  H,
146
150
  {
147
151
  "data-pageable": !1,
148
152
  "data-expandable": c,
149
153
  "data-expanded": m,
150
- "data-notification": l,
154
+ "data-notification": s,
151
155
  html: $
152
156
  },
153
- l
157
+ s
154
158
  );
155
159
  })
156
160
  }
@@ -165,8 +169,8 @@ const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) :
165
169
  return ((t = e.theme.sizes) == null ? void 0 : t.cardinal) * 12;
166
170
  }}px;
167
171
  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;
172
+ var t, r, f;
173
+ 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 : (f = e.theme.colors) == null ? void 0 : f.warning;
170
174
  }};
171
175
  color: ${(e) => {
172
176
  var t;
@@ -285,8 +289,8 @@ const O = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ n(G, { ...t }) :
285
289
  width: 25px;
286
290
  height: auto;
287
291
  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}`;
292
+ var t, r;
293
+ return `calc(${(t = e.theme.sizes) == null ? void 0 : t.small}/2) ${(r = e.theme.sizes) == null ? void 0 : r.small}`;
290
294
  }};
291
295
  svg {
292
296
  vertical-align: middle;
@@ -307,5 +311,5 @@ d.div`
307
311
  display: none;
308
312
  `;
309
313
  export {
310
- le as default
314
+ pe as default
311
315
  };
@@ -0,0 +1,114 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),h=require("@emotion/react"),p=require("@emotion/styled"),a=require("./index-421eaa7e.js"),c=require("react");require("react-dom");require("react-transition-group");require("react-router-dom");const k=(e,t)=>e.get("seoConfiguration")?i.jsx(a.Empty,{...t}):null,H=()=>c.useContext(a.ComponentPropertyContext),$="closed-notifications",I={transform:{a:({children:e,...t})=>i.jsx("a",{...t,tabIndex:-1,children:e})}},L=({className:e,...t})=>{const{types:r=[],allowPaging:m=!0,notifications:q=[],expandable:f=!1,closeAriaLabel:N="",pageNextAriaLabel:O="",pagePreviousAriaLabel:B="",expandAriaLabel:A=""}=H(),[x,R]=c.useState(!1),[b,j]=c.useState([]),[o,y]=c.useState(0),s=a.useContainer(),[S,T]=c.useState();c.useEffect(()=>{s&&(a.readStorage(s,$,a.StorageMedium.Session).then((n=[])=>j(n)),a.createStorageWriter(s,$,a.StorageCategory.Functional).then(n=>T(()=>n)))},[s]),c.useEffect(()=>{s&&a.readStorage(s,$,a.StorageMedium.Session).then((n=[])=>{b.forEach(l=>n.indexOf(l)===-1&&n.push(l)),S&&S(n)})},[b,s,S]);const d=q.filter(({id:n})=>b.indexOf(n)===-1),{length:u}=d;if(!d.length)return k(s,{...t,className:a.appendClassNames(e,"humany-notification-row")});if(m){const n=d[o]||d[o+1]||d[o-1];if(!n)return k(s,{...t,className:a.appendClassNames(e,"humany-notification-row")});const{id:l,body:w}=n||{},C=()=>R(!x);return i.jsxs(z,{...t,"aria-expanded":f?x:!0,"aria-label":A,tabIndex:f?0:-1,className:a.appendClassNames(e,"humany-notification-row"),"data-pageable":u>1,"data-types":r,"data-allow-paging":m,"data-expandable":f,onKeyDown:g=>{g.key==="Enter"&&C()},onClick:C,children:[i.jsx(W,{"aria-label":N,onClick:()=>{y(d.indexOf(n)),j([...b,l])},children:i.jsx(a.SymbolBadge,{symbol:{type:"Svg",content:"close"}})}),i.jsx(E,{htmlParseInstruction:!f||x?void 0:I,"data-pageable":u>1,"data-notification":l,"data-expandable":f,"data-expanded":x,html:w}),u>1&&i.jsxs(M,{children:[i.jsx(v,{"aria-label":B,"data-disabled":o===0,onClick:g=>{g.stopPropagation(),o>0&&y(o-1)},children:i.jsx(P,{size:10,symbol:{type:"Svg",content:"caret-left"}})}),i.jsxs("span",{children:[o+1,"/",u]}),i.jsx(v,{"aria-label":O,"data-disabled":o+1>=u,onClick:g=>{g.stopPropagation(),o<u-1&&y(o+1)},children:i.jsx(P,{size:10,symbol:{type:"Svg",content:"caret-right"}})})]})]})}return i.jsx(z,{...t,className:a.appendClassNames(e,"humany-notification-row"),"data-pageable":!1,"data-types":r,"data-allow-paging":!1,children:d.map(n=>{if(!n)return null;const{id:l,body:w}=n;return i.jsx(E,{"data-pageable":!1,"data-expandable":f,"data-expanded":x,"data-notification":l,html:w},l)})})},z=p.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,r,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":(r=e.theme.colors)==null?void 0:r.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"]&&h.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=>h.css`
35
+ &:focus-visible {
36
+ .humany-html {
37
+ ${a.borderTabStyle(e)}
38
+ }
39
+ }
40
+ `}
41
+ `,E=p(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"]&&h.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
+ `,M=p.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
+ `,v=p(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"]?h.css`
86
+ opacity: 0.8;
87
+ `:h.css`
88
+ @media (hover) {
89
+ &:hover {
90
+ opacity: 0.5;
91
+ }
92
+ }
93
+ `}
94
+ `,W=p(v)`
95
+ position: absolute;
96
+ top: 7.5px;
97
+ right: 7.5px;
98
+ width: 25px;
99
+ height: auto;
100
+ padding: ${e=>{var t,r;return`calc(${(t=e.theme.sizes)==null?void 0:t.small}/2) ${(r=e.theme.sizes)==null?void 0:r.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
+ `,P=p(a.SymbolBadge)`
109
+ line {
110
+ stroke: #ffffff;
111
+ }
112
+ `;p.div`
113
+ display: none;
114
+ `;exports.default=L;
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.0",
3
+ "version": "1.1.1-rc.2",
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.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",
13
+ "@telia-ace/knowledge-widget-core": "^1.1.1-rc.2",
14
+ "@telia-ace/knowledge-widget-ui": "^1.1.1-rc.2",
15
+ "@telia-ace/widget-services": "^1.1.1-rc.2",
16
+ "@telia-ace/widget-utilities": "^1.1.1-rc.2",
17
+ "@telia-ace/knowledge-data-client": "^1.1.1-rc.2",
18
18
  "@webprovisions/platform": "^1.1.4"
19
19
  },
20
20
  "peerDependencies": {