@thecb/components 11.3.4 → 11.3.5

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.cjs.js CHANGED
@@ -1725,7 +1725,14 @@ var createIdFromString = function createIdFromString(text, postscript) {
1725
1725
  // "first name", undefined, false -> "first-name"
1726
1726
  // "email address", "error message", false -> "email-address-error-message"
1727
1727
  // "shopping cart", "order item", true -> "shopping-cart-order-item_2ahtlz608"
1728
- return "".concat(text === null || text === void 0 ? void 0 : text.replace(/\s+/g, "-")).concat(postscript ? "-".concat(postscript === null || postscript === void 0 ? void 0 : postscript.replace(/\s+/g, "-")) : "").concat(unique ? createUniqueId() : "");
1728
+ var formatIdString = function formatIdString(str) {
1729
+ return str && typeof str === "string" ? str.trim().replace(/\s+/g, "-") : "";
1730
+ };
1731
+ var textIdSegment = formatIdString(text === null || text === void 0 ? void 0 : text.toString());
1732
+ var postscriptId = formatIdString(postscript === null || postscript === void 0 ? void 0 : postscript.toString());
1733
+ var postscriptIdSegment = postscriptId ? "-".concat(postscriptId) : "";
1734
+ var uniqueIdSegment = unique ? createUniqueId() : "";
1735
+ return "".concat(textIdSegment).concat(postscriptIdSegment).concat(uniqueIdSegment);
1729
1736
  }
1730
1737
  };
1731
1738
  var safeChildren = function safeChildren(children) {