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