@alikhalilll/a-tel-input 1.0.1
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/LICENSE +21 -0
- package/README.md +124 -0
- package/dist/index.cjs +5846 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +791 -0
- package/dist/index.d.ts +791 -0
- package/dist/index.js +5804 -0
- package/dist/index.js.map +1 -0
- package/dist/nuxt/index.cjs +30 -0
- package/dist/nuxt/index.cjs.map +1 -0
- package/dist/nuxt/index.d.cts +15 -0
- package/dist/nuxt/index.d.ts +15 -0
- package/dist/nuxt/index.js +30 -0
- package/dist/nuxt/index.js.map +1 -0
- package/dist/resolver/index.cjs +25 -0
- package/dist/resolver/index.cjs.map +1 -0
- package/dist/resolver/index.d.cts +14 -0
- package/dist/resolver/index.d.ts +14 -0
- package/dist/resolver/index.js +25 -0
- package/dist/resolver/index.js.map +1 -0
- package/dist/styles.css +520 -0
- package/package.json +123 -0
- package/src/components/ACountryFlag.vue +78 -0
- package/src/components/ACountrySelect.vue +674 -0
- package/src/components/ATelInput.vue +742 -0
- package/src/composables/useCountryDetection.ts +247 -0
- package/src/composables/useCountryMatching.ts +213 -0
- package/src/composables/usePhoneValidation.ts +573 -0
- package/src/composables/useTelInputValidation.ts +136 -0
- package/src/composables/useTypingPhase.ts +88 -0
- package/src/icons/AlertCircleIcon.vue +17 -0
- package/src/icons/CheckCircleIcon.vue +16 -0
- package/src/icons/CheckIcon.vue +15 -0
- package/src/icons/ChevronDownIcon.vue +15 -0
- package/src/icons/SearchIcon.vue +16 -0
- package/src/icons/SpinnerIcon.vue +28 -0
- package/src/icons/index.ts +6 -0
- package/src/index.ts +36 -0
- package/src/nuxt/index.ts +37 -0
- package/src/resolver/index.ts +29 -0
- package/src/types.ts +389 -0
- package/src/utils/digits.ts +42 -0
- package/src/utils/flag-url.ts +10 -0
- package/web-types.json +526 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
let _nuxt_kit = require("@nuxt/kit");
|
|
2
|
+
//#region src/nuxt/index.ts
|
|
3
|
+
const COMPONENTS = {
|
|
4
|
+
ATelInput: "@alikhalilll/a-tel-input",
|
|
5
|
+
ACountrySelect: "@alikhalilll/a-tel-input",
|
|
6
|
+
ACountryFlag: "@alikhalilll/a-tel-input"
|
|
7
|
+
};
|
|
8
|
+
const module$1 = (0, _nuxt_kit.defineNuxtModule)({
|
|
9
|
+
meta: {
|
|
10
|
+
name: "@alikhalilll/a-tel-input",
|
|
11
|
+
configKey: "aTelInput",
|
|
12
|
+
compatibility: { nuxt: ">=3.0.0" }
|
|
13
|
+
},
|
|
14
|
+
defaults: { prefix: "" },
|
|
15
|
+
setup(opts) {
|
|
16
|
+
const prefix = opts.prefix ?? "";
|
|
17
|
+
for (const [exportName, from] of Object.entries(COMPONENTS)) {
|
|
18
|
+
const baseName = exportName.startsWith("A") ? exportName.slice(1) : exportName;
|
|
19
|
+
(0, _nuxt_kit.addComponent)({
|
|
20
|
+
name: `${prefix}${prefix ? baseName : exportName}`,
|
|
21
|
+
export: exportName,
|
|
22
|
+
filePath: from
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
//#endregion
|
|
28
|
+
module.exports = module$1;
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["module"],"sources":["../../src/nuxt/index.ts"],"sourcesContent":["import { defineNuxtModule, addComponent } from '@nuxt/kit';\nimport type { NuxtModule } from '@nuxt/schema';\n\n/**\n * `@alikhalilll/a-tel-input/nuxt` — registers the tel-input components for Nuxt\n * auto-import. The country picker renders a-popover/a-drawer, so also import\n * their stylesheets plus a-ui-base tokens and a-tel-input styles.\n */\n\nexport interface ModuleOptions {\n prefix?: string;\n}\n\nconst COMPONENTS: Record<string, string> = {\n ATelInput: '@alikhalilll/a-tel-input',\n ACountrySelect: '@alikhalilll/a-tel-input',\n ACountryFlag: '@alikhalilll/a-tel-input',\n};\n\nconst module: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@alikhalilll/a-tel-input',\n configKey: 'aTelInput',\n compatibility: { nuxt: '>=3.0.0' },\n },\n defaults: { prefix: '' },\n setup(opts) {\n const prefix = opts.prefix ?? '';\n for (const [exportName, from] of Object.entries(COMPONENTS)) {\n const baseName = exportName.startsWith('A') ? exportName.slice(1) : exportName;\n const registeredName = `${prefix}${prefix ? baseName : exportName}`;\n addComponent({ name: registeredName, export: exportName, filePath: from });\n }\n },\n});\n\nexport default module;\n"],"mappings":";;AAaA,MAAM,aAAqC;CACzC,WAAW;CACX,gBAAgB;CAChB,cAAc;AAChB;AAEA,MAAMA,YAAAA,GAAAA,UAAAA,kBAAoE;CACxE,MAAM;EACJ,MAAM;EACN,WAAW;EACX,eAAe,EAAE,MAAM,UAAU;CACnC;CACA,UAAU,EAAE,QAAQ,GAAG;CACvB,MAAM,MAAM;EACV,MAAM,SAAS,KAAK,UAAU;EAC9B,KAAK,MAAM,CAAC,YAAY,SAAS,OAAO,QAAQ,UAAU,GAAG;GAC3D,MAAM,WAAW,WAAW,WAAW,GAAG,IAAI,WAAW,MAAM,CAAC,IAAI;GAEpE,CAAA,GAAA,UAAA,cAAa;IAAE,MAAM,GADK,SAAS,SAAS,WAAW;IAClB,QAAQ;IAAY,UAAU;GAAK,CAAC;EAC3E;CACF;AACF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NuxtModule } from "@nuxt/schema";
|
|
2
|
+
|
|
3
|
+
//#region src/nuxt/index.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* `@alikhalilll/a-tel-input/nuxt` — registers the tel-input components for Nuxt
|
|
6
|
+
* auto-import. The country picker renders a-popover/a-drawer, so also import
|
|
7
|
+
* their stylesheets plus a-ui-base tokens and a-tel-input styles.
|
|
8
|
+
*/
|
|
9
|
+
interface ModuleOptions {
|
|
10
|
+
prefix?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const module: NuxtModule<ModuleOptions>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { ModuleOptions, module as default };
|
|
15
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NuxtModule } from "@nuxt/schema";
|
|
2
|
+
|
|
3
|
+
//#region src/nuxt/index.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* `@alikhalilll/a-tel-input/nuxt` — registers the tel-input components for Nuxt
|
|
6
|
+
* auto-import. The country picker renders a-popover/a-drawer, so also import
|
|
7
|
+
* their stylesheets plus a-ui-base tokens and a-tel-input styles.
|
|
8
|
+
*/
|
|
9
|
+
interface ModuleOptions {
|
|
10
|
+
prefix?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const module: NuxtModule<ModuleOptions>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { ModuleOptions, module as default };
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { addComponent, defineNuxtModule } from "@nuxt/kit";
|
|
2
|
+
//#region src/nuxt/index.ts
|
|
3
|
+
const COMPONENTS = {
|
|
4
|
+
ATelInput: "@alikhalilll/a-tel-input",
|
|
5
|
+
ACountrySelect: "@alikhalilll/a-tel-input",
|
|
6
|
+
ACountryFlag: "@alikhalilll/a-tel-input"
|
|
7
|
+
};
|
|
8
|
+
const module = defineNuxtModule({
|
|
9
|
+
meta: {
|
|
10
|
+
name: "@alikhalilll/a-tel-input",
|
|
11
|
+
configKey: "aTelInput",
|
|
12
|
+
compatibility: { nuxt: ">=3.0.0" }
|
|
13
|
+
},
|
|
14
|
+
defaults: { prefix: "" },
|
|
15
|
+
setup(opts) {
|
|
16
|
+
const prefix = opts.prefix ?? "";
|
|
17
|
+
for (const [exportName, from] of Object.entries(COMPONENTS)) {
|
|
18
|
+
const baseName = exportName.startsWith("A") ? exportName.slice(1) : exportName;
|
|
19
|
+
addComponent({
|
|
20
|
+
name: `${prefix}${prefix ? baseName : exportName}`,
|
|
21
|
+
export: exportName,
|
|
22
|
+
filePath: from
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
//#endregion
|
|
28
|
+
export { module as default };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/nuxt/index.ts"],"sourcesContent":["import { defineNuxtModule, addComponent } from '@nuxt/kit';\nimport type { NuxtModule } from '@nuxt/schema';\n\n/**\n * `@alikhalilll/a-tel-input/nuxt` — registers the tel-input components for Nuxt\n * auto-import. The country picker renders a-popover/a-drawer, so also import\n * their stylesheets plus a-ui-base tokens and a-tel-input styles.\n */\n\nexport interface ModuleOptions {\n prefix?: string;\n}\n\nconst COMPONENTS: Record<string, string> = {\n ATelInput: '@alikhalilll/a-tel-input',\n ACountrySelect: '@alikhalilll/a-tel-input',\n ACountryFlag: '@alikhalilll/a-tel-input',\n};\n\nconst module: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@alikhalilll/a-tel-input',\n configKey: 'aTelInput',\n compatibility: { nuxt: '>=3.0.0' },\n },\n defaults: { prefix: '' },\n setup(opts) {\n const prefix = opts.prefix ?? '';\n for (const [exportName, from] of Object.entries(COMPONENTS)) {\n const baseName = exportName.startsWith('A') ? exportName.slice(1) : exportName;\n const registeredName = `${prefix}${prefix ? baseName : exportName}`;\n addComponent({ name: registeredName, export: exportName, filePath: from });\n }\n },\n});\n\nexport default module;\n"],"mappings":";;AAaA,MAAM,aAAqC;CACzC,WAAW;CACX,gBAAgB;CAChB,cAAc;AAChB;AAEA,MAAM,SAAoC,iBAAgC;CACxE,MAAM;EACJ,MAAM;EACN,WAAW;EACX,eAAe,EAAE,MAAM,UAAU;CACnC;CACA,UAAU,EAAE,QAAQ,GAAG;CACvB,MAAM,MAAM;EACV,MAAM,SAAS,KAAK,UAAU;EAC9B,KAAK,MAAM,CAAC,YAAY,SAAS,OAAO,QAAQ,UAAU,GAAG;GAC3D,MAAM,WAAW,WAAW,WAAW,GAAG,IAAI,WAAW,MAAM,CAAC,IAAI;GAEpE,aAAa;IAAE,MAAM,GADK,SAAS,SAAS,WAAW;IAClB,QAAQ;IAAY,UAAU;GAAK,CAAC;EAC3E;CACF;AACF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/resolver/index.ts
|
|
2
|
+
const COMPONENT_TO_ENTRY = {
|
|
3
|
+
ATelInput: "@alikhalilll/a-tel-input",
|
|
4
|
+
ACountrySelect: "@alikhalilll/a-tel-input",
|
|
5
|
+
ACountryFlag: "@alikhalilll/a-tel-input"
|
|
6
|
+
};
|
|
7
|
+
function ATelInputResolver(opts = {}) {
|
|
8
|
+
const prefix = opts.prefix ?? "";
|
|
9
|
+
return {
|
|
10
|
+
type: "component",
|
|
11
|
+
resolve(name) {
|
|
12
|
+
const bare = prefix && name.startsWith(prefix) ? name.slice(prefix.length) : name;
|
|
13
|
+
const from = COMPONENT_TO_ENTRY[bare];
|
|
14
|
+
if (!from) return;
|
|
15
|
+
return {
|
|
16
|
+
name: bare,
|
|
17
|
+
from
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
module.exports = ATelInputResolver;
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/resolver/index.ts"],"sourcesContent":["import type { ComponentResolver } from 'unplugin-vue-components';\n\n/**\n * `@alikhalilll/a-tel-input/resolver` — auto-import resolver for non-Nuxt\n * Vite/Webpack consumers via `unplugin-vue-components`.\n */\n\nexport interface ResolverOptions {\n prefix?: string;\n}\n\nconst COMPONENT_TO_ENTRY: Record<string, string> = {\n ATelInput: '@alikhalilll/a-tel-input',\n ACountrySelect: '@alikhalilll/a-tel-input',\n ACountryFlag: '@alikhalilll/a-tel-input',\n};\n\nexport default function ATelInputResolver(opts: ResolverOptions = {}): ComponentResolver {\n const prefix = opts.prefix ?? '';\n return {\n type: 'component',\n resolve(name) {\n const bare = prefix && name.startsWith(prefix) ? name.slice(prefix.length) : name;\n const from = COMPONENT_TO_ENTRY[bare];\n if (!from) return;\n return { name: bare, from };\n },\n };\n}\n"],"mappings":";AAWA,MAAM,qBAA6C;CACjD,WAAW;CACX,gBAAgB;CAChB,cAAc;AAChB;AAEA,SAAwB,kBAAkB,OAAwB,CAAC,GAAsB;CACvF,MAAM,SAAS,KAAK,UAAU;CAC9B,OAAO;EACL,MAAM;EACN,QAAQ,MAAM;GACZ,MAAM,OAAO,UAAU,KAAK,WAAW,MAAM,IAAI,KAAK,MAAM,OAAO,MAAM,IAAI;GAC7E,MAAM,OAAO,mBAAmB;GAChC,IAAI,CAAC,MAAM;GACX,OAAO;IAAE,MAAM;IAAM;GAAK;EAC5B;CACF;AACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentResolver } from "unplugin-vue-components";
|
|
2
|
+
|
|
3
|
+
//#region src/resolver/index.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* `@alikhalilll/a-tel-input/resolver` — auto-import resolver for non-Nuxt
|
|
6
|
+
* Vite/Webpack consumers via `unplugin-vue-components`.
|
|
7
|
+
*/
|
|
8
|
+
interface ResolverOptions {
|
|
9
|
+
prefix?: string;
|
|
10
|
+
}
|
|
11
|
+
declare function ATelInputResolver(opts?: ResolverOptions): ComponentResolver;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ResolverOptions, ATelInputResolver as default };
|
|
14
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentResolver } from "unplugin-vue-components";
|
|
2
|
+
|
|
3
|
+
//#region src/resolver/index.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* `@alikhalilll/a-tel-input/resolver` — auto-import resolver for non-Nuxt
|
|
6
|
+
* Vite/Webpack consumers via `unplugin-vue-components`.
|
|
7
|
+
*/
|
|
8
|
+
interface ResolverOptions {
|
|
9
|
+
prefix?: string;
|
|
10
|
+
}
|
|
11
|
+
declare function ATelInputResolver(opts?: ResolverOptions): ComponentResolver;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ResolverOptions, ATelInputResolver as default };
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/resolver/index.ts
|
|
2
|
+
const COMPONENT_TO_ENTRY = {
|
|
3
|
+
ATelInput: "@alikhalilll/a-tel-input",
|
|
4
|
+
ACountrySelect: "@alikhalilll/a-tel-input",
|
|
5
|
+
ACountryFlag: "@alikhalilll/a-tel-input"
|
|
6
|
+
};
|
|
7
|
+
function ATelInputResolver(opts = {}) {
|
|
8
|
+
const prefix = opts.prefix ?? "";
|
|
9
|
+
return {
|
|
10
|
+
type: "component",
|
|
11
|
+
resolve(name) {
|
|
12
|
+
const bare = prefix && name.startsWith(prefix) ? name.slice(prefix.length) : name;
|
|
13
|
+
const from = COMPONENT_TO_ENTRY[bare];
|
|
14
|
+
if (!from) return;
|
|
15
|
+
return {
|
|
16
|
+
name: bare,
|
|
17
|
+
from
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { ATelInputResolver as default };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/resolver/index.ts"],"sourcesContent":["import type { ComponentResolver } from 'unplugin-vue-components';\n\n/**\n * `@alikhalilll/a-tel-input/resolver` — auto-import resolver for non-Nuxt\n * Vite/Webpack consumers via `unplugin-vue-components`.\n */\n\nexport interface ResolverOptions {\n prefix?: string;\n}\n\nconst COMPONENT_TO_ENTRY: Record<string, string> = {\n ATelInput: '@alikhalilll/a-tel-input',\n ACountrySelect: '@alikhalilll/a-tel-input',\n ACountryFlag: '@alikhalilll/a-tel-input',\n};\n\nexport default function ATelInputResolver(opts: ResolverOptions = {}): ComponentResolver {\n const prefix = opts.prefix ?? '';\n return {\n type: 'component',\n resolve(name) {\n const bare = prefix && name.startsWith(prefix) ? name.slice(prefix.length) : name;\n const from = COMPONENT_TO_ENTRY[bare];\n if (!from) return;\n return { name: bare, from };\n },\n };\n}\n"],"mappings":";AAWA,MAAM,qBAA6C;CACjD,WAAW;CACX,gBAAgB;CAChB,cAAc;AAChB;AAEA,SAAwB,kBAAkB,OAAwB,CAAC,GAAsB;CACvF,MAAM,SAAS,KAAK,UAAU;CAC9B,OAAO;EACL,MAAM;EACN,QAAQ,MAAM;GACZ,MAAM,OAAO,UAAU,KAAK,WAAW,MAAM,IAAI,KAAK,MAAM,OAAO,MAAM,IAAI;GAC7E,MAAM,OAAO,mBAAmB;GAChC,IAAI,CAAC,MAAM;GACX,OAAO;IAAE,MAAM;IAAM;GAAK;EAC5B;CACF;AACF"}
|