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

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.
@@ -1,114 +0,0 @@
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;