@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/css/mistica.css +1 -1
- package/dist/avatar.d.ts +1 -0
- package/dist/avatar.js +20 -18
- package/dist/card.js +112 -100
- package/dist/highlighted-card.js +2 -0
- package/dist/package-version.js +1 -1
- package/dist-es/avatar.js +28 -26
- package/dist-es/card.js +143 -131
- package/dist-es/highlighted-card.js +9 -7
- package/dist-es/package-version.js +1 -1
- package/dist-es/style.css +1 -1
- package/package.json +1 -1
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
|
|
84
|
-
import { avatar as
|
|
85
|
-
import { vars as
|
|
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
|
|
88
|
-
const
|
|
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
|
-
},
|
|
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__ */
|
|
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
|
-
},
|
|
103
|
-
var { size: r , src: o , Icon: t = P , badge: e , initials:
|
|
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
|
|
113
|
-
const i =
|
|
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
|
-
|
|
115
|
+
d(!1);
|
|
116
116
|
}, [
|
|
117
117
|
o
|
|
118
118
|
]);
|
|
119
|
-
const x = c.trim().slice(0, 2),
|
|
120
|
-
return /* @__PURE__ */
|
|
121
|
-
value:
|
|
122
|
-
top:
|
|
123
|
-
right:
|
|
124
|
-
children: /* @__PURE__ */
|
|
125
|
-
className:
|
|
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 :
|
|
127
|
+
"aria-label": a != null ? a : l,
|
|
128
128
|
style: {
|
|
129
129
|
width: r,
|
|
130
130
|
height: r,
|
|
131
|
-
color:
|
|
132
|
-
background:
|
|
131
|
+
color: p,
|
|
132
|
+
background: b,
|
|
133
|
+
boxSizing: "border-box",
|
|
134
|
+
border: x
|
|
133
135
|
}
|
|
134
136
|
}, R(h, "Avatar")), {
|
|
135
|
-
children:
|
|
137
|
+
children: w ? /* @__PURE__ */ s("img", {
|
|
136
138
|
src: o,
|
|
137
139
|
className: y,
|
|
138
|
-
onError: ()=>
|
|
140
|
+
onError: ()=>d(!0),
|
|
139
141
|
role: "none",
|
|
140
142
|
width: r,
|
|
141
143
|
height: r
|
|
142
|
-
}) :
|
|
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 {
|
|
151
|
+
export { U as default };
|