UNPKG

@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.

71 lines (70 loc) 3.02 kB
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] = "2eb6c39a-f80e-4125-845c-5146f637da0c", e._sentryDebugIdIdentifier = "sentry-dbid-2eb6c39a-f80e-4125-845c-5146f637da0c"); } catch (e) {} import { a as Icon } from "./translation-BFxyJ1c5.js"; import { t as Avatar } from "./Avatar-CKmUpMXT.js"; import cx from "classnames"; import { Fragment, jsx, jsxs } from "preact/jsx-runtime"; var ListItem_module_default = { "list-item": "adyen-kyc-list-item", listItem: "adyen-kyc-list-item", "list-item-interactive": "adyen-kyc-list-item-interactive", listItemInteractive: "adyen-kyc-list-item-interactive", "list-item-text": "adyen-kyc-list-item-text", listItemText: "adyen-kyc-list-item-text", "list-item-title": "adyen-kyc-list-item-title", listItemTitle: "adyen-kyc-list-item-title", "list-item-description": "adyen-kyc-list-item-description", listItemDescription: "adyen-kyc-list-item-description", "list-item-disclosure": "adyen-kyc-list-item-disclosure", listItemDisclosure: "adyen-kyc-list-item-disclosure", "list-item-accessory": "adyen-kyc-list-item-accessory", listItemAccessory: "adyen-kyc-list-item-accessory" }; //#endregion //#region src/components/ui/atoms/ListItem/ListItem.tsx var ListItem = ({ accessory, action, avatar, description, title }) => { const isInteractive = !!action && typeof action.onClick === "function"; const isDisabled = !!action?.disabled; const listItemAvatar = { ...avatar, ...isDisabled && { variant: "disabled" } }; const rootClassname = cx(ListItem_module_default.listItem, { [ListItem_module_default.listItemInteractive]: isInteractive }); const content = /* @__PURE__ */ jsxs(Fragment, { children: [ avatar && /* @__PURE__ */ jsx(Avatar, { ...listItemAvatar }), /* @__PURE__ */ jsxs("div", { className: ListItem_module_default.listItemText, children: [/* @__PURE__ */ jsx("h3", { className: ListItem_module_default.listItemTitle, children: title }), description && /* @__PURE__ */ jsx("span", { className: ListItem_module_default.listItemDescription, children: description })] }), accessory && /* @__PURE__ */ jsx("div", { className: ListItem_module_default.listItemAccessory, children: accessory }) ] }); if (isInteractive) return /* @__PURE__ */ jsxs("button", { "aria-label": title, className: rootClassname, disabled: isDisabled, onClick: action.onClick, type: "button", children: [content, action?.disclosure && !isDisabled && /* @__PURE__ */ jsx("div", { className: ListItem_module_default.listItemDisclosure, "data-testid": "disclosure-indicator", children: /* @__PURE__ */ jsx(Icon, { name: "chevron-right" }) })] }); else return /* @__PURE__ */ jsx("div", { className: rootClassname, children: content }); }; //#endregion export { ListItem as t };