@mobilizehub/payload-plugin 0.6.2 → 0.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.
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Array of country options with ISO country codes and official names.
3
+ * Can be used to populate country select inputs on the frontend.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * import { countries } from '@mobilizehub/payload-plugin/helpers'
8
+ *
9
+ * <select>
10
+ * {countries.map((country) => (
11
+ * <option key={country.value} value={country.value}>
12
+ * {country.label}
13
+ * </option>
14
+ * ))}
15
+ * </select>
16
+ * ```
17
+ */
18
+ export declare const countries: {
19
+ label: string;
20
+ value: string;
21
+ }[];
22
+ export type Country = (typeof countries)[number];
@@ -0,0 +1,25 @@
1
+ import iso from 'i18n-iso-countries';
2
+ /**
3
+ * Array of country options with ISO country codes and official names.
4
+ * Can be used to populate country select inputs on the frontend.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * import { countries } from '@mobilizehub/payload-plugin/helpers'
9
+ *
10
+ * <select>
11
+ * {countries.map((country) => (
12
+ * <option key={country.value} value={country.value}>
13
+ * {country.label}
14
+ * </option>
15
+ * ))}
16
+ * </select>
17
+ * ```
18
+ */ export const countries = Object.entries(iso.getNames('en', {
19
+ select: 'official'
20
+ })).map(([code, name])=>({
21
+ label: name,
22
+ value: code
23
+ }));
24
+
25
+ //# sourceMappingURL=countries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/helpers/countries.ts"],"sourcesContent":["import iso from 'i18n-iso-countries'\n\n/**\n * Array of country options with ISO country codes and official names.\n * Can be used to populate country select inputs on the frontend.\n *\n * @example\n * ```tsx\n * import { countries } from '@mobilizehub/payload-plugin/helpers'\n *\n * <select>\n * {countries.map((country) => (\n * <option key={country.value} value={country.value}>\n * {country.label}\n * </option>\n * ))}\n * </select>\n * ```\n */\nexport const countries = Object.entries(iso.getNames('en', { select: 'official' })).map(\n ([code, name]) => ({\n label: name,\n value: code,\n }),\n)\n\nexport type Country = (typeof countries)[number]\n"],"names":["iso","countries","Object","entries","getNames","select","map","code","name","label","value"],"mappings":"AAAA,OAAOA,SAAS,qBAAoB;AAEpC;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,MAAMC,YAAYC,OAAOC,OAAO,CAACH,IAAII,QAAQ,CAAC,MAAM;IAAEC,QAAQ;AAAW,IAAIC,GAAG,CACrF,CAAC,CAACC,MAAMC,KAAK,GAAM,CAAA;QACjBC,OAAOD;QACPE,OAAOH;IACT,CAAA,GACD"}
@@ -0,0 +1 @@
1
+ export { countries, type Country } from './countries.js';
@@ -0,0 +1,3 @@
1
+ export { countries } from './countries.js';
2
+
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/helpers/index.ts"],"sourcesContent":["export { countries, type Country } from './countries.js'\n"],"names":["countries"],"mappings":"AAAA,SAASA,SAAS,QAAsB,iBAAgB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobilizehub/payload-plugin",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "description": "Edvocacy plugin for Payload",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -30,6 +30,11 @@
30
30
  "import": "./dist/adapters/index.js",
31
31
  "types": "./dist/adapters/index.d.ts",
32
32
  "default": "./dist/adapters/index.js"
33
+ },
34
+ "./helpers": {
35
+ "import": "./dist/helpers/index.js",
36
+ "types": "./dist/helpers/index.d.ts",
37
+ "default": "./dist/helpers/index.js"
33
38
  }
34
39
  },
35
40
  "main": "./dist/index.js",