@yamada-ui/password-input
Version:
Yamada UI password input component
91 lines (89 loc) • 2.66 kB
JavaScript
"use client"
import {
usePasswordInputContext
} from "./chunk-JKICLSDF.mjs";
// src/password-input-icon.tsx
import { forwardRef, ui } from "@yamada-ui/core";
import { Icon } from "@yamada-ui/icon";
import { cx, getValidChildren } from "@yamada-ui/utils";
import { cloneElement } from "react";
import { jsx, jsxs } from "react/jsx-runtime";
var PasswordInputIcon = forwardRef(
({ className, children, ...rest }, ref) => {
const { styles } = usePasswordInputContext();
const validChildren = getValidChildren(children);
const cloneChildren = validChildren.map(
(child) => cloneElement(child, {
style: {
color: "currentColor",
maxHeight: "1em",
maxWidth: "1em"
},
"aria-hidden": true,
focusable: false
})
);
const css = { ...styles.icon };
return /* @__PURE__ */ jsx(
ui.button,
{
ref,
type: "button",
className: cx("ui-password-input__icon", className),
__css: css,
...rest,
children: cloneChildren
}
);
}
);
PasswordInputIcon.displayName = "PasswordInputIcon";
PasswordInputIcon.__ui__ = "PasswordInputIcon";
var EyeIcon = ({ ...rest }) => {
return /* @__PURE__ */ jsxs(
Icon,
{
fill: "none",
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "2",
viewBox: "0 0 24 24",
...rest,
children: [
/* @__PURE__ */ jsx("path", { d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" }),
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" })
]
}
);
};
EyeIcon.displayName = "EyeIcon";
EyeIcon.__ui__ = "EyeIcon";
var EyeOffIcon = ({ ...rest }) => {
return /* @__PURE__ */ jsxs(
Icon,
{
fill: "none",
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "2",
viewBox: "0 0 24 24",
...rest,
children: [
/* @__PURE__ */ jsx("path", { d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49" }),
/* @__PURE__ */ jsx("path", { d: "M14.084 14.158a3 3 0 0 1-4.242-4.242" }),
/* @__PURE__ */ jsx("path", { d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143" }),
/* @__PURE__ */ jsx("path", { d: "m2 2 20 20" })
]
}
);
};
EyeOffIcon.displayName = "EyeOffIcon";
EyeOffIcon.__ui__ = "EyeOffIcon";
export {
PasswordInputIcon,
EyeIcon,
EyeOffIcon
};
//# sourceMappingURL=chunk-3MNF7ESX.mjs.map