@ews-admin/global-design-system 1.5.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.
- package/dist/components/DropdownMultiSelect/DropdownMultiSelect.d.ts.map +1 -1
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/Logo/Logo.d.ts.map +1 -1
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/MultiSearchAutocomplete/MultiSearchAutocomplete.d.ts +1 -1
- package/dist/components/MultiSearchAutocomplete/MultiSearchAutocomplete.d.ts.map +1 -1
- package/dist/components/PhoneInput/PhoneInput.d.ts.map +1 -1
- package/dist/hooks/useSelectField.d.ts +1 -1
- package/dist/hooks/useSelectField.d.ts.map +1 -1
- package/dist/index.css +5 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.esm.css +5 -3
- package/dist/index.esm.js +141 -111
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +141 -111
- package/dist/index.js.map +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Input/Input.tsx +25 -0
- package/src/components/PhoneInput/PhoneInput.tsx +16 -2
- package/src/utils/env-config.ts +2 -2
|
@@ -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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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,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
|
@@ -98,6 +98,8 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
98
98
|
rightAddon,
|
|
99
99
|
id,
|
|
100
100
|
type = "text",
|
|
101
|
+
onChange,
|
|
102
|
+
onBlur,
|
|
101
103
|
...props
|
|
102
104
|
},
|
|
103
105
|
ref
|
|
@@ -112,6 +114,27 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
112
114
|
const shouldShowPasswordToggle = showPasswordToggle && isPasswordInput;
|
|
113
115
|
const actualType = isPasswordInput && showPassword ? "text" : type;
|
|
114
116
|
|
|
117
|
+
// Normalize spaces for text-like inputs
|
|
118
|
+
const shouldNormalize = type !== "password" && type !== "number" && type !== "checkbox";
|
|
119
|
+
|
|
120
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
121
|
+
if (shouldNormalize) {
|
|
122
|
+
e.target.value = e.target.value.replace(/^\s+/, "").replace(/\s{2,}/g, " ");
|
|
123
|
+
}
|
|
124
|
+
onChange?.(e);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {
|
|
128
|
+
if (shouldNormalize && onChange) {
|
|
129
|
+
const trimmed = e.target.value.replace(/\s+$/, "");
|
|
130
|
+
if (trimmed !== e.target.value) {
|
|
131
|
+
e.target.value = trimmed;
|
|
132
|
+
onChange(e as unknown as React.ChangeEvent<HTMLInputElement>);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
onBlur?.(e);
|
|
136
|
+
};
|
|
137
|
+
|
|
115
138
|
// Country code dropdown state
|
|
116
139
|
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|
117
140
|
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
@@ -313,6 +336,8 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
313
336
|
className
|
|
314
337
|
)}
|
|
315
338
|
ref={ref}
|
|
339
|
+
onChange={handleChange}
|
|
340
|
+
onBlur={handleBlur}
|
|
316
341
|
{...props}
|
|
317
342
|
/>
|
|
318
343
|
{rightAddon && !rightIcon && !shouldShowPasswordToggle && (
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
}
|
package/src/utils/env-config.ts
CHANGED
|
@@ -23,7 +23,7 @@ const LOCAL_PORTS = {
|
|
|
23
23
|
bff: 8082,
|
|
24
24
|
loginBff: 8080,
|
|
25
25
|
app: 3000,
|
|
26
|
-
login:
|
|
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);
|