UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

142 lines (140 loc) 4.18 kB
/** * 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 { i as w, l as A, R as u, h as R, g as p, j as e, F as t, C as z, D as B, H as T } from "../sheerid.js"; import { F as U } from "./FormFieldInputSelect-o7QZaYhS.js"; import { i as E } from "./FormFieldText-CaWtYVur.js"; import { D as F } from "./CaptchaComponent-SmUa6m52.js"; const N = ({ autoFocus: r, onChange: s, value: i, isErrored: n, organizations: o = void 0, verificationService: d, intl: c, placeholder: g = "", disabled: I = !1 }) => { o && A.warn("Param `organizations` is deprecated and will not be used"); const v = "branch-of-service", [S, D] = u.useState([]), [y, x] = u.useState(!1), [O, M] = u.useState(!1), { viewModel: b, programTheme: j } = d, { status: h } = b, { orgSearchUrl: H } = j.config, f = R(() => b?.countryChoice?.value), P = E(j, f); u.useEffect(() => { const a = new AbortController(); return (async () => { if (P) { D([]), x(!0); return; } x(!1), M(!0); const l = new URL(H); f ? l.searchParams.set("country", f) : l.searchParams.delete("country"), h ? l.searchParams.set("tags", h) : l.searchParams.delete("tags"); const C = await z(l.toString()); a.signal.aborted || (C && D(C.map(B)), M(!1)); })(), () => { a.abort(); }; }, [f, h]); const L = (a, m) => { m(a ? { id: a.value, name: a.label } : { id: 0, name: "" }); }; return p("organization")?.hidden ? null : /* @__PURE__ */ e.jsx( U, { fieldId: v, refId: "organization", autoFocus: r, options: S, onChange: (a) => L(a, s), value: S.find((a) => a.value === (i && i.value)), placeholder: g || c.formatHTMLMessage({ id: "branchOfServicePlaceholder", defaultMessage: "Branch Of Service" }), isRequired: !0, isLoading: O, disabled: y || I, explanation: y ? /* @__PURE__ */ e.jsx(t, { id: "chooseCountry", defaultMessage: "Choose a country first" }) : null, label: /* @__PURE__ */ e.jsx(t, { id: "branchOfService", defaultMessage: "Branch Of Service" }), errorMessage: n && /* @__PURE__ */ e.jsx( t, { id: "errorId.invalidOrganization", defaultMessage: "You must select an organization from the list" } ), showPlaceholderAndHideLabel: !!g, containerId: `sid-${v}-id` } ); }, _ = w(N), G = ({ onChange: r, errorId: s, isErrored: i = !!s, value: n = "2000-01-01", disabled: o = !1, locale: d, mode: c = "month" }) => p("dischargeDate")?.hidden ? null : /* @__PURE__ */ e.jsx( F, { mode: c, value: n, label: /* @__PURE__ */ e.jsx(t, { id: "dischargeDate", defaultMessage: "Discharge date" }), explanation: /* @__PURE__ */ e.jsx( t, { id: "verificationPurposesOnly", defaultMessage: "Used for verification purposes only" } ), onChange: r, fieldName: "dischargeDate", fieldId: "discharge-date", isErrored: i, disabled: o, isRequired: !0, locale: d, errorMsg: /* @__PURE__ */ e.jsx(t, { id: `errorId.${s}`, defaultMessage: "Invalid discharge date" }) } ), J = ({ onChange: r, errorId: s, isErrored: i = !!s, value: n = "2000-01-01", locale: o = T, disabled: d = !1 }) => p("activeDutyStartDate")?.hidden ? null : /* @__PURE__ */ e.jsx( F, { value: n, label: /* @__PURE__ */ e.jsx(t, { id: "activeDutyStartDate", defaultMessage: "Active Duty Start Date" }), explanation: /* @__PURE__ */ e.jsx( t, { id: "verificationPurposesOnly", defaultMessage: "Used for verification purposes only" } ), onChange: r, fieldName: "activeDutyStartDate", fieldId: "sid-active-duty-start-date", locale: o, isErrored: i, disabled: d, errorMsg: /* @__PURE__ */ e.jsx(t, { id: `errorId.${s}`, defaultMessage: "Invalid start date" }) } ); export { J as A, _ as B, G as D };