vue3-flag-icons 0.0.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/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # vue3-flag-icons
2
+
3
+ A TypeScript-compatible Vue3 component library for providing flag icons.
4
+
5
+ ## Install
6
+
7
+ ```
8
+ npm install vue3-flag-icons
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ Firstly, you need to import the CSS. It is recommended that you do this at the app level, for example while creating and mounting your app:
14
+
15
+ > `main.ts`:
16
+
17
+ <pre>
18
+ import App from '@/App.vue'
19
+ import { createApp } from 'vue'
20
+ <b>import 'vue3-flag-icons/styles'</b>
21
+
22
+ createApp(App).mount('#app')
23
+ </pre>
24
+
25
+ but you could also just import the CSS whenever you import the component.
26
+
27
+ To use the component, just import it and use it:
28
+
29
+ > `App.vue`:
30
+
31
+ ```
32
+ <script setup lang="ts">
33
+ import FlagIcon from 'vue3-flag-icons'
34
+ </script>
35
+
36
+ <template>
37
+ <FlagIcon code="gr" />
38
+ <FlagIcon code="gb" :size="25" square />
39
+ <FlagIcon code="us" size="32" circle />
40
+ <FlagIcon code="fr" title="A flag icon" />
41
+ <FlagIcon code="es" :title="(country) => `Country: ${country}`" />
42
+ </template>
43
+ ```
44
+
45
+ <sub><sup>(Note: the component is the default export so you can name it however you want. Here we have used `FlagIcon`, but you could just as easily use `Flag` or `CountryFlag` or whatever you want - just be consistent with your naming for code clarity.)</sup></sub>
46
+
47
+ ## Props
48
+
49
+ The component takes the following props:
50
+
51
+ - `code: CountryCode`: the country code string, either lower or upper case, as available in the [`flag-icons`](https://github.com/lipis/flag-icons) package (a superset of the [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) codes).
52
+ - `size?: string | number`: the size (height) in px for the flag, defaults to the current `font-size`.
53
+ - `square?: boolean`: if true the flag will be rendered as a 1x1 square, otherwise it will be rendered as a 4x3.
54
+ - `circle?: boolean`: if true the flag will be rendered as a circle.
55
+ - `title?: string | ((country: string) => string)`: the mouseover tooltip of the icon, defaults to the name of the country.
56
+
57
+ ## Credits
58
+
59
+ - Inspired by [`vue-flag-icon`](https://github.com/vikkio88/vue-flag-icon/), a similar non-TypeScript-compatible Vue2 project.
60
+
61
+ - Uses the [`flag-icons`](https://github.com/lipis/flag-icons) package for all the flags.
@@ -0,0 +1,37 @@
1
+ import type { CountryCode } from '../types';
2
+ declare const _default: import("vue").DefineComponent<{
3
+ code: {
4
+ type: import("vue").PropType<CountryCode>;
5
+ required: true;
6
+ };
7
+ size: {
8
+ type: import("vue").PropType<string | number>;
9
+ };
10
+ square: {
11
+ type: import("vue").PropType<boolean>;
12
+ };
13
+ circle: {
14
+ type: import("vue").PropType<boolean>;
15
+ };
16
+ title: {
17
+ type: import("vue").PropType<string | ((country: string) => string)>;
18
+ };
19
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
20
+ code: {
21
+ type: import("vue").PropType<CountryCode>;
22
+ required: true;
23
+ };
24
+ size: {
25
+ type: import("vue").PropType<string | number>;
26
+ };
27
+ square: {
28
+ type: import("vue").PropType<boolean>;
29
+ };
30
+ circle: {
31
+ type: import("vue").PropType<boolean>;
32
+ };
33
+ title: {
34
+ type: import("vue").PropType<string | ((country: string) => string)>;
35
+ };
36
+ }>>, {}, {}>;
37
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export { default } from './components/FlagIcon.vue';
2
+ export type { CountryCode } from './types';