@telia-ace/widget-ui 1.0.31-next.1 → 1.0.31-next.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/dist/index.js CHANGED
@@ -23,7 +23,7 @@ var re = (e, t, n) => (me(e, typeof t != "symbol" ? t + "" : t, n), n);
23
23
  import { Container as ct, WidgetState as lt } from "@webprovisions/platform";
24
24
  import r, { forwardRef as N, createContext as X, useContext as K, useState as $, useEffect as v, useRef as R, useCallback as H, useImperativeHandle as Ce, useMemo as se, Component as ut, lazy as mt } from "react";
25
25
  import { ComponentPlatform as dt, asDescriptor as ft, createEventSubscriber as ht, ComponentQuery as pt, WidgetRenderState as oe, extendComponent as gt } from "@telia-ace/widget-core";
26
- import { css as L, keyframes as We } from "@emotion/react";
26
+ import { css as L, keyframes as Ze } from "@emotion/react";
27
27
  import y from "@emotion/styled";
28
28
  import { kebabCase as Ct, appendClassNames as M, uuid as q, removeNullAndUndefinedValues as De, Logger as de } from "@telia-ace/widget-utilities";
29
29
  import { CSSTransition as Ie, Transition as yt } from "react-transition-group";
@@ -210,7 +210,7 @@ const Bt = (e) => (t) => /* @__PURE__ */ r.createElement(Hr, { attrs: t, htmlBod
210
210
  }), Nt = (e) => Tt(e, "a"), Vt = Nt, ae = N((s, o) => {
211
211
  var i = s, { className: e, children: t } = i, n = S(i, ["className", "children"]);
212
212
  return /* @__PURE__ */ r.createElement(
213
- Zt,
213
+ Wt,
214
214
  k(h({
215
215
  type: "button",
216
216
  className: M(e, "humany-button")
@@ -219,7 +219,7 @@ const Bt = (e) => (t) => /* @__PURE__ */ r.createElement(Hr, { attrs: t, htmlBod
219
219
  }),
220
220
  t
221
221
  );
222
- }), Zt = y.button`
222
+ }), Wt = y.button`
223
223
  -webkit-appearance: button;
224
224
  text-transform: none;
225
225
  overflow: visible;
@@ -232,7 +232,7 @@ const Bt = (e) => (t) => /* @__PURE__ */ r.createElement(Hr, { attrs: t, htmlBod
232
232
  line-height: normal;
233
233
  margin: 0;
234
234
  padding: 0;
235
- `, Wt = (s) => {
235
+ `, Zt = (s) => {
236
236
  var i = s, {
237
237
  onChange: e = () => {
238
238
  },
@@ -254,13 +254,13 @@ const Bt = (e) => (t) => /* @__PURE__ */ r.createElement(Hr, { attrs: t, htmlBod
254
254
  onChange: (a) => e(a.target.value, a.currentTarget.checked)
255
255
  }, V(o))
256
256
  );
257
- }, po = Wt, It = X(new ct()), Ot = X(1), Pe = X({
257
+ }, po = Zt, It = X(new ct()), Ot = X(1), Pe = X({
258
258
  id: "",
259
259
  type: "",
260
260
  name: "",
261
261
  branch: ""
262
- }), Pt = X({}), Ft = X(null), At = X(null), Kt = () => K(Pe), ye = Kt, Yt = () => K(It), Z = Yt, jt = (e, t) => {
263
- const n = ye().id, o = Z();
262
+ }), Pt = X({}), Ft = X(null), At = X(null), Kt = () => K(Pe), ye = Kt, Yt = () => K(It), W = Yt, jt = (e, t) => {
263
+ const n = ye().id, o = W();
264
264
  return (s, i) => {
265
265
  (t || o).getAsync("actionResolver").then((a) => {
266
266
  a.action(e || n, s, i);
@@ -280,7 +280,7 @@ const Bt = (e) => (t) => /* @__PURE__ */ r.createElement(Hr, { attrs: t, htmlBod
280
280
  e.current = !1;
281
281
  }), []), e;
282
282
  }, O = Ut, _t = (e) => {
283
- const t = Z(), [n, o] = $(null), s = O();
283
+ const t = W(), [n, o] = $(null), s = O();
284
284
  return v(() => {
285
285
  dt.getInstance(e || t).then((i) => {
286
286
  s.current && o(i);
@@ -313,7 +313,7 @@ const Bt = (e) => (t) => /* @__PURE__ */ r.createElement(Hr, { attrs: t, htmlBod
313
313
  }
314
314
  }, [e, t, i]), n;
315
315
  }, Co = qt, Qt = () => K(Ot), yo = Qt, Gt = (e, t) => {
316
- const n = ye(), o = Z(), [s, i] = $(void 0), a = O(), l = e || n.type || "";
316
+ const n = ye(), o = W(), [s, i] = $(void 0), a = O(), l = e || n.type || "";
317
317
  return v(() => {
318
318
  if (l) {
319
319
  let u;
@@ -378,7 +378,7 @@ const Bt = (e) => (t) => /* @__PURE__ */ r.createElement(Hr, { attrs: t, htmlBod
378
378
  };
379
379
  }, [e, n]);
380
380
  }, rn = (e) => {
381
- const t = Z(), { events: n } = (e || t).get("$widget");
381
+ const t = W(), { events: n } = (e || t).get("$widget");
382
382
  return n;
383
383
  }, on = rn, sn = () => {
384
384
  const [e, t] = $(!1);
@@ -429,7 +429,7 @@ const Bt = (e) => (t) => /* @__PURE__ */ r.createElement(Hr, { attrs: t, htmlBod
429
429
  t.current = e;
430
430
  }), t.current;
431
431
  }, Fe = ln, un = () => K(Pt), $o = un, mn = (e) => {
432
- const [t, n] = $(), o = Z(), s = O();
432
+ const [t, n] = $(), o = W(), s = O();
433
433
  return v(() => {
434
434
  let i;
435
435
  const a = (e || o).get("$widget");
@@ -456,7 +456,7 @@ const Bt = (e) => (t) => /* @__PURE__ */ r.createElement(Hr, { attrs: t, htmlBod
456
456
  };
457
457
  }, [s]), t;
458
458
  }, ko = mn, dn = () => K(Ft), Ae = dn, fn = (e) => {
459
- const t = Z(), n = Ae(), [o, s] = $({ name: "", params: {} }), i = O();
459
+ const t = W(), n = Ae(), [o, s] = $({ name: "", params: {} }), i = O();
460
460
  return v(() => {
461
461
  const a = (e || t).get("$widget");
462
462
  if (!a)
@@ -530,7 +530,7 @@ const Bt = (e) => (t) => /* @__PURE__ */ r.createElement(Hr, { attrs: t, htmlBod
530
530
  }
531
531
  }
532
532
  `, pn = () => {
533
- const [e, t] = $(null), n = Z(), o = O();
533
+ const [e, t] = $(null), n = W(), o = O();
534
534
  return v(() => {
535
535
  n.get("settings").then((s) => {
536
536
  o.current && t(s);
@@ -542,7 +542,7 @@ const Bt = (e) => (t) => /* @__PURE__ */ r.createElement(Hr, { attrs: t, htmlBod
542
542
  }, []);
543
543
  return [t, o];
544
544
  }, Ye = gn, So = (e) => {
545
- const t = Z(), n = U(), o = t.get("widgetDOMElement"), [s, i] = $(null), [a, l] = $(null), u = O();
545
+ const t = W(), n = U(), o = t.get("widgetDOMElement"), [s, i] = $(null), [a, l] = $(null), u = O();
546
546
  v(() => {
547
547
  if (n && u.current) {
548
548
  const m = n.nodes.all.find((d) => d.name === "root-area"), p = n.nodes.all.find((d) => d.type === "view");
@@ -1378,7 +1378,7 @@ const Hn = 300, Tn = ({
1378
1378
  }), v(() => {
1379
1379
  f && c.current ? c.current.focus() : !f && m.current && x && m.current.focus();
1380
1380
  }, [f, c.current, m.current]);
1381
- const B = Zn[l.type];
1381
+ const B = Wn[l.type];
1382
1382
  return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
1383
1383
  Ie,
1384
1384
  {
@@ -1537,12 +1537,12 @@ const Hn = 300, Tn = ({
1537
1537
  &.humany-drawer-transition-exit-done {
1538
1538
  height: 0;
1539
1539
  }
1540
- `, Zn = {
1540
+ `, Wn = {
1541
1541
  ["slide-in-bottom"]: Bn,
1542
1542
  ["slide-in-right"]: zn,
1543
1543
  ["slide-in-left"]: Nn,
1544
1544
  ["slide-in-top"]: Vn
1545
- }, Wn = (e, t, n) => {
1545
+ }, Zn = (e, t, n) => {
1546
1546
  const [o, s] = $(0), [i, a] = $(0), l = H(
1547
1547
  (u, c) => {
1548
1548
  if (u.preventDefault(), c) {
@@ -1561,7 +1561,7 @@ const Hn = 300, Tn = ({
1561
1561
  };
1562
1562
  u.left < 0 && (c.x = 0), u.bottom > window.innerHeight && (c.y = 0), c.x !== o && s(c.x), c.y !== i && a(c.y);
1563
1563
  }, [n, e, t]), [{ x: o, y: i }, l];
1564
- }, Xe = Wn, In = r.forwardRef(
1564
+ }, Xe = Zn, In = r.forwardRef(
1565
1565
  (a, i) => {
1566
1566
  var l = a, { className: e = "", children: t = null, trigger: n, closeButtonAriaLabel: o } = l, s = S(l, ["className", "children", "trigger", "closeButtonAriaLabel"]);
1567
1567
  const u = R(), c = R(), m = R();
@@ -1665,7 +1665,7 @@ const Hn = 300, Tn = ({
1665
1665
  `, Ue = N(
1666
1666
  (i, s) => {
1667
1667
  var a = i, { htmlParseInstruction: e = null, className: t, html: n } = a, o = S(a, ["htmlParseInstruction", "className", "html"]);
1668
- const l = Z(), [u, c] = $();
1668
+ const l = W(), [u, c] = $();
1669
1669
  return v(() => {
1670
1670
  const m = zt(l, n), p = k(h(h({}, m), e), {
1671
1671
  transform: h(h({}, m.transform), e == null ? void 0 : e.transform)
@@ -1862,11 +1862,11 @@ const Hn = 300, Tn = ({
1862
1862
  }
1863
1863
  );
1864
1864
  return /* @__PURE__ */ r.createElement("div", { className: M(e, "humany-item-tree") }, o && o(!u(t || [])), t && m(t, 1));
1865
- }, Zo = qn, Qn = N(
1865
+ }, Wo = qn, Qn = N(
1866
1866
  (u, l) => {
1867
1867
  var c = u, { className: e, onClick: t = () => {
1868
1868
  }, name: n = "", to: o = "", params: s = {}, children: i } = c, a = S(c, ["className", "onClick", "name", "to", "params", "children"]);
1869
- const m = Ae(), p = Z();
1869
+ const m = Ae(), p = W();
1870
1870
  if (!m)
1871
1871
  return null;
1872
1872
  let d = "";
@@ -2067,11 +2067,11 @@ const Hn = 300, Tn = ({
2067
2067
  &.humany-overlay-transition-exit-done {
2068
2068
  opacity: 0;
2069
2069
  }
2070
- `, _e = tr, rr = We`
2070
+ `, _e = tr, rr = Ze`
2071
2071
  100% {
2072
2072
  transform: rotate(360deg);
2073
2073
  }
2074
- `, or = We`
2074
+ `, or = Ze`
2075
2075
  0% {
2076
2076
  stroke-dasharray: 1, 200;
2077
2077
  stroke-dashoffset: 0;
@@ -2157,19 +2157,19 @@ const Hn = 300, Tn = ({
2157
2157
  const a = R(null), [l, u] = $(!1), [c, m] = $(!1), b = o.style || {}, { width: p, height: d } = b, f = S(b, ["width", "height"]), C = H(() => {
2158
2158
  const g = a.current;
2159
2159
  if (g) {
2160
- const B = window.innerWidth / g.width, z = window.innerHeight / g.height, T = Math.min(B, z);
2160
+ const B = window.innerWidth / g.naturalWidth, z = window.innerHeight / g.naturalHeight, T = Math.min(B, z);
2161
2161
  return z >= 1 && B >= 1 ? 1 : T;
2162
2162
  }
2163
2163
  return 1;
2164
2164
  }, [l, t.src]), x = se(() => {
2165
2165
  const g = a.current;
2166
- if (g) {
2166
+ if (g && l) {
2167
2167
  if (!c) {
2168
2168
  m(!0);
2169
2169
  const B = C();
2170
2170
  n(B);
2171
2171
  }
2172
- return g.width >= g.height ? [`${e * g.naturalWidth}px`, "auto"] : ["auto", `${e * g.naturalHeight}px`];
2172
+ return g.naturalWidth >= g.naturalHeight ? [`${e * g.naturalWidth}px`, "auto"] : ["auto", `${e * g.naturalHeight}px`];
2173
2173
  }
2174
2174
  return null;
2175
2175
  }, [e, a, l, t.src]);
@@ -2228,11 +2228,11 @@ const Hn = 300, Tn = ({
2228
2228
  var P, te;
2229
2229
  if (f === null || g.current === null)
2230
2230
  return;
2231
- const w = g.current.firstElementChild, D = (P = B.current) == null ? void 0 : P.querySelector(".nav-left"), W = (te = B.current) == null ? void 0 : te.querySelector(".nav-right");
2231
+ const w = g.current.firstElementChild, D = (P = B.current) == null ? void 0 : P.querySelector(".nav-left"), Z = (te = B.current) == null ? void 0 : te.querySelector(".nav-right");
2232
2232
  if (x === "Right")
2233
- ee && W ? W.focus() : J && D && D.focus();
2233
+ ee && Z ? Z.focus() : J && D && D.focus();
2234
2234
  else if (x === "Left")
2235
- J && D ? D.focus() : ee && W && W.focus();
2235
+ J && D ? D.focus() : ee && Z && Z.focus();
2236
2236
  else {
2237
2237
  if (!w)
2238
2238
  return;
@@ -2262,7 +2262,7 @@ const Hn = 300, Tn = ({
2262
2262
  }, [t]), Y = H(() => {
2263
2263
  const { src: w } = e;
2264
2264
  if (w) {
2265
- const D = T.findIndex((W, P) => W.src === w);
2265
+ const D = T.findIndex((Z, P) => Z.src === w);
2266
2266
  C(D);
2267
2267
  }
2268
2268
  }, [T, e]), Ge = H((w) => {
@@ -2287,8 +2287,8 @@ const Hn = 300, Tn = ({
2287
2287
  (w) => {
2288
2288
  const D = z.current;
2289
2289
  if (D && c) {
2290
- const W = w.clientX - l.x, P = w.clientY - l.y;
2291
- D.scrollTop = l.top - P, D.scrollLeft = l.left - W;
2290
+ const Z = w.clientX - l.x, P = w.clientY - l.y;
2291
+ D.scrollTop = l.top - P, D.scrollLeft = l.left - Z;
2292
2292
  }
2293
2293
  },
2294
2294
  [c, l]
@@ -2694,8 +2694,8 @@ const Hn = 300, Tn = ({
2694
2694
  var p;
2695
2695
  i(), (p = u == null ? void 0 : u.current) == null || p.close();
2696
2696
  }, [i]);
2697
- return /* @__PURE__ */ r.createElement(Nr, { className: e, trigger: t, ref: u, onOverlayClick: c }, n && /* @__PURE__ */ r.createElement(Ve, null, n), o && /* @__PURE__ */ r.createElement(Ve, null, o), l && /* @__PURE__ */ r.createElement(Vr, { onClick: m }, l), a && /* @__PURE__ */ r.createElement(Zr, { onClick: c }, a));
2698
- }, Wo = zr, Nr = y(Dr)`
2697
+ return /* @__PURE__ */ r.createElement(Nr, { className: e, trigger: t, ref: u, onOverlayClick: c }, n && /* @__PURE__ */ r.createElement(Ve, null, n), o && /* @__PURE__ */ r.createElement(Ve, null, o), l && /* @__PURE__ */ r.createElement(Vr, { onClick: m }, l), a && /* @__PURE__ */ r.createElement(Wr, { onClick: c }, a));
2698
+ }, Zo = zr, Nr = y(Dr)`
2699
2699
  display: block;
2700
2700
 
2701
2701
  span {
@@ -2743,7 +2743,7 @@ const Hn = 300, Tn = ({
2743
2743
  &:focus-visible {
2744
2744
  ${F}
2745
2745
  }
2746
- `, Zr = y(ae)`
2746
+ `, Wr = y(ae)`
2747
2747
  display: inline-block;
2748
2748
  min-width: 50px;
2749
2749
  ${(e) => {
@@ -2764,12 +2764,12 @@ const Hn = 300, Tn = ({
2764
2764
  &:focus-visible {
2765
2765
  ${F};
2766
2766
  }
2767
- `, Wr = ({
2767
+ `, Zr = ({
2768
2768
  header: e = "",
2769
2769
  link: t = "",
2770
2770
  suggestionHeader: n = "",
2771
2771
  suggestion: o = ""
2772
- }) => /* @__PURE__ */ r.createElement(Ir, null, /* @__PURE__ */ r.createElement(Or, null, /* @__PURE__ */ r.createElement(_, { variant: "h2" }, "404")), /* @__PURE__ */ r.createElement(Pr, null, /* @__PURE__ */ r.createElement(_, { variant: "h3" }, e), /* @__PURE__ */ r.createElement(Kr, { routeName: "index", "aria-label": t, text: t })), /* @__PURE__ */ r.createElement(Fr, null, /* @__PURE__ */ r.createElement("span", null, n), /* @__PURE__ */ r.createElement("ul", null, /* @__PURE__ */ r.createElement("li", null, o)))), Io = Wr, Ir = y.div`
2772
+ }) => /* @__PURE__ */ r.createElement(Ir, null, /* @__PURE__ */ r.createElement(Or, null, /* @__PURE__ */ r.createElement(_, { variant: "h2" }, "404")), /* @__PURE__ */ r.createElement(Pr, null, /* @__PURE__ */ r.createElement(_, { variant: "h3" }, e), /* @__PURE__ */ r.createElement(Kr, { routeName: "index", "aria-label": t, text: t })), /* @__PURE__ */ r.createElement(Fr, null, /* @__PURE__ */ r.createElement("span", null, n), /* @__PURE__ */ r.createElement("ul", null, /* @__PURE__ */ r.createElement("li", null, o)))), Io = Zr, Ir = y.div`
2773
2773
  display: flex;
2774
2774
  flex-wrap: wrap;
2775
2775
  `, Or = y.div`
@@ -2869,9 +2869,9 @@ const Oo = Ar, Kr = N(
2869
2869
  }
2870
2870
  );
2871
2871
  var Yr = /* @__PURE__ */ ((e) => (e.HH_MM = "hh:mm", e.YYYY_MM_DD = "yyyy-mm-dd", e.YYYY_MM_DD_HH_MM = "yyyy-mm-dd hh:mm", e))(Yr || {});
2872
- const jr = ({ className: e = "", format: t = "hh:mm", timestamp: n }) => /* @__PURE__ */ r.createElement("span", { className: M(e, "humany-timestamp") }, Xr(n, t)), Po = jr, Ze = (e) => `0${e}`.slice(-2);
2872
+ const jr = ({ className: e = "", format: t = "hh:mm", timestamp: n }) => /* @__PURE__ */ r.createElement("span", { className: M(e, "humany-timestamp") }, Xr(n, t)), Po = jr, We = (e) => `0${e}`.slice(-2);
2873
2873
  function Xr(e, t) {
2874
- const n = new Date(e), o = n.toTimeString().split(" ")[0].split(":"), s = o.length > 1 ? `${o[0]}:${o[1]}` : o[0], i = n.getFullYear(), a = n.getMonth() + 1, l = n.getDate(), u = `${i}-${Ze(a)}-${Ze(l)}`;
2874
+ const n = new Date(e), o = n.toTimeString().split(" ")[0].split(":"), s = o.length > 1 ? `${o[0]}:${o[1]}` : o[0], i = n.getFullYear(), a = n.getMonth() + 1, l = n.getDate(), u = `${i}-${We(a)}-${We(l)}`;
2875
2875
  return t === "yyyy-mm-dd" ? u : t === "hh:mm" ? s : `${u} ${s}`;
2876
2876
  }
2877
2877
  const Ur = (i) => {
@@ -3012,7 +3012,7 @@ const Ur = (i) => {
3012
3012
  (l, a) => {
3013
3013
  var u = l, { className: e, children: t, onClick: n = () => {
3014
3014
  }, widgetName: o, activationOptions: s } = u, i = S(u, ["className", "children", "onClick", "widgetName", "activationOptions"]);
3015
- const c = Z(), m = () => {
3015
+ const c = W(), m = () => {
3016
3016
  const { implementation: f } = c.get("$widget");
3017
3017
  return f.widgets.get(o);
3018
3018
  };
@@ -3060,7 +3060,7 @@ const Ur = (i) => {
3060
3060
  }
3061
3061
  ), Ko = N(
3062
3062
  ({ portalId: e = "humany-widget-overlay-portal", className: t, children: n }, o) => {
3063
- const s = Z(), i = se(() => {
3063
+ const s = W(), i = se(() => {
3064
3064
  if (!s)
3065
3065
  return null;
3066
3066
  const a = s.get("widgetDOMElement");
@@ -3097,7 +3097,7 @@ export {
3097
3097
  Ot as ColumnContext,
3098
3098
  Pe as ComponentNodeContext,
3099
3099
  Pt as ComponentPropertyContext,
3100
- Wo as Confirm,
3100
+ Zo as Confirm,
3101
3101
  It as ContainerContext,
3102
3102
  At as ConversationContext,
3103
3103
  Yr as DateFormats,
@@ -3110,7 +3110,7 @@ export {
3110
3110
  jn as Icon,
3111
3111
  Vo as Input,
3112
3112
  _n as ItemList,
3113
- Zo as ItemTree,
3113
+ Wo as ItemTree,
3114
3114
  Hr as Lightbox,
3115
3115
  we as Link,
3116
3116
  Xn as List,
@@ -3161,7 +3161,7 @@ export {
3161
3161
  ye as useComponentDescriptor,
3162
3162
  be as useComponentNode,
3163
3163
  U as useComponentPlatform,
3164
- Z as useContainer,
3164
+ W as useContainer,
3165
3165
  en as useContext,
3166
3166
  vo as useConversation,
3167
3167
  Eo as useDispatch,