UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

170 lines (168 loc) 6.43 kB
/** * WARNING: This file is intended to be used within MySheerID. * This file is not intended for use in other contexts and there are no guarantees about its behavior outside of MySheerID. */ /** * VERSION: 2.230.0-alpha.0 * BUILD_TIMESTAMP: 1778694697559 * BUILD_DATE: Wed May 13 2026 17:51:37 GMT+0000 (Coordinated Universal Time) * BUILD_COMMIT: 7af1c105d5485ac4ed1190c56d492bb4590667a9 */ import { j as e, F as u, i as g, Z as f, H as b } from "../_mysheerid-preview.js"; import { u as _ } from "./downshift.esm-CtrbqQGL.js"; const M = 42, N = ({ getItemProps: s, highlightedIndex: n, options: t, itemToString: c }) => { const i = t.length * M, a = (l, o) => /* @__PURE__ */ e.jsx( "div", { className: `sid-select-list__item ${n === o ? "sid-select-list__item--highlighted" : ""}`, ...s({ index: o, item: l }), children: c(t[o]) }, o ); return !t || t.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "sid-select-list__message", children: /* @__PURE__ */ e.jsx(u, { id: "noOptions", defaultMessage: "No Options" }) }) : /* @__PURE__ */ e.jsx("div", { className: "sid-input-select-list__menu", style: { height: Math.min(i, 280) }, children: t.map((l, o) => a(l, o)) }); }, w = N, I = ({ getToggleButtonProps: s, isOpen: n }) => ( // eslint-disable-next-line react/jsx-props-no-spreading /* @__PURE__ */ e.jsx("button", { ...s({}), className: "sid-select-button", type: "button", children: /* @__PURE__ */ e.jsx( "svg", { viewBox: "0 0 20 20", preserveAspectRatio: "none", width: 16, fill: "transparent", stroke: "currentColor", strokeWidth: "3px", transform: n ? "rotate(180)" : void 0, children: /* @__PURE__ */ e.jsx("path", { d: "M1,6 L10,15 L19,6" }) } ) }) ), y = I, h = (s) => s ? s.label : "", O = ({ className: s, isErrored: n = !1, onChange: t, options: c, overrideInputClassName: i, placeholder: a = "", value: l, DisplayValueDecorator: o, id: m }) => { const { isOpen: d, getInputProps: p, getMenuProps: x, getToggleButtonProps: j, getItemProps: v, highlightedIndex: C } = _({ id: m, onSelectedItemChange: ({ selectedItem: L }) => t(L), items: c, itemToString: h, initialSelectedItem: l && l.value && l.label ? l : void 0 }), r = l?.label || ""; return /* @__PURE__ */ e.jsxs("div", { className: `sid-select-list ${s}`, children: [ /* @__PURE__ */ e.jsx( "input", { ...p(), className: ` sid-l-full-width ${i || "sid-select-input"} ${n ? "sid-select-input--error" : ""} `, placeholder: a, readOnly: !0 } ), r && /* @__PURE__ */ e.jsxs("span", { className: "sid-select-display", children: [ o && o, /* @__PURE__ */ e.jsx("span", { "aria-hidden": !0, children: r }), /* @__PURE__ */ e.jsx(y, { getToggleButtonProps: j, isOpen: d }) ] }), /* @__PURE__ */ e.jsx("div", { ...x(), children: d && /* @__PURE__ */ e.jsx( w, { highlightedIndex: C, itemToString: h, options: c, getItemProps: v } ) }) ] }); }, S = O, T = () => /* @__PURE__ */ e.jsx( "svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "3.48 3.06 67.67 37.07", "aria-hidden": "true", focusable: "false", className: "locale-symbol-svg", children: /* @__PURE__ */ e.jsx( "path", { fill: "currentColor", stroke: "none", d: "m 4.53,38.37 -1.05,-1.75 2.56,-0.81 c 4.27,-1.35 9.26,-3.96 12.59,-6.59 0.46,-0.36 0.47,-0.45 0.11,-0.87 -4.36,-5.09 -5.75,-7.32 -7.63,-12.24 l -0.96,-2.51 -2.96,-0.07 -2.96,-0.07 V 11.48 9.5 h 7.81 c 7.41,0 7.8,-0.02 7.56,-0.47 -0.14,-0.26 -0.92,-1.4 -1.73,-2.53 -0.81,-1.13 -1.48,-2.1 -1.48,-2.16 0,-0.05 0.63,-0.33 1.39,-0.61 2.65,-0.98 2.41,-1.04 3.57,0.8 0.58,0.92 1.43,2.41 1.89,3.32 l 0.83,1.65 h 7.54 7.54 v 1.98 1.98 l -2.98,0.07 -2.98,0.07 -0.61,1.72 c -1.44,4.04 -4.11,8.89 -6.44,11.68 -0.56,0.68 -1.02,1.39 -1.02,1.59 0,0.42 4,3.14 6.89,4.7 1.1,0.59 3.3,1.62 4.89,2.28 1.59,0.67 2.94,1.26 3,1.32 0.09,0.09 -0.54,1.14 -1.84,3.1 -0.39,0.59 -8.46,-3.29 -12.5,-6.02 -3.87,-2.62 -3.41,-2.46 -4.65,-1.57 -4.56,3.28 -7.64,4.93 -12.51,6.7 l -2.83,1.03 z M 23.84,23.73 c 1.66,-2.24 4.6,-7.89 4.9,-9.4 l 0.17,-0.86 h -7.34 -7.34 l 0.17,0.86 c 0.25,1.27 2.39,5.4 3.73,7.19 1.67,2.23 3.57,4.39 3.86,4.39 0.14,0 0.98,-0.98 1.86,-2.17 z M 44.03,35.51 c 0.08,-0.26 2.45,-6.96 5.27,-14.89 l 5.12,-14.42 3.06,-0.07 3.06,-0.07 0.39,1.13 c 0.43,1.23 9.28,26.16 9.86,27.79 l 0.36,0.99 h -2.83 -2.83 l -1.19,-3.77 -1.19,-3.77 -5.56,-0.07 -5.56,-0.07 -1.23,3.78 -1.23,3.78 -2.82,0.08 c -2.6,0.07 -2.81,0.04 -2.67,-0.4 z M 61.64,23.99 c -0.03,-0.54 -3.96,-12.23 -4.13,-12.29 -0.19,-0.06 -4.07,11.52 -4.07,12.16 0,0.11 1.85,0.2 4.1,0.2 2.26,0 4.1,-0.03 4.1,-0.07 z" } ) } ), H = ({ value: s, options: n, onChange: t, intl: c }) => { const i = n.map((l) => ({ value: l.value, label: c.formatHTMLMessage({ id: `locales.${l.value}`, defaultMessage: "Label not found" }) })), a = "changeLanguageSelector"; return /* @__PURE__ */ e.jsxs("div", { className: "sid-change-locale", children: [ /* @__PURE__ */ e.jsx("div", { className: "sid-field__label sid-change-locale__label", id: `${a}-label`, children: /* @__PURE__ */ e.jsx(u, { id: "changeLanguage", defaultMessage: "Change language" }) }), /* @__PURE__ */ e.jsx( S, { className: "sid-change-locale__select", options: i, onChange: (l) => t(l), DisplayValueDecorator: /* @__PURE__ */ e.jsx(T, {}), overrideInputClassName: "sid-change-locale__input", value: i.find((l) => l.value === (s && s.value)), id: a } ) ] }); }, $ = g(H), B = ({ verificationService: s, intl: n }) => { const t = f( s.programTheme, n ), c = (a) => { a?.value && s.viewModel.localeChoice.value !== a.value && s.updateLocale( a.value, s.verificationResponse.segment ); }; if (t.length <= 1) return null; const i = { value: b, label: "English" }; return /* @__PURE__ */ e.jsx( $, { options: t, value: s.viewModel.localeChoice || i, onChange: (a) => c(a) } ); }, z = g(B); export { z as C };