@telia-ace/widget-components-widget-header 1.1.1-rc.1 → 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-8825e52f.mjs +4091 -0
- package/index-f80d12f5.js +591 -0
- package/index.js +1 -1
- package/index.mjs +6 -2
- package/package.json +5 -5
- package/widget-header-b177d340.js +88 -0
- package/{widget-header-6ff6cb4a.mjs → widget-header-d82a1b88.mjs} +44 -40
- package/index-8e05a7b4.js +0 -624
- package/index-addbd6d9.mjs +0 -7971
- package/widget-header-0370023d.js +0 -88
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),i=require("./index-8e05a7b4.js"),f=require("react");require("react-dom");const j=e=>e==="entering"||e==="entered",S=e=>e==="exiting"||e==="exited",g={fade:{in:"opacity: 1;",out:"opacity: 0;"},"slide-left":{in:"transform: translateX(0);",out:"transform: translateX(-100%);"},"slide-right":{in:"transform: translateX(0);",out:"transform: translateX(100%);"},"slide-up":{in:"transform: translateY(0);",out:"transform: translateY(100%);"},"slide-down":{in:"transform: translateY(0);",out:"transform: translateY(-100%);"},scale:{in:"transform: scale(1);",out:"transform: scale(0);"}},v=["slide-up","slide-down","slide-left","slide-right","scale"],y={compose:(e="exited",t)=>{const{enter:s,exit:u}=t,n=s.transitionKeys.split(" "),d=v.indexOf(n[0])>-1?"transform":"opacity";if(j(e))return n&&n.length>0?i.css`
|
|
2
|
-
${n&&n.length>0&&n.map(a=>g[a]?g[a].in:"")}
|
|
3
|
-
transition: ${d} ${s.duration}ms ${s.easing};
|
|
4
|
-
`:"";const r=n&&n.length>0&&i.css`
|
|
5
|
-
${n.map(a=>g[a]?g[a].out:"")}
|
|
6
|
-
`;if(S(e)){const a=u.transitionKeys.split(" ");return a&&a.length>0&&e==="exiting"?i.css`
|
|
7
|
-
${r};
|
|
8
|
-
${a.map(l=>g[l]?g[l].out:"")}
|
|
9
|
-
transition: ${d} ${u.duration}ms ${u.easing};
|
|
10
|
-
`:r}},composeViewTransition:(e,t,s)=>{if(t==="slide")return y.compose(e,{enter:{transitionKeys:s==="forth"?"slide-right":"slide-left",duration:500},exit:{transitionKeys:s==="forth"?"slide-left":"slide-right",duration:500}});if(t==="fade")return y.compose(e,{enter:{transitionKeys:"fade",duration:500},exit:{transitionKeys:"fade",duration:500}})},get:e=>g[e]},z=()=>f.useContext(i.ComponentNodeContext),w=()=>{const e=i.useComponentPlatform(),t=z(),[s,u]=f.useState([]),[n,d]=f.useState();return f.useEffect(()=>{if(e&&t){const r=new i.ComponentQuery(e).withId(t.id),a=e.actions(r,t.type||i.uuid());d(a),s!==null&&(s.forEach(l=>{a.dispatch(l.key,l.data).then(c=>l.resolve(c)).catch(c=>l.reject(c))}),u(null))}},[e,t.id]),(r,a)=>s!==null?new Promise((l,c)=>{s.push({key:r,data:a,resolve:l,reject:c})}):n.dispatch(r,a)},C=()=>f.useContext(i.ComponentPropertyContext),N=e=>{const{in:t,mountOnEnter:s=!0,unmountOnExit:u=!0,timeout:n,children:d,transitions:r}=e,l=(()=>{var c,m;if(!(!r||r==="none")){if(typeof r=="string")return{enter:{transitionKeys:r,duration:n?typeof n=="number"?n:n.enter:200,easing:"ease-in"},exit:{transitionKeys:r,duration:n?typeof n=="number"?n:n.exit:200,easing:"ease-out"}};if(typeof r=="object"){const{enter:p,exit:h}=r;return{enter:{transitionKeys:(c=r.enter)==null?void 0:c.type,duration:n?typeof n=="number"?n:n.enter:200,easing:p.easing?p.easing:"ease-in"},exit:{transitionKeys:(m=r.enter)==null?void 0:m.type,duration:n?typeof n=="number"?n:n.enter:200,easing:h.easing?h.easing:"ease-out"}}}}})();return o.jsx(i.Transition,{timeout:{enter:l&&l.enter.duration||0,exit:l&&l.exit.duration||0},in:t,appear:!0,mountOnEnter:s,unmountOnExit:u,onEnter:c=>c.clientHeight,children:c=>d&&d(c,l&&y.compose(c,l))})},T=({node:e})=>{if(!e.symbol)return null;let t;const s=e.symbol.type==="Svg";if(e.symbol.type==="Svg"){const u=parseInt(e.size,10);isNaN(u)||(t=u)}return o.jsx(k,{symbol:e.symbol,svg:s,size:t,backgroundSize:"cover"})},k=i.newStyled(({svg:e,...t})=>o.jsx(i.SymbolBadge,{...t}))`
|
|
11
|
-
color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
|
|
12
|
-
${e=>!e.svg&&i.css`
|
|
13
|
-
border-radius: 50%;
|
|
14
|
-
overflow: hidden;
|
|
15
|
-
`}
|
|
16
|
-
`,K=({node:e})=>{const t=e.symbol||{type:"Svg",content:"back"};return o.jsx(i.SymbolBadge,{size:20,symbol:t})},E=({node:e})=>{const t=e.symbol||{type:"Svg",content:"close"},s=parseInt(e==null?void 0:e.size,10)||14;return o.jsx(i.SymbolBadge,{size:s,symbol:t})},q=({node:e})=>{const t=e.symbol||{type:"Svg",content:"minimize"},s=parseInt(e==null?void 0:e.size,10)||20;return o.jsx(i.SymbolBadge,{size:s,symbol:t})},b=({className:e="",...t})=>{const s=w(),{size:u,padding:n,type:d,tooltip:r,show:a=!0}=t;return d==="back"?o.jsx($,{size:u||"64px",padding:n||"10px",children:o.jsx(N,{in:a,timeout:300,transitions:{enter:{type:"scale",easing:"cubic-bezier(.08,.84,.74,1.84)"},exit:{type:"scale",easing:"ease-out"}},children:(l,c)=>o.jsx(x,{title:r,"aria-label":r,animationCss:c,onClick:()=>{s("back")},children:o.jsx(K,{node:t})})})}):a?o.jsxs($,{size:u||"64px",padding:n||"10px",squareRatio:d==="avatar",children:[d==="avatar"&&o.jsx(T,{node:t}),d==="close"&&o.jsx(x,{title:r,"aria-label":r,onClick:()=>{s("close")},children:o.jsx(E,{node:t})}),d==="minimize"&&o.jsx(x,{title:r,"aria-label":r,onClick:()=>{s("minimize")},children:o.jsx(q,{node:t})})]}):null},$=i.newStyled.div`
|
|
17
|
-
flex: 1;
|
|
18
|
-
max-width: ${e=>e.size};
|
|
19
|
-
${e=>e.squareRatio&&`max-height: ${e.size};`}
|
|
20
|
-
text-align: center;
|
|
21
|
-
padding: 0 ${e=>e.padding};
|
|
22
|
-
&& {
|
|
23
|
-
box-sizing: content-box;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
svg {
|
|
27
|
-
vertical-align: middle;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
i {
|
|
31
|
-
color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
|
|
32
|
-
font-size: ${e=>e.size};
|
|
33
|
-
min-width: 1em;
|
|
34
|
-
min-height: 1em;
|
|
35
|
-
display: inline-block;
|
|
36
|
-
}
|
|
37
|
-
`,x=i.newStyled.button`
|
|
38
|
-
${e=>!!e.animationCss&&e.animationCss};
|
|
39
|
-
background: none;
|
|
40
|
-
border: none;
|
|
41
|
-
cursor: pointer;
|
|
42
|
-
padding: 0;
|
|
43
|
-
&:focus-visible {
|
|
44
|
-
${i.borderTabStyle};
|
|
45
|
-
border-color: ${e=>{var t,s;return(s=(t=e.theme.accessibility)==null?void 0:t.colors)==null?void 0:s.inactiveText}};
|
|
46
|
-
}
|
|
47
|
-
`,B=({className:e,...t})=>{const{header:s,tagline:u,route:n,tooltip:d="",actions:r={},textAlign:a="center"}=C(),[l,c]=i.createNodes(r);return l.sort((m,p)=>(m.order||0)-(p.order||0)),c.sort((m,p)=>(m.order||0)-(p.order||0)),o.jsxs(P,{...t,className:i.appendClassNames(e,"humany-widget-header"),children:[l.map((m,p)=>o.jsx(b,{...m},`${m.type}+_${p}`)),o.jsxs(D,{textAlign:a,margin:i.calculateMargin(l,c,a),children:[n?o.jsx(I,{routeName:n,title:d,"aria-label":d,children:o.jsx(i.Typography,{variant:"h1",children:s})}):o.jsx(i.Typography,{variant:"h1",children:s}),u&&o.jsx(A,{children:u})]}),c.map((m,p)=>o.jsx(b,{...m},`${m.type}+_${p}`))]})},P=i.newStyled.div`
|
|
48
|
-
display: flex;
|
|
49
|
-
flex-direction: row;
|
|
50
|
-
align-items: center;
|
|
51
|
-
|
|
52
|
-
${e=>{var t,s;return i.headingElement(e)("h1",i.css`
|
|
53
|
-
font-size: ${(t=e.theme.fonts)==null?void 0:t.huge};
|
|
54
|
-
margin: 0;
|
|
55
|
-
font-weight: 300;
|
|
56
|
-
color: ${(s=e.theme.colors)==null?void 0:s.text};
|
|
57
|
-
`)}}
|
|
58
|
-
|
|
59
|
-
p {
|
|
60
|
-
color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
|
|
61
|
-
margin: 0;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
svg {
|
|
65
|
-
line,
|
|
66
|
-
path,
|
|
67
|
-
circle {
|
|
68
|
-
stroke: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
`,A=i.newStyled.p`
|
|
72
|
-
font-size: ${e=>{var t;return(t=e.theme.fonts)==null?void 0:t.normal}};
|
|
73
|
-
font-weight: 300;
|
|
74
|
-
`,D=i.newStyled.div`
|
|
75
|
-
flex: 1;
|
|
76
|
-
text-align: ${e=>e.textAlign};
|
|
77
|
-
|
|
78
|
-
margin-right: ${e=>e.margin.right||0};
|
|
79
|
-
margin-left: ${e=>e.margin.left||0};
|
|
80
|
-
`,I=i.newStyled(i.Link)`
|
|
81
|
-
text-decoration: none;
|
|
82
|
-
&:focus-visible {
|
|
83
|
-
${e=>i.headingElement(e)("h1",i.css`
|
|
84
|
-
${i.linkTabStyle(e)}
|
|
85
|
-
display: inline-block;
|
|
86
|
-
`)}
|
|
87
|
-
}
|
|
88
|
-
`;exports.default=B;
|