@ews-admin/global-design-system 1.1.11 → 1.1.12

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.
@@ -36,4 +36,17 @@ export declare function debounce<T extends (...args: any[]) => any>(func: T, wai
36
36
  * @returns Unique ID string
37
37
  */
38
38
  export declare function generateId(prefix?: string): string;
39
+ /**
40
+ * Utility function to format numeric input by removing non-digit characters
41
+ * @param value - String value to format
42
+ * @returns String with only numeric characters
43
+ */
44
+ export declare const formatNumeric: (value: string) => string;
45
+ /**
46
+ * Utility function to validate phone numbers
47
+ * Validates phone numbers with 1-15 digits, starting with a non-zero digit
48
+ * @param value - Phone number string to validate
49
+ * @returns Boolean indicating if the phone number is valid
50
+ */
51
+ export declare function isValidPhoneNumber(value: string): boolean;
39
52
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,QAAQ,QAAQ,CAAC;AAE9B;;;;GAIG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,SAAW,GAAG,MAAM,CAK1E;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,EAC5B,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,GACnC,MAAM,CAQR;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACxD,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,MAAM,GACX,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAMlC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,SAAQ,GAAG,MAAM,CAEjD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,QAAQ,QAAQ,CAAC;AAE9B;;;;GAIG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,SAAW,GAAG,MAAM,CAK1E;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,EAC5B,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,GACnC,MAAM,CAQR;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACxD,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,MAAM,GACX,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAMlC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,SAAQ,GAAG,MAAM,CAEjD;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,MAE7C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAIzD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ews-admin/global-design-system",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "description": "EWS Global Design System - Reusable components for EWS applications",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
package/src/index.ts CHANGED
@@ -42,7 +42,15 @@ export {
42
42
  export type { IconProps, SimpleIconProps } from "./icons";
43
43
 
44
44
  // Utils
45
- export { cn, debounce, formatCurrency, formatDate, generateId } from "./utils";
45
+ export {
46
+ cn,
47
+ debounce,
48
+ formatCurrency,
49
+ formatDate,
50
+ formatNumeric,
51
+ generateId,
52
+ isValidPhoneNumber,
53
+ } from "./utils";
46
54
 
47
55
  // Hooks
48
56
  export { useDebounce, useDebouncedCallback, useSelectField } from "./hooks";
@@ -71,3 +71,24 @@ export function debounce<T extends (...args: any[]) => any>(
71
71
  export function generateId(prefix = "ews"): string {
72
72
  return `${prefix}-${Math.random().toString(36).substr(2, 9)}`;
73
73
  }
74
+
75
+ /**
76
+ * Utility function to format numeric input by removing non-digit characters
77
+ * @param value - String value to format
78
+ * @returns String with only numeric characters
79
+ */
80
+ export const formatNumeric = (value: string): string => {
81
+ return value.replace(/\D/g, "");
82
+ };
83
+
84
+ /**
85
+ * Utility function to validate phone numbers
86
+ * Validates phone numbers with 1-15 digits, starting with a non-zero digit
87
+ * @param value - Phone number string to validate
88
+ * @returns Boolean indicating if the phone number is valid
89
+ */
90
+ export function isValidPhoneNumber(value: string): boolean {
91
+ const trimmedValue = value.trim();
92
+ const phoneRegex = /^[0-9]\d{1,14}$/;
93
+ return phoneRegex.test(trimmedValue);
94
+ }