ar-design 0.3.75 → 0.3.77
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.
|
@@ -3,7 +3,7 @@ const Skeleton = ({ tabs = [] }) => {
|
|
|
3
3
|
return (React.createElement("div", { className: "ar-tabs skeleton" },
|
|
4
4
|
React.createElement("div", { className: "tabs" }, tabs.length > 0 &&
|
|
5
5
|
tabs.map((tab, index) => {
|
|
6
|
-
return (React.createElement("div", { key:
|
|
6
|
+
return (React.createElement("div", { key: index, className: "item", style: { width: `${tab.title.length}px` } }, Array.from({ length: 3 }, (_, i) => (React.createElement("span", { key: i, style: { animationDelay: `${i++}s` } })))));
|
|
7
7
|
})),
|
|
8
8
|
React.createElement("div", { className: "content" })));
|
|
9
9
|
};
|
|
@@ -135,7 +135,21 @@ export const useValidation = function (data, params, step) {
|
|
|
135
135
|
if (s.type === "maximum" && vLenght > s.value) {
|
|
136
136
|
setError(key, Utils.StringFormat(s.message, s.value), param.step, index);
|
|
137
137
|
}
|
|
138
|
-
|
|
138
|
+
// Regexes
|
|
139
|
+
const phoneRegex = /^((\+90|0)?([2-5]\d{2})\d{7}|\+[1-9]\d{7,14})$/;
|
|
140
|
+
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
141
|
+
const ibanRegex = /^TR\d{24}$/;
|
|
142
|
+
const accountNumberRegex = /^\d{6,16}$/;
|
|
143
|
+
if (s.type === "phone" && value && !phoneRegex.test(value)) {
|
|
144
|
+
setError(key, s.message, param.step, index);
|
|
145
|
+
}
|
|
146
|
+
if (s.type === "email" && value && !emailRegex.test(value)) {
|
|
147
|
+
setError(key, s.message, param.step, index);
|
|
148
|
+
}
|
|
149
|
+
if (s.type === "iban" && value && !ibanRegex.test(value.replace(/\s/g, ""))) {
|
|
150
|
+
setError(key, s.message, param.step, index);
|
|
151
|
+
}
|
|
152
|
+
if (s.type === "account-number" && value && !accountNumberRegex.test(value)) {
|
|
139
153
|
setError(key, s.message, param.step, index);
|
|
140
154
|
}
|
|
141
155
|
};
|
|
@@ -69,7 +69,7 @@ export type KanbanBoardColumnType<T, TColumnProperties> = {
|
|
|
69
69
|
columnProperties: TColumnProperties;
|
|
70
70
|
};
|
|
71
71
|
export type ValidationShape = {
|
|
72
|
-
type: "required" | "minimum" | "maximum" | "email";
|
|
72
|
+
type: "required" | "minimum" | "maximum" | "email" | "phone" | "iban" | "account-number";
|
|
73
73
|
value?: string | number;
|
|
74
74
|
message: string;
|
|
75
75
|
};
|