@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
89 lines (87 loc) • 3.21 kB
JavaScript
/**
* 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 l, R as _, d } from "../_mysheerid-preview.js";
const u = (s) => !_.isValidElement(s) && s === "", m = ({
text: s,
htmlForLabel: t,
id: i,
displayClasses: e,
isRequired: a,
children: n
}) => /* @__PURE__ */ l.jsx("label", { htmlFor: t, children: /* @__PURE__ */ l.jsxs("div", { id: i, className: `sid-field__label sid-l-space-btm-sm ${e}`, children: [
/* @__PURE__ */ l.jsxs("span", { className: "sid-field__label-name", children: [
s,
a && !u(s) && /* @__PURE__ */ l.jsx("span", { "aria-hidden": "true", className: "sid-field__label--required", children: "*" })
] }),
n && /* @__PURE__ */ l.jsx("div", { className: "sid-field__label-explanation", children: n })
] }) });
m.defaultProps = {
id: "",
displayClasses: "",
isRequired: !0,
children: null
};
const b = ({ className: s }) => /* @__PURE__ */ l.jsx(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
fill: "currentColor",
className: s,
children: /* @__PURE__ */ l.jsx(
"path",
{
fillRule: "evenodd",
d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003ZM12 8.25a.75.75 0 0 1 .75.75v3.75a.75.75 0 0 1-1.5 0V9a.75.75 0 0 1 .75-.75Zm0 8.25a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z",
clipRule: "evenodd"
}
)
}
), f = (s) => `sid-${d(s)}-label`, N = (s) => `sid-${d(s)}-error`, $ = (s) => `sid-${d(s)}-warning`, H = (s) => `sid-${d(s)}-helper`, g = ({
fieldId: s,
label: t,
errorMessage: i,
warningMessage: e,
helperMessage: a,
isRequired: n,
showPlaceholderAndHideLabel: c = !1,
children: o,
explanation: r = void 0,
containerId: x = void 0
}) => {
const h = f(s), j = N(s), p = $(s), v = H(s), F = x || `sid-${d(s)}`;
return /* @__PURE__ */ l.jsxs("div", { className: `sid-field ${F}`, children: [
/* @__PURE__ */ l.jsx("div", { className: "sid-l-space-top-md" }),
/* @__PURE__ */ l.jsx(
m,
{
text: t,
isRequired: n,
htmlForLabel: `sid-${d(s)}`,
id: h,
displayClasses: `${r ? "sid-field__label-with-explanation" : ""}${r && c ? " " : ""}${c ? "sid-h-screen-reader-only" : ""}`,
children: r && r
}
),
o,
i && /* @__PURE__ */ l.jsx("div", { className: "sid-field-error", id: j, children: i }),
!i && e && /* @__PURE__ */ l.jsxs("div", { className: "sid-field-warning", id: p, children: [
/* @__PURE__ */ l.jsx(b, { className: "sid-field-warning__icon" }),
/* @__PURE__ */ l.jsx("div", { className: "sid-field-warning__message", children: e })
] }),
!i && !e && a && /* @__PURE__ */ l.jsx("div", { className: "sid-field-helper", id: v, children: a })
] });
};
export {
g as F,
m as a,
f as g
};