@ews-admin/global-design-system 1.12.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/Modal/Modal.d.ts +1 -1
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- 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.css +1 -1
- package/dist/index.d.ts +35 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +64 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +66 -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/Modal/Modal.tsx +25 -3
- 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":"","s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AAG,MAAM,EAC5B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,MAAM,CASR;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,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
|
@@ -39,7 +39,21 @@ export interface ModalProps {
|
|
|
39
39
|
/**
|
|
40
40
|
* Modal size/width
|
|
41
41
|
*/
|
|
42
|
-
size?:
|
|
42
|
+
size?:
|
|
43
|
+
| "sm"
|
|
44
|
+
| "md"
|
|
45
|
+
| "lg"
|
|
46
|
+
| "xl"
|
|
47
|
+
| "2xl"
|
|
48
|
+
| "3xl"
|
|
49
|
+
| "4xl"
|
|
50
|
+
| "5xl"
|
|
51
|
+
| "6xl"
|
|
52
|
+
| "7xl"
|
|
53
|
+
| "8xl"
|
|
54
|
+
| "9xl"
|
|
55
|
+
| "10xl"
|
|
56
|
+
| "full";
|
|
43
57
|
/**
|
|
44
58
|
* Primary action button text
|
|
45
59
|
*/
|
|
@@ -159,6 +173,14 @@ const Modal = ({
|
|
|
159
173
|
lg: "max-w-lg",
|
|
160
174
|
xl: "max-w-xl",
|
|
161
175
|
"2xl": "max-w-2xl",
|
|
176
|
+
"3xl": "max-w-3xl",
|
|
177
|
+
"4xl": "max-w-4xl",
|
|
178
|
+
"5xl": "max-w-5xl",
|
|
179
|
+
"6xl": "max-w-6xl",
|
|
180
|
+
"7xl": "max-w-7xl",
|
|
181
|
+
"8xl": "max-w-8xl",
|
|
182
|
+
"9xl": "max-w-9xl",
|
|
183
|
+
"10xl": "max-w-10xl",
|
|
162
184
|
full: "max-w-full",
|
|
163
185
|
};
|
|
164
186
|
return sizeMap[size] || sizeMap.md;
|
|
@@ -185,7 +207,7 @@ const Modal = ({
|
|
|
185
207
|
"duration-200 animate-in fade-in-0 zoom-in-95",
|
|
186
208
|
getSizeClasses(),
|
|
187
209
|
"mx-4",
|
|
188
|
-
className
|
|
210
|
+
className,
|
|
189
211
|
)}
|
|
190
212
|
role="dialog"
|
|
191
213
|
aria-modal="true"
|
|
@@ -195,7 +217,7 @@ const Modal = ({
|
|
|
195
217
|
<div
|
|
196
218
|
className={cn(
|
|
197
219
|
"flex items-center justify-between p-6 border-b",
|
|
198
|
-
variantStyles.borderColor
|
|
220
|
+
variantStyles.borderColor,
|
|
199
221
|
)}
|
|
200
222
|
>
|
|
201
223
|
<div className="flex items-center space-x-3">
|
|
@@ -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
|
+
}
|