@openwarelabs/ui 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +2 -1
- package/dist/index.js.map +2 -2
- package/dist/openware-ui.iife.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -624,7 +624,8 @@ function Field({ label, children, hint, error, className }) {
|
|
|
624
624
|
const child = isValidElement(children) ? children : null;
|
|
625
625
|
const controlId = child?.props.id ?? `${generatedId}-control`;
|
|
626
626
|
const describedBy = [child?.props["aria-describedby"], hint ? hintId : void 0, error ? errorId : void 0].filter(Boolean).join(" ") || void 0;
|
|
627
|
-
const
|
|
627
|
+
const invalid = child?.props.isInvalid ?? (error ? true : void 0);
|
|
628
|
+
const invalidProp = child && typeof child.type !== "string" ? invalid === void 0 ? {} : { isInvalid: invalid } : { "aria-invalid": error ? true : void 0 };
|
|
628
629
|
return /* @__PURE__ */ jsxs6("div", { className: cx("ow-field", className), children: [
|
|
629
630
|
/* @__PURE__ */ jsx9("label", { className: "ow-field__label", htmlFor: controlId, children: label }),
|
|
630
631
|
child ? cloneElement(child, { id: controlId, "aria-describedby": describedBy, ...invalidProp }) : children,
|