@ews-admin/global-design-system 1.6.0 → 1.7.0

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.
@@ -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,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EACL,aAAa,EACb,iCAAiC,EACjC,gCAAgC,EAChC,qBAAqB,GACtB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACzE,YAAY,EACV,SAAS,EACT,kBAAkB,EAClB,WAAW,GACZ,MAAM,cAAc,CAAC;AAEtB;;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,OAAO,EAAE,KAAK,OAAO,EAChE,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,a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IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EAChE,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,UAAW,MAAM,KAAG,MAE7C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAMzD;AAED;;GAEG;AACH,oBAAY,SAAS;IACnB,UAAU,OAAO;IACjB,UAAU,OAAO;IACjB,UAAU,OAAO;IACjB,UAAU,OAAO;IACjB,WAAW,QAAQ;IACnB,WAAW,QAAQ;IACnB,UAAU,OAAO;IACjB,UAAU,OAAO;IACjB,OAAO,YAAY;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,EAUlC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ews-admin/global-design-system",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
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",
@@ -55,7 +55,14 @@ export const PhoneInput = React.forwardRef<HTMLInputElement, PhoneInputProps>(
55
55
  // when the user changes the dropdown without retyping the number.
56
56
  const el = nativeRef.current;
57
57
  if (el && onChange) {
58
- const numeric = formatNumeric(el.value);
58
+ let numeric = formatNumeric(el.value);
59
+ // Strip new country code digits if already present at the start
60
+ // (e.g. local part "221778384499" when switching to +221).
61
+ const newCodeDigits = formatNumeric(newCode);
62
+ if (newCodeDigits && numeric.startsWith(newCodeDigits)) {
63
+ numeric = numeric.slice(newCodeDigits.length);
64
+ el.value = numeric;
65
+ }
59
66
  const fullValue = numeric ? `${newCode}${numeric}` : "";
60
67
  // Pass the value string directly — RHF's Controller field.onChange
61
68
  // accepts raw values, avoiding unreliable fake-event parsing.
@@ -77,7 +84,14 @@ export const PhoneInput = React.forwardRef<HTMLInputElement, PhoneInputProps>(
77
84
 
78
85
  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
79
86
  // Enforce digits-only in the displayed field.
80
- const numeric = formatNumeric(e.target.value);
87
+ let numeric = formatNumeric(e.target.value);
88
+ // Strip country code digits if user typed or pasted the full number
89
+ // (e.g. typed "+221778384499" → formatNumeric gives "221778384499"
90
+ // which would produce "+221221778384499" without this guard).
91
+ const codeDigits = formatNumeric(activeCode);
92
+ if (codeDigits && numeric.startsWith(codeDigits)) {
93
+ numeric = numeric.slice(codeDigits.length);
94
+ }
81
95
  if (e.target.value !== numeric) {
82
96
  e.target.value = numeric;
83
97
  }
@@ -23,7 +23,7 @@ const LOCAL_PORTS = {
23
23
  bff: 8082,
24
24
  loginBff: 8080,
25
25
  app: 3000,
26
- login: 3001,
26
+ login: 4001,
27
27
  dashboard: 3002,
28
28
  admin: 3008,
29
29
  } as const;
@@ -70,7 +70,7 @@ function buildUrls(environment: Environment): Omit<EnvConfig, "env"> {
70
70
  */
71
71
  export function createEnvConfig(
72
72
  env: string,
73
- overrides?: EnvConfigOverrides
73
+ overrides?: EnvConfigOverrides,
74
74
  ): EnvConfig {
75
75
  const environment = (env || "local") as Environment;
76
76
  const derived = buildUrls(environment);