allaw-ui 2.1.9 → 2.2.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.
|
@@ -108,7 +108,7 @@ var PrimaryButton = forwardRef(function (_a, ref) {
|
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
110
|
}); };
|
|
111
|
-
return (React.createElement("button", __assign({ ref: buttonRef, className: "primary-button ".concat(disabled ? "primary-button-disabled" : "primary-button-enabled", " ").concat(fullWidth ? "primary-button-full-width" : "", " ").concat(isButtonLoading ? "primary-button-loading" : "").concat(variant === "warning" ? "primary-button-warning" : ""), disabled: disabled, onClick: handleClick, type: type }, props),
|
|
111
|
+
return (React.createElement("button", __assign({ ref: buttonRef, className: "primary-button ".concat(disabled ? "primary-button-disabled" : "primary-button-enabled", " ").concat(fullWidth ? "primary-button-full-width" : "", " ").concat(isButtonLoading ? "primary-button-loading" : "").concat(variant === "warning" ? "primary-button-warning" : ""), disabled: disabled, onClick: handleClick, type: type }, props, { "data-cy": "primary-button" }),
|
|
112
112
|
startIcon && (React.createElement("span", { className: "primary-button-icon ".concat(startIconName) })),
|
|
113
113
|
React.createElement("span", { className: "primary-button-label" }, label),
|
|
114
114
|
isButtonLoading ? (React.createElement("span", { className: "primary-button-loading-dots" }, loadingDots)) : (endIcon && React.createElement("span", { className: "primary-button-icon ".concat(endIconName) }))));
|
|
@@ -2,14 +2,11 @@ import React from "react";
|
|
|
2
2
|
import styles from "./SelectableListItem.module.css";
|
|
3
3
|
import "../../../styles/global.css";
|
|
4
4
|
import "../../../styles/icons.css";
|
|
5
|
+
import { slugify } from "../../../utils/utils";
|
|
5
6
|
var SelectableListItem = function (_a) {
|
|
6
7
|
var label = _a.label, duration = _a.duration, price = _a.price, isActive = _a.isActive, onClick = _a.onClick, icon = _a.icon;
|
|
7
8
|
var hasIcon = icon && icon.length > 0;
|
|
8
|
-
return (React.createElement("button", { className: "".concat(styles.container, " ").concat(isActive ? styles.active : "", " ").concat(hasIcon ? styles.withIcon : ""), onClick: onClick, "data-cy": "
|
|
9
|
-
.toLowerCase()
|
|
10
|
-
.replace(/\s+/g, "")
|
|
11
|
-
.replace(/[']/g, "")
|
|
12
|
-
.slice(0, 15)) },
|
|
9
|
+
return (React.createElement("button", { className: "".concat(styles.container, " ").concat(isActive ? styles.active : "", " ").concat(hasIcon ? styles.withIcon : ""), onClick: onClick, "data-cy": "item-".concat(slugify(label)) },
|
|
13
10
|
React.createElement("div", { className: styles.iconContainer }, isActive && React.createElement("span", { className: styles.activeIcon })),
|
|
14
11
|
hasIcon && (React.createElement("div", { className: styles.iconWrapper },
|
|
15
12
|
React.createElement("i", { className: "".concat(icon, " ").concat(styles.icon) }))),
|
package/dist/utils/utils.d.ts
CHANGED
package/dist/utils/utils.js
CHANGED
|
@@ -46,3 +46,13 @@ export function convertToHtml(text) {
|
|
|
46
46
|
.join("<br />");
|
|
47
47
|
return processedText;
|
|
48
48
|
}
|
|
49
|
+
export var slugify = function (text) {
|
|
50
|
+
return text
|
|
51
|
+
.normalize("NFD") // Décompose les caractères accentués (é -> e + ´)
|
|
52
|
+
.replace(/[\u0300-\u036f]/g, "") // Supprime les accents
|
|
53
|
+
.toLowerCase() // Met en minuscule
|
|
54
|
+
.replace(/[^a-z0-9\s-]/g, "") // Supprime les caractères spéciaux
|
|
55
|
+
.trim() // Supprime les espaces en début et fin de chaîne
|
|
56
|
+
.replace(/\s+/g, "-") // Remplace les espaces par des tirets
|
|
57
|
+
.slice(0, 15); // Limite à 15 caractères
|
|
58
|
+
};
|