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