@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
50 lines (48 loc) • 1.48 kB
JavaScript
/**
* VERSION: 2.230.0-alpha.0
* BUILD_TIMESTAMP: 1778694684677
* BUILD_DATE: Wed May 13 2026 17:51:24 GMT+0000 (Coordinated Universal Time)
* BUILD_COMMIT: 7af1c105d5485ac4ed1190c56d492bb4590667a9
*/
import { S as o, i as u, g as S, j as i, k as m, F as l } from "../sheerid.js";
import { F as g } from "./FormFieldText-CaWtYVur.js";
const t = (s, e, r) => `${s.slice(0, r)}${e}${s.slice(r)}`, f = (s) => {
let e;
try {
if (e = s.toString(), !e) throw new Error();
} catch {
return "";
}
return e = e.replace(/[^\d]/g, ""), e = t(e, "-", 3), e = t(e, "-", 6), e = e.replace("--", "").replace(/-$/, ""), e;
}, N = (s) => s.replace(/-/g, "").slice(0, o), p = ({
value: s,
isErrored: e,
onChange: r,
intl: d,
placeholder: a = "",
disabled: n = !1
}) => S("socialSecurityNumber")?.hidden ? null : /* @__PURE__ */ i.jsx(
g,
{
fieldId: "ssn",
className: "sid-ssn__input",
refId: m.socialSecurityNumber,
value: f(s),
onChange: (c) => r(N(c)),
placeholder: a || d.formatHTMLMessage({ id: "ssnPlaceholder", defaultMessage: "000-00-0000" }),
label: /* @__PURE__ */ i.jsx(l, { id: "ssn", defaultMessage: "Social Security Number" }),
errorMessage: e && /* @__PURE__ */ i.jsx(
l,
{
id: "errorId.invalidSocialSecurityNumber",
defaultMessage: "Invalid SSN"
}
),
showPlaceholderAndHideLabel: !!a,
required: !0,
disabled: n
}
), M = u(p);
export {
M as S
};