@telia-ace/widget-components-widget-header 1.3.0-rc.9 → 1.3.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-99ca7e5e.mjs → index-140d4815.mjs} +1 -1
- package/{index-fa6483a9.js → index-952a9cc1.js} +1 -1
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +5 -5
- package/{widget-header-e0f309cb.js → widget-header-15d41ef5.js} +9 -8
- package/{widget-header-26fb51da.mjs → widget-header-6fc51386.mjs} +16 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const b=require("@telia-ace/widget-core"),p=require("@telia-ace/widget-ui"),f=require("@telia-ace/widget-utilities"),h=(r,i,o)=>{if(o!=="center")return{};const t=s=>s.reduce((e,a)=>{const[u]=a.padding.split("px"),[g]=a.size.split("px");return e+(+g+ +u*2)},0),n=t(r),c=t(i),l=n-c;return l===0?{}:{[n>c?"right":"left"]:`${Math.abs(l)}px`}},w=r=>Object.keys(r).reduce((i,o)=>{const t=r[o];if(!t)return i;const[n,c]=i,l=t.position==="left"?n:c;return r[o].symbol,l.push({symbol:t.symbol&&typeof t.symbol=="string"?{type:"Uri",content:t.symbol}:t.symbol,type:o,padding:t.padding||"10px",label:t.label,size:t.size||"64px",tooltip:t.tooltip,order:t.order||0,show:t.show}),i},[[],[]]),m=r=>r.getAsync("router").then(i=>{if(!i)return!0;const o=i.getInitialRoute(),{name:t,params:n}=i.getRouteData();return f.removeNullAndUndefinedValues(n),!((o==null?void 0:o.name)!==t||Object.keys(n).length>0)}),k=r=>p.createReactComponent(r,"widget-header",Promise.resolve().then(()=>require("./widget-header-
|
|
1
|
+
"use strict";const b=require("@telia-ace/widget-core"),p=require("@telia-ace/widget-ui"),f=require("@telia-ace/widget-utilities"),h=(r,i,o)=>{if(o!=="center")return{};const t=s=>s.reduce((e,a)=>{const[u]=a.padding.split("px"),[g]=a.size.split("px");return e+(+g+ +u*2)},0),n=t(r),c=t(i),l=n-c;return l===0?{}:{[n>c?"right":"left"]:`${Math.abs(l)}px`}},w=r=>Object.keys(r).reduce((i,o)=>{const t=r[o];if(!t)return i;const[n,c]=i,l=t.position==="left"?n:c;return r[o].symbol,l.push({symbol:t.symbol&&typeof t.symbol=="string"?{type:"Uri",content:t.symbol}:t.symbol,type:o,padding:t.padding||"10px",label:t.label,size:t.size||"64px",tooltip:t.tooltip,order:t.order||0,show:t.show}),i},[[],[]]),m=r=>r.getAsync("router").then(i=>{if(!i)return!0;const o=i.getInitialRoute(),{name:t,params:n}=i.getRouteData();return f.removeNullAndUndefinedValues(n),!((o==null?void 0:o.name)!==t||Object.keys(n).length>0)}),k=r=>p.createReactComponent(r,"widget-header",Promise.resolve().then(()=>require("./widget-header-15d41ef5.js")),i=>{const{events:o}=r.get("$widget"),[t,n]=b.createEventSubscriber(o),{actions:c={},tooltipBackLabel:l="",tooltipMinimizeLabel:d=""}=i.properties();if(i.actions.create("close",(s,e)=>e.preventDefault?void 0:r.get("$widget").invoke("close")),i.actions.create("back",(s,e)=>{if(!e.preventDefault)return r.getAsync("router").then(a=>{a.goBack()})}),i.properties(s=>{const{actions:e={}}=s;if(e!=null&&e.back&&(e.back.tooltip=e.back.tooltip?e.back.tooltip:l),e!=null&&e.minimize&&(e.minimize.tooltip=e.minimize.tooltip?e.minimize.tooltip:d),!!e.back)return Object.keys(e).forEach(a=>{const u=e[a];a==="back"&&(u.show=s.showBack)}),{actions:e}}),i.actions.create("show-back",s=>{i.writeProperties({showBack:s})}),c.back){const s=()=>m(r).then(e=>i.actions.dispatch("show-back",!e));s(),t("router:changed",s)}return i.actions.create("minimize",(s,e)=>e.preventDefault?void 0:r.get("$widget").invoke("hide")),()=>{n()}});exports.WidgetHeaderComponent=k;exports.calculateMargin=h;exports.createNodes=w;
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./index-
|
|
1
|
+
"use strict";const e=require("./index-952a9cc1.js");require("@telia-ace/widget-core");require("@telia-ace/widget-ui");require("@telia-ace/widget-utilities");module.exports=e.WidgetHeaderComponent;
|
package/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/widget-components-widget-header",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@telia-ace/widget-core": "^1.3.
|
|
14
|
-
"@telia-ace/widget-routing": "^1.3.
|
|
15
|
-
"@telia-ace/widget-ui": "^1.3.
|
|
16
|
-
"@telia-ace/widget-utilities": "^1.3.
|
|
13
|
+
"@telia-ace/widget-core": "^1.3.1",
|
|
14
|
+
"@telia-ace/widget-routing": "^1.3.1",
|
|
15
|
+
"@telia-ace/widget-ui": "^1.3.1",
|
|
16
|
+
"@telia-ace/widget-utilities": "^1.3.1",
|
|
17
17
|
"@webprovisions/platform": "^1.1.4"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),p=require("@emotion/react"),m=require("@emotion/styled"),r=require("@telia-ace/widget-ui"),$=require("@telia-ace/widget-utilities"),b=require("./index-952a9cc1.js");require("@telia-ace/widget-core");const f=({node:e})=>{if(!e.symbol)return null;let t;const s=e.symbol.type==="Svg";if(e.symbol.type==="Svg"){const o=parseInt(e.size,10);isNaN(o)||(t=o)}return i.jsx(j,{symbol:e.symbol,svg:s,size:t,backgroundSize:"cover"})},j=m(({svg:e,...t})=>i.jsx(r.SymbolBadge,{...t}))`
|
|
2
2
|
color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
|
|
3
|
-
${e=>!e.svg&&
|
|
3
|
+
${e=>!e.svg&&p.css`
|
|
4
4
|
border-radius: 50%;
|
|
5
5
|
overflow: hidden;
|
|
6
6
|
`}
|
|
7
|
-
`,z=({node:e})=>{const t=e.symbol||{type:"Svg",content:"back"};return i.jsx(r.SymbolBadge,{size:20,symbol:t})},k=({node:e})=>{const t=e.symbol||{type:"Svg",content:"close"},s=parseInt(e==null?void 0:e.size,10)||14;return i.jsx(r.SymbolBadge,{size:s,symbol:t})},S=({node:e})=>{const t=e.symbol||{type:"Svg",content:"minimize"},s=parseInt(e==null?void 0:e.size,10)||20;return i.jsx(r.SymbolBadge,{size:s,symbol:t})},y=({className:e="",...t})=>{const s=r.useDispatch(),{size:o,padding:g,type:a,tooltip:l,show:d=!0}=t;return a==="back"?i.jsx(
|
|
7
|
+
`,z=({node:e})=>{const t=e.symbol||{type:"Svg",content:"back"};return i.jsx(r.SymbolBadge,{size:20,symbol:t})},k=({node:e})=>{const t=e.symbol||{type:"Svg",content:"close"},s=parseInt(e==null?void 0:e.size,10)||14;return i.jsx(r.SymbolBadge,{size:s,symbol:t})},S=({node:e})=>{const t=e.symbol||{type:"Svg",content:"minimize"},s=parseInt(e==null?void 0:e.size,10)||20;return i.jsx(r.SymbolBadge,{size:s,symbol:t})},y=({className:e="",...t})=>{const s=r.useDispatch(),{size:o,padding:g,type:a,tooltip:l,show:d=!0}=t;return a==="back"?i.jsx(v,{size:o||"64px",padding:g||"10px",children:i.jsx(r.TransitionComponent,{in:d,timeout:300,transitions:{enter:{type:"scale",easing:"cubic-bezier(.08,.84,.74,1.84)"},exit:{type:"scale",easing:"ease-out"}},children:(x,h)=>i.jsx(u,{"data-testid":"back-button",title:l,"aria-label":l,animationCss:h,onClick:()=>{s("back")},children:i.jsx(z,{node:t})})})}):d?i.jsxs(v,{size:o||"64px",padding:g||"10px",squareRatio:a==="avatar",children:[a==="avatar"&&i.jsx(f,{node:t}),a==="close"&&i.jsx(u,{title:l,"aria-label":l,onClick:()=>{s("close")},children:i.jsx(k,{node:t})}),a==="minimize"&&i.jsx(u,{title:l,"aria-label":l,onClick:()=>{s("minimize")},children:i.jsx(S,{node:t})})]}):null},v=m.div`
|
|
8
8
|
flex: 1;
|
|
9
9
|
max-width: ${e=>e.size};
|
|
10
10
|
${e=>e.squareRatio&&`max-height: ${e.size};`}
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
min-height: 1em;
|
|
26
26
|
display: inline-block;
|
|
27
27
|
}
|
|
28
|
-
`,
|
|
28
|
+
`,u=m.button`
|
|
29
29
|
${e=>!!e.animationCss&&e.animationCss};
|
|
30
30
|
background: none;
|
|
31
31
|
border: none;
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
${r.borderTabStyle};
|
|
36
36
|
border-color: ${e=>{var t,s;return(s=(t=e.theme.accessibility)==null?void 0:t.colors)==null?void 0:s.inactiveText}};
|
|
37
37
|
}
|
|
38
|
-
`,N=({className:e,...t})=>{const{header:s,tagline:o,route:g,tooltip:a="",actions:l={},textAlign:d="center"}=r.useProperties(),[h
|
|
38
|
+
`,N=({className:e,...t})=>{const{header:s,tagline:o,route:g,tooltip:a="",actions:l={},textAlign:d="center"}=r.useProperties(),[x,h]=b.createNodes(l);return x.sort((n,c)=>(n.order||0)-(c.order||0)),h.sort((n,c)=>(n.order||0)-(c.order||0)),i.jsxs(w,{...t,className:$.appendClassNames(e,"humany-widget-header"),children:[x.map((n,c)=>i.jsx(y,{...n},`${n.type}+_${c}`)),i.jsxs(C,{textAlign:d,margin:b.calculateMargin(x,h,d),children:[g?i.jsx(T,{routeName:g,title:a,"aria-label":a,children:i.jsx(r.Typography,{variant:"h1",children:s})}):i.jsx(r.Typography,{variant:"h1",children:s}),o&&i.jsx(q,{children:o})]}),h.map((n,c)=>i.jsx(y,{...n},`${n.type}+_${c}`))]})},w=m.div`
|
|
39
39
|
display: flex;
|
|
40
40
|
flex-direction: row;
|
|
41
41
|
align-items: center;
|
|
42
42
|
|
|
43
|
-
${e=>{var t,s;return r.headingElement(e)("h1",
|
|
43
|
+
${e=>{var t,s;return r.headingElement(e)("h1",p.css`
|
|
44
44
|
font-size: ${(t=e.theme.fonts)==null?void 0:t.huge};
|
|
45
45
|
margin: 0;
|
|
46
46
|
font-weight: 300;
|
|
@@ -65,13 +65,14 @@
|
|
|
65
65
|
`,C=m.div`
|
|
66
66
|
flex: 1;
|
|
67
67
|
text-align: ${e=>e.textAlign};
|
|
68
|
-
|
|
68
|
+
overflow: auto;
|
|
69
|
+
max-height: 100%;
|
|
69
70
|
margin-right: ${e=>e.margin.right||0};
|
|
70
71
|
margin-left: ${e=>e.margin.left||0};
|
|
71
72
|
`,T=m(r.Link)`
|
|
72
73
|
text-decoration: none;
|
|
73
74
|
&:focus-visible {
|
|
74
|
-
${e=>r.headingElement(e)("h1",
|
|
75
|
+
${e=>r.headingElement(e)("h1",p.css`
|
|
75
76
|
${r.linkTabStyle(e)}
|
|
76
77
|
display: inline-block;
|
|
77
78
|
`)}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as i, jsxs as u } from "react/jsx-runtime";
|
|
2
2
|
import { css as y } from "@emotion/react";
|
|
3
3
|
import c from "@emotion/styled";
|
|
4
|
-
import { SymbolBadge as h, borderTabStyle as z, useDispatch as k, TransitionComponent as N, useProperties as S, Typography as f, headingElement as v, Link as
|
|
4
|
+
import { SymbolBadge as h, borderTabStyle as z, useDispatch as k, TransitionComponent as N, useProperties as S, Typography as f, headingElement as v, Link as w, linkTabStyle as C } from "@telia-ace/widget-ui";
|
|
5
5
|
import { appendClassNames as T } from "@telia-ace/widget-utilities";
|
|
6
|
-
import { c as A, a as W } from "./index-
|
|
6
|
+
import { c as A, a as W } from "./index-140d4815.mjs";
|
|
7
7
|
import "@telia-ace/widget-core";
|
|
8
8
|
const B = ({ node: e }) => {
|
|
9
9
|
if (!e.symbol)
|
|
@@ -11,8 +11,8 @@ const B = ({ node: e }) => {
|
|
|
11
11
|
let t;
|
|
12
12
|
const r = e.symbol.type === "Svg";
|
|
13
13
|
if (e.symbol.type === "Svg") {
|
|
14
|
-
const
|
|
15
|
-
isNaN(
|
|
14
|
+
const s = parseInt(e.size, 10);
|
|
15
|
+
isNaN(s) || (t = s);
|
|
16
16
|
}
|
|
17
17
|
return /* @__PURE__ */ i(
|
|
18
18
|
I,
|
|
@@ -42,8 +42,8 @@ const B = ({ node: e }) => {
|
|
|
42
42
|
const t = e.symbol || { type: "Svg", content: "minimize" }, r = parseInt(e == null ? void 0 : e.size, 10) || 20;
|
|
43
43
|
return /* @__PURE__ */ i(h, { size: r, symbol: t });
|
|
44
44
|
}, x = ({ className: e = "", ...t }) => {
|
|
45
|
-
const r = k(), { size:
|
|
46
|
-
return n === "back" ? /* @__PURE__ */ i($, { size:
|
|
45
|
+
const r = k(), { size: s, padding: m, type: n, tooltip: a, show: g = !0 } = t;
|
|
46
|
+
return n === "back" ? /* @__PURE__ */ i($, { size: s || "64px", padding: m || "10px", children: /* @__PURE__ */ i(
|
|
47
47
|
N,
|
|
48
48
|
{
|
|
49
49
|
in: g,
|
|
@@ -75,7 +75,7 @@ const B = ({ node: e }) => {
|
|
|
75
75
|
) }) : g ? /* @__PURE__ */ u(
|
|
76
76
|
$,
|
|
77
77
|
{
|
|
78
|
-
size:
|
|
78
|
+
size: s || "64px",
|
|
79
79
|
padding: m || "10px",
|
|
80
80
|
squareRatio: n === "avatar",
|
|
81
81
|
children: [
|
|
@@ -145,19 +145,19 @@ const B = ({ node: e }) => {
|
|
|
145
145
|
`, O = ({ className: e, ...t }) => {
|
|
146
146
|
const {
|
|
147
147
|
header: r,
|
|
148
|
-
tagline:
|
|
148
|
+
tagline: s,
|
|
149
149
|
route: m,
|
|
150
150
|
tooltip: n = "",
|
|
151
151
|
actions: a = {},
|
|
152
152
|
textAlign: g = "center"
|
|
153
153
|
} = S(), [d, p] = A(a);
|
|
154
|
-
return d.sort((
|
|
154
|
+
return d.sort((o, l) => (o.order || 0) - (l.order || 0)), p.sort((o, l) => (o.order || 0) - (l.order || 0)), /* @__PURE__ */ u(
|
|
155
155
|
L,
|
|
156
156
|
{
|
|
157
157
|
...t,
|
|
158
158
|
className: T(e, "humany-widget-header"),
|
|
159
159
|
children: [
|
|
160
|
-
d.map((
|
|
160
|
+
d.map((o, l) => /* @__PURE__ */ i(x, { ...o }, `${o.type}+_${l}`)),
|
|
161
161
|
/* @__PURE__ */ u(
|
|
162
162
|
_,
|
|
163
163
|
{
|
|
@@ -165,11 +165,11 @@ const B = ({ node: e }) => {
|
|
|
165
165
|
margin: W(d, p, g),
|
|
166
166
|
children: [
|
|
167
167
|
m ? /* @__PURE__ */ i(D, { routeName: m, title: n, "aria-label": n, children: /* @__PURE__ */ i(f, { variant: "h1", children: r }) }) : /* @__PURE__ */ i(f, { variant: "h1", children: r }),
|
|
168
|
-
|
|
168
|
+
s && /* @__PURE__ */ i(R, { children: s })
|
|
169
169
|
]
|
|
170
170
|
}
|
|
171
171
|
),
|
|
172
|
-
p.map((
|
|
172
|
+
p.map((o, l) => /* @__PURE__ */ i(x, { ...o }, `${o.type}+_${l}`))
|
|
173
173
|
]
|
|
174
174
|
}
|
|
175
175
|
);
|
|
@@ -218,16 +218,17 @@ const B = ({ node: e }) => {
|
|
|
218
218
|
`, _ = c.div`
|
|
219
219
|
flex: 1;
|
|
220
220
|
text-align: ${(e) => e.textAlign};
|
|
221
|
-
|
|
221
|
+
overflow: auto;
|
|
222
|
+
max-height: 100%;
|
|
222
223
|
margin-right: ${(e) => e.margin.right || 0};
|
|
223
224
|
margin-left: ${(e) => e.margin.left || 0};
|
|
224
|
-
`, D = c(
|
|
225
|
+
`, D = c(w)`
|
|
225
226
|
text-decoration: none;
|
|
226
227
|
&:focus-visible {
|
|
227
228
|
${(e) => v(e)(
|
|
228
229
|
"h1",
|
|
229
230
|
y`
|
|
230
|
-
${
|
|
231
|
+
${C(e)}
|
|
231
232
|
display: inline-block;
|
|
232
233
|
`
|
|
233
234
|
)}
|