@telefonica/mistica 14.5.0 → 14.6.0

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-es/avatar.js CHANGED
@@ -80,27 +80,27 @@ function _objectWithoutPropertiesLoose(source, excluded) {
80
80
  import * as g from "react";
81
81
  import E from "./badge.js";
82
82
  import P from "./generated/mistica-icons/icon-user-account-regular.js";
83
- import { useIsInverseVariant as k } from "./theme-variant-context.js";
84
- import { avatar as w, image as y } from "./avatar.css-mistica.js";
85
- import { vars as s } from "./skins/skin-contract.css-mistica.js";
83
+ import { useIsInverseVariant as S } from "./theme-variant-context.js";
84
+ import { avatar as k, image as y } from "./avatar.css-mistica.js";
85
+ import { vars as n } from "./skins/skin-contract.css-mistica.js";
86
86
  import { getPrefixedDataAttributes as R } from "./utils/dom.js";
87
- import { jsx as n } from "./_virtual/jsx-runtime.js";
88
- const S = (r, o)=>{
87
+ import { jsx as s } from "./_virtual/jsx-runtime.js";
88
+ const B = (r, o)=>{
89
89
  if (!o) return 0;
90
90
  const t = r / 2, e = o === !0 ? 5 : 10;
91
91
  return t * (1 - Math.sin(Math.PI / 4)) - e;
92
- }, B = (r, o)=>{
92
+ }, D = (r, o)=>{
93
93
  if (!o) return null;
94
94
  let t;
95
- return r <= 40 ? t = 14 : r <= 64 ? t = 16 : t = 18, /* @__PURE__ */ n("span", {
95
+ return r <= 40 ? t = 14 : r <= 64 ? t = 16 : t = 18, /* @__PURE__ */ s("span", {
96
96
  style: {
97
97
  fontSize: t,
98
98
  textTransform: "uppercase"
99
99
  },
100
100
  children: o
101
101
  });
102
- }, O = (_param)=>{
103
- var { size: r , src: o , Icon: t = P , badge: e , initials: c = "" , "aria-label": a , dataAttributes: h } = _param, l = _objectWithoutProperties(_param, [
102
+ }, U = (_param)=>{
103
+ var { size: r , src: o , Icon: t = P , badge: e , initials: l = "" , "aria-label": a , dataAttributes: h } = _param, c = _objectWithoutProperties(_param, [
104
104
  "size",
105
105
  "src",
106
106
  "Icon",
@@ -109,41 +109,43 @@ const S = (r, o)=>{
109
109
  "aria-label",
110
110
  "dataAttributes"
111
111
  ]);
112
- var d, f;
113
- const i = k(), p = (d = l.backgroundColor) != null ? d : i ? s.colors.brandHigh : s.colors.brandLow, v = (f = l.textColor) != null ? f : i ? s.colors.textPrimaryInverse : s.colors.brand, [I, m] = g.useState(!1);
112
+ var u, f;
113
+ const i = S(), b = (u = c.backgroundColor) != null ? u : i ? n.colors.brandHigh : n.colors.brandLow, p = (f = c.textColor) != null ? f : i ? n.colors.textPrimaryInverse : n.colors.brand, [v, d] = g.useState(!1);
114
114
  g.useEffect(()=>{
115
- m(!1);
115
+ d(!1);
116
116
  }, [
117
117
  o
118
118
  ]);
119
- const x = c.trim().slice(0, 2), u = S(r, e), b = e === !0 ? void 0 : e || 0, C = !!o && !I, A = r <= 40 ? 16 : 24;
120
- return /* @__PURE__ */ n(E, {
121
- value: b,
122
- top: u,
123
- right: u,
124
- children: /* @__PURE__ */ n("div", _objectSpreadProps(_objectSpread({
125
- className: w,
119
+ const x = c.border ? `1px solid ${n.colors.borderLow}` : "none", I = l.trim().slice(0, 2), m = B(r, e), C = e === !0 ? void 0 : e || 0, w = !!o && !v, A = r <= 40 ? 16 : 24;
120
+ return /* @__PURE__ */ s(E, {
121
+ value: C,
122
+ top: m,
123
+ right: m,
124
+ children: /* @__PURE__ */ s("div", _objectSpreadProps(_objectSpread({
125
+ className: k,
126
126
  role: "img",
127
- "aria-label": a != null ? a : c,
127
+ "aria-label": a != null ? a : l,
128
128
  style: {
129
129
  width: r,
130
130
  height: r,
131
- color: v,
132
- background: p
131
+ color: p,
132
+ background: b,
133
+ boxSizing: "border-box",
134
+ border: x
133
135
  }
134
136
  }, R(h, "Avatar")), {
135
- children: C ? /* @__PURE__ */ n("img", {
137
+ children: w ? /* @__PURE__ */ s("img", {
136
138
  src: o,
137
139
  className: y,
138
- onError: ()=>m(!0),
140
+ onError: ()=>d(!0),
139
141
  role: "none",
140
142
  width: r,
141
143
  height: r
142
- }) : B(r, x) || /* @__PURE__ */ n(t, {
144
+ }) : D(r, I) || /* @__PURE__ */ s(t, {
143
145
  size: A,
144
146
  color: "currentColor"
145
147
  })
146
148
  }))
147
149
  });
148
150
  };
149
- export { O as default };
151
+ export { U as default };