@countriesdb/widget 0.1.5 → 0.1.7
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/follow-logic.js +14 -3
- package/dist/index.esm.js +82 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +82 -8
- package/dist/index.js.map +1 -1
- package/dist/initialization.d.ts +6 -0
- package/dist/initialization.js +2 -4
- package/package.json +1 -1
package/dist/initialization.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export declare function setupSubdivisionSelection(apiKey: string, backendUrl: st
|
|
|
19
19
|
* Update subdivision select with data for a specific country
|
|
20
20
|
*/
|
|
21
21
|
export declare function updateSubdivisionSelect(select: SelectElement, apiKey: string, backendUrl: string, state: WidgetState, config: {
|
|
22
|
+
followRelated: boolean;
|
|
23
|
+
followUpward: boolean;
|
|
22
24
|
showSubdivisionType: boolean;
|
|
23
25
|
allowParentSelection: boolean;
|
|
24
26
|
subdivisionRomanizationPreference?: string;
|
|
@@ -29,6 +31,8 @@ export declare function updateSubdivisionSelect(select: SelectElement, apiKey: s
|
|
|
29
31
|
* Update subdivisions for all linked subdivision selects when country changes
|
|
30
32
|
*/
|
|
31
33
|
export declare function updateSubdivisions(countrySelect: SelectElement, apiKey: string, backendUrl: string, state: WidgetState, config: {
|
|
34
|
+
followRelated: boolean;
|
|
35
|
+
followUpward: boolean;
|
|
32
36
|
showSubdivisionType: boolean;
|
|
33
37
|
allowParentSelection: boolean;
|
|
34
38
|
subdivisionRomanizationPreference?: string;
|
|
@@ -46,6 +50,8 @@ export declare function setupCountrySelection(apiKey: string, backendUrl: string
|
|
|
46
50
|
followUpward: boolean;
|
|
47
51
|
countryNameFilter?: (code: string, name: string, language: string, item: Country) => string | false | null | undefined;
|
|
48
52
|
}, subdivisionConfig: {
|
|
53
|
+
followRelated: boolean;
|
|
54
|
+
followUpward: boolean;
|
|
49
55
|
showSubdivisionType: boolean;
|
|
50
56
|
allowParentSelection: boolean;
|
|
51
57
|
subdivisionRomanizationPreference?: string;
|
package/dist/initialization.js
CHANGED
|
@@ -124,9 +124,7 @@ export async function updateSubdivisionSelect(select, apiKey, backendUrl, state,
|
|
|
124
124
|
reason: 'preselected',
|
|
125
125
|
});
|
|
126
126
|
valueSetByWidget = true;
|
|
127
|
-
await triggerFollowLogic(select, apiKey, backendUrl, state,
|
|
128
|
-
false, // followUpward - handled in event listeners
|
|
129
|
-
(s, key, code) => updateSubdivisionSelect(s, key, backendUrl, state, config, code));
|
|
127
|
+
await triggerFollowLogic(select, apiKey, backendUrl, state, config.followRelated, config.followUpward, (s, key, code) => updateSubdivisionSelect(s, key, backendUrl, state, config, code));
|
|
130
128
|
}
|
|
131
129
|
else {
|
|
132
130
|
// Try GeoIP preselect
|
|
@@ -150,7 +148,7 @@ export async function updateSubdivisionSelect(select, apiKey, backendUrl, state,
|
|
|
150
148
|
reason: 'geoip',
|
|
151
149
|
});
|
|
152
150
|
valueSetByWidget = true;
|
|
153
|
-
await triggerFollowLogic(select, apiKey, backendUrl, state,
|
|
151
|
+
await triggerFollowLogic(select, apiKey, backendUrl, state, config.followRelated, config.followUpward, (s, key, code) => updateSubdivisionSelect(s, key, backendUrl, state, config, code));
|
|
154
152
|
}
|
|
155
153
|
}
|
|
156
154
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@countriesdb/widget",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Country and state/province select widget with ISO 3166-1 and ISO 3166-2 codes. Auto-populates dropdowns with up-to-date country and subdivision data in multiple languages. Easy integration for forms, location selection, and address validation.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|