@mobileaction/action-kit 1.54.5 → 1.55.0-beta.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/index.d.ts CHANGED
@@ -128,5 +128,6 @@ export { default as MaUpload } from './components/upload/index.vue';
128
128
  export * from './components/upload/types';
129
129
  export { default as MaWatchlistButton } from './components/watchlist-button/index.vue';
130
130
  export { useActionKitConfig } from './composables/config';
131
+ export { maCountry } from './lib/country/country';
131
132
  export { ActionKitConfig } from './services/config';
132
133
  export { SelectOptGroup as MaSelectOptGroup } from 'ant-design-vue';
@@ -0,0 +1,126 @@
1
+ interface Language {
2
+ code: string;
3
+ name: string;
4
+ flag: string;
5
+ }
6
+ interface CountryData {
7
+ name: string;
8
+ alpha2: string;
9
+ alpha3: string;
10
+ officialLanguageCode: string;
11
+ flag: string;
12
+ countryCallingCodes: string[];
13
+ currencies: string[];
14
+ languages: Language[];
15
+ }
16
+ interface CountryOption {
17
+ name: string;
18
+ code: string;
19
+ flag: string;
20
+ }
21
+ type SortType = 'asc' | 'desc';
22
+ type CountryCodeArray = CountryData['alpha2'][];
23
+ interface SortOptions {
24
+ topCountryCodes?: CountryCodeArray;
25
+ sortBy?: SortType;
26
+ countries?: CountryCodeArray | CountryData[];
27
+ }
28
+ interface CountryOptionsParams extends SortOptions {
29
+ countries: CountryCodeArray | CountryData[];
30
+ }
31
+ declare class Country {
32
+ private static readonly countriesData;
33
+ /**
34
+ * Find a country by its country code (alpha2 or alpha3)
35
+ * @param {string} code - Country code (alpha2 or alpha3)
36
+ * @returns {CountryData | undefined} Immutable country object
37
+ */
38
+ findCountryByCountryCode(code: string): CountryData | undefined;
39
+ /**
40
+ * Find countries by a list of country codes
41
+ * @param {string[]} countryCodeList - Array of country codes
42
+ * @returns {CountryData[]} Array of immutable country objects
43
+ */
44
+ findCountriesByCountryCodeList(countryCodeList: string[]): CountryData[];
45
+ /**
46
+ * Generic method to get a country property by country code
47
+ * @param {K} property - Property name to retrieve
48
+ * @param {string} code - Country code
49
+ * @returns {CountryData[K] | undefined} Property value
50
+ */
51
+ getCountryBy<K extends keyof CountryData>(property: K, code: string): CountryData[K] | undefined;
52
+ /**
53
+ * Get country name by country code
54
+ * @param {string} code - Country code
55
+ * @returns {string} Country name or code if not found
56
+ */
57
+ getCountryNameByCountryCode(code: string): string;
58
+ /**
59
+ * Find a country by any language code (not just official)
60
+ * @param {string} languageCode - Language code
61
+ * @returns {CountryData | undefined} Immutable country object
62
+ */
63
+ findCountryByLanguageCode(languageCode: string): CountryData | undefined;
64
+ /**
65
+ * Get country code by language code
66
+ * @param {string} languageCode - Language code
67
+ * @returns {string | undefined} Alpha2 country code
68
+ */
69
+ getCountryCodeByLanguageCode(languageCode: string): string | undefined;
70
+ /**
71
+ * Get all countries
72
+ * @returns {CountryData[]} Array of immutable country objects
73
+ */
74
+ getAllCountryList(): CountryData[];
75
+ /**
76
+ * Get sorted countries with optional top countries
77
+ * @param {SortOptions} options - Sorting options
78
+ * @returns {CountryData[]} Sorted array of country objects
79
+ */
80
+ getSortedCountries(options?: SortOptions): CountryData[];
81
+ /**
82
+ * Get sorted country codes
83
+ * @param {SortOptions} options - Same as getSortedCountries
84
+ * @returns {string[]} Array of alpha2 country codes
85
+ */
86
+ getSortedCountryCodes(options?: SortOptions): string[];
87
+ /**
88
+ * Find a Language object by language code.
89
+ * Iterates through all countries and their languages.
90
+ * @param {string} languageCode - Language code (e.g. 'en')
91
+ * @returns {Language | undefined} Immutable language object
92
+ */
93
+ findLanguageByLanguageCode(languageCode: string): Language | undefined;
94
+ /**
95
+ * Get the language name for a given country code.
96
+ * @param {string} countryCode - Country alpha2 or alpha3 code
97
+ * @returns {string} Language name or fallback value
98
+ */
99
+ findLanguageNameByCountryCode(countryCode: string): string;
100
+ /**
101
+ * Get official language code by country code
102
+ * @param {string} code - Country code
103
+ * @returns {string | undefined} Language code
104
+ */
105
+ getOfficialLanguageCodeByCountryCode(code: string): string | undefined;
106
+ /**
107
+ * Get country options for select components (sorted)
108
+ * @param {CountryOptionsParams | CountryData[] | CountryCodeArray} params - Countries with optional sort options
109
+ * @returns {CountryOption[]} Array of option objects
110
+ */
111
+ getCountryOptions(params: CountryOptionsParams | CountryData[] | CountryCodeArray): CountryOption[];
112
+ /**
113
+ * Get flag icon URL
114
+ * @param {string} alpha2 - Country code
115
+ * @param {'1x1' | '4x3'} ratio - Flag ratio
116
+ * @returns {string} Flag icon URL
117
+ */
118
+ getFlagIconUrl(alpha2: string, ratio?: '1x1' | '4x3'): string;
119
+ /**
120
+ * Get globe icon URL
121
+ * @returns {string} Globe icon URL
122
+ */
123
+ getGlobeIconUrl(): string;
124
+ }
125
+ export declare const maCountry: Country;
126
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import { g as tr } from "./index-DQXup9Ri.js";
1
+ import { g as tr } from "./index-B06mhYjm.js";
2
2
  function ir(ne, Ze) {
3
3
  for (var S = 0; S < Ze.length; S++) {
4
4
  const Y = Ze[S];
@@ -1,4 +1,4 @@
1
- import { g as it } from "./index-DQXup9Ri.js";
1
+ import { g as it } from "./index-B06mhYjm.js";
2
2
  function lt(O, B) {
3
3
  for (var m = 0; m < B.length; m++) {
4
4
  const x = B[m];
@@ -1,4 +1,4 @@
1
- import { g as fa } from "./index-DQXup9Ri.js";
1
+ import { g as fa } from "./index-B06mhYjm.js";
2
2
  function ma(Dt, ee) {
3
3
  for (var H = 0; H < ee.length; H++) {
4
4
  const et = ee[H];