@ews-admin/global-design-system 1.13.0 → 1.14.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/RegionSelect/RegionSelect.d.ts +15 -0
- package/dist/components/RegionSelect/RegionSelect.d.ts.map +1 -0
- package/dist/components/RegionSelect/index.d.ts +3 -0
- package/dist/components/RegionSelect/index.d.ts.map +1 -0
- package/dist/index.d.ts +34 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +56 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/locations.d.ts +17 -0
- package/dist/utils/locations.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/RegionSelect/RegionSelect.tsx +48 -0
- package/src/components/RegionSelect/index.ts +2 -0
- package/src/index.ts +6 -0
- package/src/utils/index.ts +6 -0
- package/src/utils/locations.ts +51 -0
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type ClassValue } from "clsx";
|
|
2
2
|
export { createEnvConfig } from "./env-config";
|
|
3
|
+
export { SupportedCountry, getRegionsByCountry, getRegionOptions, } from "./locations";
|
|
4
|
+
export type {} from "./locations";
|
|
3
5
|
export { COUNTRY_CODES, extractCountryCodeFromPhoneNumber, formatPhoneNumberWithCountryCode, getDefaultCountryCode, } from "./phone";
|
|
4
6
|
export type { CountryCodeOption, CountryCodeSelectProps } from "./phone";
|
|
5
7
|
export type { EnvConfig, EnvConfigOverrides, Environment, } from "./env-config";
|
|
@@ -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,CA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,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,GAAI,OAAO,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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare enum SupportedCountry {
|
|
2
|
+
SENEGAL = "SENEGAL",
|
|
3
|
+
CHAD = "CHAD"
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Returns the list of regions for a given country.
|
|
7
|
+
* Matching is case-insensitive; defaults to Senegal when country is unknown.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getRegionsByCountry(country: string): string[];
|
|
10
|
+
/**
|
|
11
|
+
* Returns regions as SelectOption-compatible objects { value, label }.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getRegionOptions(country: string): {
|
|
14
|
+
value: string;
|
|
15
|
+
label: string;
|
|
16
|
+
}[];
|
|
17
|
+
//# sourceMappingURL=locations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locations.d.ts","sourceRoot":"","sources":["../../src/utils/locations.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B,OAAO,YAAY;IACnB,IAAI,SAAS;CACd;AA8BD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAG7D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAKpF"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Select } from "../Select";
|
|
3
|
+
import { getRegionOptions, SupportedCountry } from "../../utils/locations";
|
|
4
|
+
|
|
5
|
+
export interface RegionSelectProps {
|
|
6
|
+
/** ISO country key (e.g. "SENEGAL", "CHAD") — case-insensitive */
|
|
7
|
+
country?: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
onChange?: (value: string) => void;
|
|
10
|
+
label?: string;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
error?: string;
|
|
13
|
+
isError?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
containerClassName?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function RegionSelect({
|
|
20
|
+
country = SupportedCountry.SENEGAL,
|
|
21
|
+
value,
|
|
22
|
+
onChange,
|
|
23
|
+
label,
|
|
24
|
+
placeholder = "Select a region",
|
|
25
|
+
error,
|
|
26
|
+
isError,
|
|
27
|
+
disabled,
|
|
28
|
+
required,
|
|
29
|
+
containerClassName,
|
|
30
|
+
}: RegionSelectProps) {
|
|
31
|
+
const options = getRegionOptions(country);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Select
|
|
35
|
+
options={options}
|
|
36
|
+
value={value}
|
|
37
|
+
onChange={(val) => onChange?.(val as string)}
|
|
38
|
+
label={label}
|
|
39
|
+
placeholder={placeholder}
|
|
40
|
+
error={error}
|
|
41
|
+
isError={isError}
|
|
42
|
+
disabled={disabled}
|
|
43
|
+
required={required}
|
|
44
|
+
searchable
|
|
45
|
+
containerClassName={containerClassName}
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -34,6 +34,9 @@ export type { ThemeToggleProps } from "./components/ThemeToggle";
|
|
|
34
34
|
export { ThemeDebugger } from "./components/ThemeDebugger";
|
|
35
35
|
export type { ThemeDebuggerProps } from "./components/ThemeDebugger";
|
|
36
36
|
|
|
37
|
+
export { RegionSelect } from "./components/RegionSelect";
|
|
38
|
+
export type { RegionSelectProps } from "./components/RegionSelect";
|
|
39
|
+
|
|
37
40
|
// Molecules
|
|
38
41
|
export { SpecialtySearchAutocomplete } from "./molecules";
|
|
39
42
|
export type { Specialty, SpecialtySearchAutocompleteProps } from "./molecules";
|
|
@@ -58,7 +61,10 @@ export {
|
|
|
58
61
|
formatPhoneNumberWithCountryCode,
|
|
59
62
|
generateId,
|
|
60
63
|
getDefaultCountryCode,
|
|
64
|
+
getRegionOptions,
|
|
65
|
+
getRegionsByCountry,
|
|
61
66
|
isValidPhoneNumber,
|
|
67
|
+
SupportedCountry,
|
|
62
68
|
} from "./utils";
|
|
63
69
|
export type {
|
|
64
70
|
CountryCodeOption,
|
package/src/utils/index.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { clsx, type ClassValue } from "clsx";
|
|
2
2
|
|
|
3
3
|
export { createEnvConfig } from "./env-config";
|
|
4
|
+
export {
|
|
5
|
+
SupportedCountry,
|
|
6
|
+
getRegionsByCountry,
|
|
7
|
+
getRegionOptions,
|
|
8
|
+
} from "./locations";
|
|
9
|
+
export type {} from "./locations";
|
|
4
10
|
export {
|
|
5
11
|
COUNTRY_CODES,
|
|
6
12
|
extractCountryCodeFromPhoneNumber,
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export enum SupportedCountry {
|
|
2
|
+
SENEGAL = "SENEGAL",
|
|
3
|
+
CHAD = "CHAD",
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const REGIONS_BY_COUNTRY: Record<string, string[]> = {
|
|
7
|
+
[SupportedCountry.SENEGAL]: [
|
|
8
|
+
"Dakar",
|
|
9
|
+
"Thiès",
|
|
10
|
+
"Saint-Louis",
|
|
11
|
+
"Louga",
|
|
12
|
+
"Fatick",
|
|
13
|
+
"Tambacounda",
|
|
14
|
+
"Kolda",
|
|
15
|
+
"Ziguinchor",
|
|
16
|
+
"Matam",
|
|
17
|
+
"Kédougou",
|
|
18
|
+
"Sédhiou",
|
|
19
|
+
"Diourbel",
|
|
20
|
+
],
|
|
21
|
+
[SupportedCountry.CHAD]: [
|
|
22
|
+
"N'Djamena",
|
|
23
|
+
"Moundou",
|
|
24
|
+
"Sarh",
|
|
25
|
+
"Abéché",
|
|
26
|
+
"Doba",
|
|
27
|
+
"Pala",
|
|
28
|
+
"Am Timan",
|
|
29
|
+
"Mongo",
|
|
30
|
+
"Faya-Largeau",
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Returns the list of regions for a given country.
|
|
36
|
+
* Matching is case-insensitive; defaults to Senegal when country is unknown.
|
|
37
|
+
*/
|
|
38
|
+
export function getRegionsByCountry(country: string): string[] {
|
|
39
|
+
const key = country?.toUpperCase();
|
|
40
|
+
return REGIONS_BY_COUNTRY[key] ?? REGIONS_BY_COUNTRY[SupportedCountry.SENEGAL];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Returns regions as SelectOption-compatible objects { value, label }.
|
|
45
|
+
*/
|
|
46
|
+
export function getRegionOptions(country: string): { value: string; label: string }[] {
|
|
47
|
+
return getRegionsByCountry(country).map((region) => ({
|
|
48
|
+
value: region,
|
|
49
|
+
label: region,
|
|
50
|
+
}));
|
|
51
|
+
}
|