@yomologic/react-ui 0.6.3 → 0.6.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.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -3
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +75 -0
- package/dist/styles.css.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -25,13 +25,16 @@ var EMAIL_REGEX, URL_REGEX, PHONE_REGEX, isValidEmail, isValidUrl, DATE_REGEX, i
|
|
|
25
25
|
var init_validation = __esm({
|
|
26
26
|
"src/constants/validation.ts"() {
|
|
27
27
|
"use strict";
|
|
28
|
-
EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](
|
|
28
|
+
EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z]{2,}$/;
|
|
29
29
|
URL_REGEX = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/;
|
|
30
30
|
PHONE_REGEX = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/;
|
|
31
31
|
isValidEmail = (email) => {
|
|
32
32
|
return EMAIL_REGEX.test(email);
|
|
33
33
|
};
|
|
34
34
|
isValidUrl = (url) => {
|
|
35
|
+
if (/^(javascript|data|vbscript|file|about):/i.test(url)) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
35
38
|
return URL_REGEX.test(url);
|
|
36
39
|
};
|
|
37
40
|
DATE_REGEX = /^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/\d{4}$/;
|
|
@@ -909,6 +912,9 @@ function useFormField2(options) {
|
|
|
909
912
|
return errorMessages?.email || "Please enter a valid email address";
|
|
910
913
|
}
|
|
911
914
|
if (type === "url") {
|
|
915
|
+
if (/^(javascript|data|vbscript|file|about):/i.test(value)) {
|
|
916
|
+
return errorMessages?.url || "Invalid URL protocol";
|
|
917
|
+
}
|
|
912
918
|
try {
|
|
913
919
|
new URL(value);
|
|
914
920
|
} catch {
|
|
@@ -966,6 +972,11 @@ function useFormField2(options) {
|
|
|
966
972
|
return errorMessages?.email || "Please enter a valid email address";
|
|
967
973
|
}
|
|
968
974
|
if (type === "url") {
|
|
975
|
+
if (/^(javascript|data|vbscript|file|about):/i.test(
|
|
976
|
+
value
|
|
977
|
+
)) {
|
|
978
|
+
return errorMessages?.url || "Invalid URL protocol";
|
|
979
|
+
}
|
|
969
980
|
try {
|
|
970
981
|
new URL(value);
|
|
971
982
|
} catch {
|
|
@@ -4340,12 +4351,14 @@ var Nav = React14.forwardRef(
|
|
|
4340
4351
|
const variantItemStyles = {
|
|
4341
4352
|
primary: "rounded-md hover:bg-(--color-primary)/10 hover:text-(--color-primary) transition-colors duration-150",
|
|
4342
4353
|
secondary: "rounded-md hover:bg-(--color-muted) transition-colors duration-150",
|
|
4343
|
-
ghost: "rounded-md hover:bg-(--color-primary)/5 transition-colors duration-150"
|
|
4354
|
+
ghost: "rounded-md hover:bg-(--color-primary)/5 transition-colors duration-150",
|
|
4355
|
+
underline: "relative hover:text-(--color-primary) transition-colors duration-150 after:content-[''] after:absolute after:bottom-0 after:left-0 after:h-0.5 after:bg-(--color-primary) after:w-0 hover:after:w-full after:transition-all after:duration-300"
|
|
4344
4356
|
};
|
|
4345
4357
|
const activeItemStyles = {
|
|
4346
4358
|
primary: "bg-(--color-primary) text-white hover:bg-(--color-primary) hover:text-white",
|
|
4347
4359
|
secondary: "bg-(--color-muted) text-(--color-foreground) font-semibold",
|
|
4348
|
-
ghost: "text-(--color-primary) font-medium"
|
|
4360
|
+
ghost: "text-(--color-primary) font-medium",
|
|
4361
|
+
underline: "text-(--color-primary) after:content-[''] after:absolute after:bottom-0 after:left-0 after:h-0.5 after:w-full after:bg-(--color-primary)"
|
|
4349
4362
|
};
|
|
4350
4363
|
const breakpointClasses = {
|
|
4351
4364
|
sm: "sm:hidden",
|