UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

145 lines (143 loc) 3.92 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 T, B as O, l as I, R as h, C as x, c as M, p as z, D as w, g as b, j as a, F as r, G as j } from "../sheerid.js"; import { F as L } from "./FormFieldInputSelect-o7QZaYhS.js"; import { F as v } from "./FormFieldTypeahead-C6eS7yJg.js"; import { F as H } from "./FormFieldText-CaWtYVur.js"; const B = ({ value: t, isErrored: m, onChange: d, intl: l, placeholder: s = "", isRequired: u = !1, verificationService: n, disabled: g = !1 }) => { const { viewModel: o, programTheme: p, fieldValidationErrors: N } = n; if (!O(o)) return I.error("Expected low-income view model is malformed"), null; const f = o.statuses[0] ? o.statuses[0] : void 0, [c, C] = h.useState(); h.useEffect(() => { x( M( z(o, (e) => { e.statuses = ["OTHER_GOVERNMENT_ASSISTANCE"]; }), p ) ).then((e) => { if (e) { let i = e; o.countryChoice && (i = e.filter( (F) => F.country === o.countryChoice.value )), C(i.map(w)); } }).catch((e) => { I.error(e); }); }, []); const E = (e, i) => { i(e ? { id: e.value, name: e.label } : { id: 0, name: "" }); }; return b("organization")?.hidden ? null : f === "COMMUNITY_ELIGIBILITY_PROVISION" ? /* @__PURE__ */ a.jsx( v, { fieldId: "cep-organization", value: o.organization, verificationService: n, onChange: d, placeholder: l.formatHTMLMessage({ id: "schoolNamePlaceholder", defaultMessage: "School name" }), label: /* @__PURE__ */ a.jsx(r, { id: "schoolName", defaultMessage: "School name" }), errorMessage: !!N.organization && /* @__PURE__ */ a.jsx( r, { id: "errorId.invalidOrganization", defaultMessage: "You must select an organization from the list" } ), isRequired: f === "COMMUNITY_ELIGIBILITY_PROVISION", disabled: g, orgSearchUrl: M( n.viewModel, n.programTheme ) } ) : c ? /* @__PURE__ */ a.jsx( L, { fieldId: "low-income", value: c.find((e) => e.value === (t && t.value)), refId: "organization", onChange: (e) => E(e, d), placeholder: s || l.formatHTMLMessage({ id: "lowIncomeOrganizationPlaceholder", defaultMessage: "Government Assistance Program" }), label: /* @__PURE__ */ a.jsx( r, { id: "lowIncomeOrganization", defaultMessage: "Government Assistance Program" } ), errorMessage: m && /* @__PURE__ */ a.jsx( r, { id: "errorId.invalidOrganization", defaultMessage: "You must select an organization from the list" } ), isRequired: u, showPlaceholderAndHideLabel: !!s, options: c, containerId: "sid-low-income-id", disabled: g } ) : /* @__PURE__ */ a.jsx(j, {}); }, _ = T(B), S = ({ value: t, isErrored: m, onChange: d, intl: l, placeholder: s = "", disabled: u = !1 }) => b("ebtCardNumber")?.hidden ? null : /* @__PURE__ */ a.jsx( H, { fieldId: "ebtCardNumber", value: t, onChange: d, placeholder: s || l.formatHTMLMessage({ id: "ebtCardNumberPlaceholder", defaultMessage: "EBT card Number" }), label: /* @__PURE__ */ a.jsx(r, { id: "ebtCardNumber", defaultMessage: "EBT card Number" }), errorMessage: m && /* @__PURE__ */ a.jsx( r, { id: "errorId.invalidEBTCardNumber", defaultMessage: "Invalid EBT Card Number" } ), showPlaceholderAndHideLabel: !!s, disabled: u } ), y = T(S); export { y as E, _ as L };