@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/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 invalidProp = child && typeof child.type !== "string" ? { isInvalid: child.props.isInvalid ?? Boolean(error) } : { "aria-invalid": error ? true : void 0 };
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,