UNPKG

@payfit/unity-components

Version:

55 lines (54 loc) • 2.05 kB
import { SelectOptionProvider as e } from "./SelectOption.context.js"; import { forwardRef as t } from "react"; import { uyTv as n } from "@payfit/unity-themes"; import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime"; import { Icon as o } from "@payfit/unity-icons"; import { ListBoxItem as s } from "react-aria-components/ListBox"; //#region src/core/components/select/parts/SelectOption.tsx var c = n({ base: "uy:flex uy:flex-col uy:typography-body uy:rounded-50 uy:pt-100 uy:pb-100 uy:pl-150 uy:pr-150 uy:outline-none uy:cursor-pointer", variants: { isFocusVisible: { true: "uy:outline-offset-2 uy:outline-2 uy:outline-solid uy:outline-utility-focus-ring" }, isHovered: { true: "uy:bg-surface-neutral-hover uy:text-content-neutral" }, isPressed: { true: "uy:bg-surface-neutral-pressed uy:text-content-neutral-pressed" }, isSelected: { true: "uy:bg-surface-neutral-active uy:text-content-neutral-active" }, isDisabled: { true: "uy:text-content-neutral-disabled" } }, compoundVariants: [{ isFocusVisible: !1, isHovered: !1, isPressed: !1, isSelected: !1, isDisabled: !1, class: "uy:bg-surface-neutral-enabled uy:text-content-neutral-enabled" }] }), l = t((t, n) => { let { children: l, isDisabled: u, textValue: d } = t; return /* @__PURE__ */ i(s, { ...t, ref: n, translate: "no", "data-dd-privacy": "mask", textValue: d, className: ({ isHovered: e, isPressed: t, isFocusVisible: n, isSelected: r }) => c({ isHovered: e, isPressed: t, isFocusVisible: n, isSelected: r, isDisabled: u }), children: ({ isSelected: t }) => /* @__PURE__ */ i(e, { isDisabled: u, children: t ? /* @__PURE__ */ a("div", { className: "uy:flex uy:justify-between", children: [/* @__PURE__ */ i("div", { className: "uy:flex uy:flex-col", children: /* @__PURE__ */ i(r, { children: l }) }), /* @__PURE__ */ i(o, { src: "CheckOutlined" })] }) : /* @__PURE__ */ i(r, { children: l }) }) }); }); l.displayName = "SelectOption"; //#endregion export { l as SelectOption };