@thecb/components 11.3.4 → 11.3.5-beta.0

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,12 @@ 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 textId = formatIdString(text === null || text === void 0 ? void 0 : text.toString());
1732
+ var postscriptId = formatIdString(postscript === null || postscript === void 0 ? void 0 : postscript.toString());
1733
+ return "".concat(textId).concat(postscriptId ? "-".concat(postscriptId) : "").concat(unique ? createUniqueId() : "");
1729
1734
  }
1730
1735
  };
1731
1736
  var safeChildren = function safeChildren(children) {