@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 CHANGED
@@ -807,7 +807,7 @@ interface NavItem$2 {
807
807
  }
808
808
  interface NavProps extends React.HTMLAttributes<HTMLElement> {
809
809
  items: NavItem$2[];
810
- variant?: "primary" | "secondary" | "ghost";
810
+ variant?: "primary" | "secondary" | "ghost" | "underline";
811
811
  orientation?: "horizontal" | "vertical";
812
812
  size?: "xs" | "sm" | "md" | "lg" | "xl";
813
813
  mobileBreakpoint?: "sm" | "md" | "lg";
@@ -1150,8 +1150,9 @@ declare function cn(...inputs: ClassValue[]): string;
1150
1150
  * Validation constants and regex patterns
1151
1151
  */
1152
1152
  /**
1153
- * RFC 5322 compliant email validation regex (simplified)
1153
+ * Email validation regex
1154
1154
  * Matches standard email formats like: user@example.com
1155
+ * Requires @ symbol, domain name, and TLD (like .com, .org, etc.)
1155
1156
  */
1156
1157
  declare const EMAIL_REGEX: RegExp;
1157
1158
  /**
@@ -1169,7 +1170,8 @@ declare const PHONE_REGEX: RegExp;
1169
1170
  */
1170
1171
  declare const isValidEmail: (email: string) => boolean;
1171
1172
  /**
1172
- * Validate URL format
1173
+ * Validate URL format and security
1174
+ * Checks for valid http/https protocol and blocks dangerous protocols
1173
1175
  */
1174
1176
  declare const isValidUrl: (url: string) => boolean;
1175
1177
  /**
package/dist/index.d.ts CHANGED
@@ -807,7 +807,7 @@ interface NavItem$2 {
807
807
  }
808
808
  interface NavProps extends React.HTMLAttributes<HTMLElement> {
809
809
  items: NavItem$2[];
810
- variant?: "primary" | "secondary" | "ghost";
810
+ variant?: "primary" | "secondary" | "ghost" | "underline";
811
811
  orientation?: "horizontal" | "vertical";
812
812
  size?: "xs" | "sm" | "md" | "lg" | "xl";
813
813
  mobileBreakpoint?: "sm" | "md" | "lg";
@@ -1150,8 +1150,9 @@ declare function cn(...inputs: ClassValue[]): string;
1150
1150
  * Validation constants and regex patterns
1151
1151
  */
1152
1152
  /**
1153
- * RFC 5322 compliant email validation regex (simplified)
1153
+ * Email validation regex
1154
1154
  * Matches standard email formats like: user@example.com
1155
+ * Requires @ symbol, domain name, and TLD (like .com, .org, etc.)
1155
1156
  */
1156
1157
  declare const EMAIL_REGEX: RegExp;
1157
1158
  /**
@@ -1169,7 +1170,8 @@ declare const PHONE_REGEX: RegExp;
1169
1170
  */
1170
1171
  declare const isValidEmail: (email: string) => boolean;
1171
1172
  /**
1172
- * Validate URL format
1173
+ * Validate URL format and security
1174
+ * Checks for valid http/https protocol and blocks dangerous protocols
1173
1175
  */
1174
1176
  declare const isValidUrl: (url: string) => boolean;
1175
1177
  /**
package/dist/index.js CHANGED
@@ -47,13 +47,16 @@ var EMAIL_REGEX, URL_REGEX, PHONE_REGEX, isValidEmail, isValidUrl, DATE_REGEX, i
47
47
  var init_validation = __esm({
48
48
  "src/constants/validation.ts"() {
49
49
  "use strict";
50
- EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
50
+ EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z]{2,}$/;
51
51
  URL_REGEX = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/;
52
52
  PHONE_REGEX = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/;
53
53
  isValidEmail = (email) => {
54
54
  return EMAIL_REGEX.test(email);
55
55
  };
56
56
  isValidUrl = (url) => {
57
+ if (/^(javascript|data|vbscript|file|about):/i.test(url)) {
58
+ return false;
59
+ }
57
60
  return URL_REGEX.test(url);
58
61
  };
59
62
  DATE_REGEX = /^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/\d{4}$/;
@@ -987,6 +990,9 @@ function useFormField2(options) {
987
990
  return errorMessages?.email || "Please enter a valid email address";
988
991
  }
989
992
  if (type === "url") {
993
+ if (/^(javascript|data|vbscript|file|about):/i.test(value)) {
994
+ return errorMessages?.url || "Invalid URL protocol";
995
+ }
990
996
  try {
991
997
  new URL(value);
992
998
  } catch {
@@ -1044,6 +1050,11 @@ function useFormField2(options) {
1044
1050
  return errorMessages?.email || "Please enter a valid email address";
1045
1051
  }
1046
1052
  if (type === "url") {
1053
+ if (/^(javascript|data|vbscript|file|about):/i.test(
1054
+ value
1055
+ )) {
1056
+ return errorMessages?.url || "Invalid URL protocol";
1057
+ }
1047
1058
  try {
1048
1059
  new URL(value);
1049
1060
  } catch {
@@ -4418,12 +4429,14 @@ var Nav = import_react21.default.forwardRef(
4418
4429
  const variantItemStyles = {
4419
4430
  primary: "rounded-md hover:bg-(--color-primary)/10 hover:text-(--color-primary) transition-colors duration-150",
4420
4431
  secondary: "rounded-md hover:bg-(--color-muted) transition-colors duration-150",
4421
- ghost: "rounded-md hover:bg-(--color-primary)/5 transition-colors duration-150"
4432
+ ghost: "rounded-md hover:bg-(--color-primary)/5 transition-colors duration-150",
4433
+ 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"
4422
4434
  };
4423
4435
  const activeItemStyles = {
4424
4436
  primary: "bg-(--color-primary) text-white hover:bg-(--color-primary) hover:text-white",
4425
4437
  secondary: "bg-(--color-muted) text-(--color-foreground) font-semibold",
4426
- ghost: "text-(--color-primary) font-medium"
4438
+ ghost: "text-(--color-primary) font-medium",
4439
+ 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)"
4427
4440
  };
4428
4441
  const breakpointClasses = {
4429
4442
  sm: "sm:hidden",