@thecb/components 11.3.3 → 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 +6 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +6 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/form-layouts/index.d.ts +1 -1
- package/src/util/general.js +8 -3
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/atoms/.DS_Store +0 -0
package/package.json
CHANGED
package/src/util/general.js
CHANGED
|
@@ -26,9 +26,14 @@ export const createIdFromString = (text, postscript, unique = false) => {
|
|
|
26
26
|
// "first name", undefined, false -> "first-name"
|
|
27
27
|
// "email address", "error message", false -> "email-address-error-message"
|
|
28
28
|
// "shopping cart", "order item", true -> "shopping-cart-order-item_2ahtlz608"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const formatIdString = str =>
|
|
30
|
+
str && typeof str === "string" ? str.trim().replace(/\s+/g, "-") : "";
|
|
31
|
+
|
|
32
|
+
const textId = formatIdString(text?.toString());
|
|
33
|
+
const postscriptId = formatIdString(postscript?.toString());
|
|
34
|
+
return `${textId}${postscriptId ? `-${postscriptId}` : ``}${
|
|
35
|
+
unique ? createUniqueId() : ``
|
|
36
|
+
}`;
|
|
32
37
|
}
|
|
33
38
|
};
|
|
34
39
|
|
package/src/.DS_Store
DELETED
|
Binary file
|
package/src/components/.DS_Store
DELETED
|
Binary file
|
|
Binary file
|