@adyen/kyc-components
Version:
This guide assumes that you have already an account with Adyen. A legalEntity needs to be created, and you need to have a `legalEntityId` to instatiate a Component.
55 lines (54 loc) • 2.43 kB
JavaScript
try {
let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "537b788e-213f-4ee8-bacd-6b92ff8eafbe", e._sentryDebugIdIdentifier = "sentry-dbid-537b788e-213f-4ee8-bacd-6b92ff8eafbe");
} catch (e) {}
import { a as Icon } from "./translation-BFxyJ1c5.js";
import cx from "classnames";
import { jsx } from "preact/jsx-runtime";
var Avatar_module_default = {
avatar: "adyen-kyc-avatar",
"avatar-label": "adyen-kyc-avatar-label",
avatarLabel: "adyen-kyc-avatar-label",
"avatar-primary": "adyen-kyc-avatar-primary",
avatarPrimary: "adyen-kyc-avatar-primary",
"avatar-secondary": "adyen-kyc-avatar-secondary",
avatarSecondary: "adyen-kyc-avatar-secondary",
"avatar-tertiary": "adyen-kyc-avatar-tertiary",
avatarTertiary: "adyen-kyc-avatar-tertiary",
"avatar-image": "adyen-kyc-avatar-image",
avatarImage: "adyen-kyc-avatar-image",
"avatar-disabled": "adyen-kyc-avatar-disabled",
avatarDisabled: "adyen-kyc-avatar-disabled",
"avatar-shape-square": "adyen-kyc-avatar-shape-square",
avatarShapeSquare: "adyen-kyc-avatar-shape-square",
"avatar-shape-circle": "adyen-kyc-avatar-shape-circle",
avatarShapeCircle: "adyen-kyc-avatar-shape-circle"
};
//#endregion
//#region src/components/ui/atoms/Avatar/Avatar.tsx
var Avatar = ({ circle = false, iconName, imageUrl, label, variant = "secondary" }) => {
const isImage = imageUrl !== void 0;
const isIcon = iconName !== void 0;
const variantStyles = {
disabled: Avatar_module_default.avatarDisabled,
primary: Avatar_module_default.avatarPrimary,
secondary: Avatar_module_default.avatarSecondary,
tertiary: Avatar_module_default.avatarTertiary
};
return /* @__PURE__ */ jsx("div", {
"aria-label": label,
className: cx(Avatar_module_default.avatar, variantStyles[variant], {
[Avatar_module_default.avatarShapeCircle]: circle,
[Avatar_module_default.avatarShapeSquare]: !circle,
[Avatar_module_default.avatarImage]: isImage
}),
style: { backgroundImage: isImage ? `url(${imageUrl})` : "unset" },
role: "img",
children: isIcon ? /* @__PURE__ */ jsx(Icon, { name: iconName }) : /* @__PURE__ */ jsx("span", {
className: Avatar_module_default.avatarLabel,
children: label
})
});
};
//#endregion
export { Avatar as t };