@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
package/dist/styles.css
ADDED
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}:root,.light{--ak-ui-background:0 0% 100%;--ak-ui-foreground:240 10% 3.9%;--ak-ui-card:0 0% 100%;--ak-ui-card-foreground:240 10% 3.9%;--ak-ui-popover:0 0% 100%;--ak-ui-popover-foreground:240 10% 3.9%;--ak-ui-primary:240 5.9% 10%;--ak-ui-primary-foreground:0 0% 98%;--ak-ui-secondary:240 4.8% 95.9%;--ak-ui-secondary-foreground:240 5.9% 10%;--ak-ui-muted:240 4.8% 95.9%;--ak-ui-muted-foreground:240 3.8% 46.1%;--ak-ui-accent:240 4.8% 95.9%;--ak-ui-accent-foreground:240 5.9% 10%;--ak-ui-destructive:0 84.2% 60.2%;--ak-ui-destructive-foreground:0 0% 98%;--ak-ui-border:240 5.9% 90%;--ak-ui-input:240 5.9% 90%;--ak-ui-ring:240 5.9% 10%;--ak-ui-radius:.5rem}.dark{--ak-ui-background:240 10% 3.9%;--ak-ui-foreground:0 0% 98%;--ak-ui-card:240 10% 3.9%;--ak-ui-card-foreground:0 0% 98%;--ak-ui-popover:240 10% 3.9%;--ak-ui-popover-foreground:0 0% 98%;--ak-ui-primary:0 0% 98%;--ak-ui-primary-foreground:240 5.9% 10%;--ak-ui-secondary:240 3.7% 15.9%;--ak-ui-secondary-foreground:0 0% 98%;--ak-ui-muted:240 3.7% 15.9%;--ak-ui-muted-foreground:240 5% 64.9%;--ak-ui-accent:240 3.7% 15.9%;--ak-ui-accent-foreground:0 0% 98%;--ak-ui-destructive:0 62.8% 30.6%;--ak-ui-destructive-foreground:0 0% 98%;--ak-ui-border:240 3.7% 15.9%;--ak-ui-input:240 3.7% 15.9%;--ak-ui-ring:240 4.9% 83.9%}:root,:host{--spacing:.25rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}.collapse{visibility:collapse}.visible{visibility:visible}.block{display:block}.flex{display:flex}.hidden{display:none}.table{display:table}.flex-shrink{flex-shrink:1}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.border{border-style:var(--tw-border-style);border-width:1px}.ps-1{padding-inline-start:calc(var(--spacing) * 1)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}
|
|
3
|
+
/* --- bundled SFC styles --- */
|
|
4
|
+
|
|
5
|
+
.a-country-flag[data-v-705c2224] {
|
|
6
|
+
display: inline-block;
|
|
7
|
+
width: 1.5rem;
|
|
8
|
+
height: 1rem;
|
|
9
|
+
border-radius: 0.125rem;
|
|
10
|
+
object-fit: cover;
|
|
11
|
+
box-shadow: 0 0 0 1px hsl(var(--ak-ui-border) / 0.4);
|
|
12
|
+
}
|
|
13
|
+
.a-country-flag--fallback[data-v-705c2224] {
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
background: hsl(var(--ak-ui-muted));
|
|
18
|
+
color: hsl(var(--ak-ui-muted-foreground));
|
|
19
|
+
font-size: 8px;
|
|
20
|
+
font-weight: 600;
|
|
21
|
+
line-height: 1;
|
|
22
|
+
letter-spacing: -0.025em;
|
|
23
|
+
}
|
|
24
|
+
.a-country-flag--empty[data-v-705c2224] {
|
|
25
|
+
background: hsl(var(--ak-ui-muted));
|
|
26
|
+
box-shadow: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@keyframes a-tel-input-icon-spin {
|
|
30
|
+
to {
|
|
31
|
+
transform: rotate(360deg);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
.a-tel-input-icon-spinner {
|
|
35
|
+
animation: a-tel-input-icon-spin 1s linear infinite;
|
|
36
|
+
transform-origin: center;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* ------------------------------------------------------------
|
|
40
|
+
* In-tree (non-teleported) styles — only the trigger button.
|
|
41
|
+
* ---------------------------------------------------------- */
|
|
42
|
+
.a-country-select__trigger[data-v-65efc7ac] {
|
|
43
|
+
display: inline-flex;
|
|
44
|
+
height: 100%;
|
|
45
|
+
flex-shrink: 0;
|
|
46
|
+
align-items: center;
|
|
47
|
+
gap: 0.375rem;
|
|
48
|
+
background: transparent;
|
|
49
|
+
border: 0;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
transition: background-color 150ms;
|
|
52
|
+
outline: none;
|
|
53
|
+
color: inherit;
|
|
54
|
+
font: inherit;
|
|
55
|
+
}
|
|
56
|
+
.a-country-select__trigger[data-v-65efc7ac]:hover,
|
|
57
|
+
.a-country-select__trigger[data-v-65efc7ac]:focus-visible,
|
|
58
|
+
.a-country-select__trigger[data-state='open'][data-v-65efc7ac] {
|
|
59
|
+
background: hsl(var(--ak-ui-muted));
|
|
60
|
+
}
|
|
61
|
+
.a-country-select__trigger[data-v-65efc7ac]:focus-visible {
|
|
62
|
+
box-shadow: inset 0 0 0 1px hsl(var(--ak-ui-ring));
|
|
63
|
+
}
|
|
64
|
+
.a-country-select__trigger[data-v-65efc7ac]:disabled {
|
|
65
|
+
cursor: not-allowed;
|
|
66
|
+
opacity: 0.5;
|
|
67
|
+
}
|
|
68
|
+
.a-country-select__trigger[data-size='xs'][data-v-65efc7ac] {
|
|
69
|
+
padding: 0 0.5rem;
|
|
70
|
+
font-size: 0.75rem;
|
|
71
|
+
}
|
|
72
|
+
.a-country-select__trigger[data-size='sm'][data-v-65efc7ac] {
|
|
73
|
+
padding: 0 0.625rem;
|
|
74
|
+
font-size: 0.875rem;
|
|
75
|
+
}
|
|
76
|
+
.a-country-select__trigger[data-size='md'][data-v-65efc7ac] {
|
|
77
|
+
padding: 0 0.75rem;
|
|
78
|
+
font-size: 0.875rem;
|
|
79
|
+
}
|
|
80
|
+
.a-country-select__trigger[data-size='lg'][data-v-65efc7ac] {
|
|
81
|
+
padding: 0 0.875rem;
|
|
82
|
+
font-size: 1rem;
|
|
83
|
+
}
|
|
84
|
+
.a-country-select__trigger[data-size='xl'][data-v-65efc7ac] {
|
|
85
|
+
padding: 0 1rem;
|
|
86
|
+
font-size: 1rem;
|
|
87
|
+
}
|
|
88
|
+
.a-country-select__chevron[data-v-65efc7ac] {
|
|
89
|
+
width: 0.875rem;
|
|
90
|
+
height: 0.875rem;
|
|
91
|
+
flex-shrink: 0;
|
|
92
|
+
color: hsl(var(--ak-ui-muted-foreground));
|
|
93
|
+
transition: transform 200ms;
|
|
94
|
+
}
|
|
95
|
+
.a-country-select__chevron[data-open][data-v-65efc7ac] {
|
|
96
|
+
transform: rotate(180deg);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.a-country-select__content {
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: column;
|
|
102
|
+
overflow: hidden;
|
|
103
|
+
padding: 0;
|
|
104
|
+
}
|
|
105
|
+
.a-country-select__popover {
|
|
106
|
+
width: min(20rem, calc(100vw - 2rem));
|
|
107
|
+
max-height: min(22rem, var(--reka-popover-content-available-height));
|
|
108
|
+
}
|
|
109
|
+
.a-country-select__drawer {
|
|
110
|
+
max-height: 80vh;
|
|
111
|
+
padding-bottom: 1rem;
|
|
112
|
+
}
|
|
113
|
+
.a-country-select__search {
|
|
114
|
+
border-bottom: 1px solid hsl(var(--ak-ui-border) / 0.7);
|
|
115
|
+
padding: 0.375rem;
|
|
116
|
+
}
|
|
117
|
+
.a-country-select__search-box {
|
|
118
|
+
position: relative;
|
|
119
|
+
display: flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
background: hsl(var(--ak-ui-muted) / 0.4);
|
|
122
|
+
border-radius: calc(var(--ak-ui-radius) - 2px);
|
|
123
|
+
box-shadow: 0 0 0 1px hsl(var(--ak-ui-border) / 0.7);
|
|
124
|
+
transition: box-shadow 150ms;
|
|
125
|
+
}
|
|
126
|
+
.a-country-select__search-box:focus-within {
|
|
127
|
+
box-shadow: 0 0 0 1px hsl(var(--ak-ui-ring) / 0.5);
|
|
128
|
+
}
|
|
129
|
+
.a-country-select__search-icon {
|
|
130
|
+
position: absolute;
|
|
131
|
+
top: 50%;
|
|
132
|
+
inset-inline-start: 0.625rem;
|
|
133
|
+
width: 0.875rem;
|
|
134
|
+
height: 0.875rem;
|
|
135
|
+
transform: translateY(-50%);
|
|
136
|
+
color: hsl(var(--ak-ui-muted-foreground));
|
|
137
|
+
pointer-events: none;
|
|
138
|
+
}
|
|
139
|
+
.a-country-select__search-input {
|
|
140
|
+
height: 2.5rem;
|
|
141
|
+
width: 100%;
|
|
142
|
+
background: transparent;
|
|
143
|
+
border: 0;
|
|
144
|
+
padding-inline-start: 2rem;
|
|
145
|
+
padding-inline-end: 3.5rem;
|
|
146
|
+
font-size: 0.875rem;
|
|
147
|
+
outline: none;
|
|
148
|
+
color: inherit;
|
|
149
|
+
font-family: inherit;
|
|
150
|
+
}
|
|
151
|
+
.a-country-select__search-input::placeholder {
|
|
152
|
+
color: hsl(var(--ak-ui-muted-foreground));
|
|
153
|
+
}
|
|
154
|
+
.a-country-select__kbd {
|
|
155
|
+
position: absolute;
|
|
156
|
+
top: 50%;
|
|
157
|
+
inset-inline-end: 0.5rem;
|
|
158
|
+
display: none;
|
|
159
|
+
align-items: center;
|
|
160
|
+
gap: 0.125rem;
|
|
161
|
+
background: hsl(var(--ak-ui-background));
|
|
162
|
+
color: hsl(var(--ak-ui-muted-foreground));
|
|
163
|
+
border: 1px solid hsl(var(--ak-ui-border));
|
|
164
|
+
border-radius: 0.25rem;
|
|
165
|
+
padding: 0.125rem 0.375rem;
|
|
166
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
167
|
+
font-size: 10px;
|
|
168
|
+
letter-spacing: -0.025em;
|
|
169
|
+
transform: translateY(-50%);
|
|
170
|
+
}
|
|
171
|
+
@media (min-width: 768px) {
|
|
172
|
+
.a-country-select__kbd--open {
|
|
173
|
+
display: inline-flex;
|
|
174
|
+
}
|
|
175
|
+
.a-country-select__kbd--close {
|
|
176
|
+
display: inline-block;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
.a-country-select__list {
|
|
180
|
+
flex: 1;
|
|
181
|
+
overflow-y: auto;
|
|
182
|
+
/* Themed scrollbar — Firefox + WebKit/Blink. Resolves the browser-default
|
|
183
|
+
light-grey scrollbar that didn't match the popover surface in dark mode. */
|
|
184
|
+
scrollbar-width: thin;
|
|
185
|
+
scrollbar-color: hsl(var(--ak-ui-muted-foreground) / 0.4) transparent;
|
|
186
|
+
}
|
|
187
|
+
.a-country-select__list::-webkit-scrollbar {
|
|
188
|
+
width: 8px;
|
|
189
|
+
height: 8px;
|
|
190
|
+
}
|
|
191
|
+
.a-country-select__list::-webkit-scrollbar-track {
|
|
192
|
+
background: transparent;
|
|
193
|
+
}
|
|
194
|
+
.a-country-select__list::-webkit-scrollbar-thumb {
|
|
195
|
+
background-color: hsl(var(--ak-ui-muted-foreground) / 0.4);
|
|
196
|
+
border-radius: 4px;
|
|
197
|
+
}
|
|
198
|
+
.a-country-select__list::-webkit-scrollbar-thumb:hover {
|
|
199
|
+
background-color: hsl(var(--ak-ui-muted-foreground) / 0.6);
|
|
200
|
+
}
|
|
201
|
+
.a-country-select__loading,
|
|
202
|
+
.a-country-select__empty {
|
|
203
|
+
color: hsl(var(--ak-ui-muted-foreground));
|
|
204
|
+
padding: 1rem;
|
|
205
|
+
text-align: center;
|
|
206
|
+
font-size: 0.875rem;
|
|
207
|
+
}
|
|
208
|
+
.a-country-select__group-header {
|
|
209
|
+
position: sticky;
|
|
210
|
+
top: 0;
|
|
211
|
+
z-index: 10;
|
|
212
|
+
background: hsl(var(--ak-ui-popover));
|
|
213
|
+
color: hsl(var(--ak-ui-muted-foreground));
|
|
214
|
+
padding: 0.375rem 0.75rem;
|
|
215
|
+
font-size: 10px;
|
|
216
|
+
font-weight: 500;
|
|
217
|
+
letter-spacing: 0.05em;
|
|
218
|
+
text-transform: uppercase;
|
|
219
|
+
margin: 0;
|
|
220
|
+
}
|
|
221
|
+
.a-country-select__group-list {
|
|
222
|
+
list-style: none;
|
|
223
|
+
margin: 0;
|
|
224
|
+
padding: 0 0 0.25rem;
|
|
225
|
+
}
|
|
226
|
+
.a-country-select__item {
|
|
227
|
+
display: flex;
|
|
228
|
+
width: 100%;
|
|
229
|
+
align-items: center;
|
|
230
|
+
gap: 0.75rem;
|
|
231
|
+
padding: 0.5rem 0.75rem;
|
|
232
|
+
text-align: start;
|
|
233
|
+
font-size: 0.875rem;
|
|
234
|
+
background: transparent;
|
|
235
|
+
border: 0;
|
|
236
|
+
cursor: pointer;
|
|
237
|
+
color: inherit;
|
|
238
|
+
transition: background-color 150ms;
|
|
239
|
+
outline: none;
|
|
240
|
+
font-family: inherit;
|
|
241
|
+
}
|
|
242
|
+
.a-country-select__item:hover,
|
|
243
|
+
.a-country-select__item:focus-visible {
|
|
244
|
+
background: hsl(var(--ak-ui-muted) / 0.6);
|
|
245
|
+
}
|
|
246
|
+
.a-country-select__item[data-selected] {
|
|
247
|
+
background: hsl(var(--ak-ui-muted));
|
|
248
|
+
}
|
|
249
|
+
.a-country-select__item:disabled {
|
|
250
|
+
cursor: not-allowed;
|
|
251
|
+
opacity: 0.4;
|
|
252
|
+
}
|
|
253
|
+
.a-country-select__item:disabled:hover {
|
|
254
|
+
background: transparent;
|
|
255
|
+
}
|
|
256
|
+
.a-country-select__item-name {
|
|
257
|
+
flex: 1;
|
|
258
|
+
min-width: 0;
|
|
259
|
+
overflow: hidden;
|
|
260
|
+
text-overflow: ellipsis;
|
|
261
|
+
white-space: nowrap;
|
|
262
|
+
}
|
|
263
|
+
.a-country-select__item-dial {
|
|
264
|
+
color: hsl(var(--ak-ui-muted-foreground));
|
|
265
|
+
font-variant-numeric: tabular-nums;
|
|
266
|
+
}
|
|
267
|
+
.a-country-select__item-check {
|
|
268
|
+
width: 0.875rem;
|
|
269
|
+
height: 0.875rem;
|
|
270
|
+
flex-shrink: 0;
|
|
271
|
+
color: hsl(var(--ak-ui-foreground));
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/* ------------------------------------------------------------
|
|
275
|
+
* ATelInput — scoped CSS. All colors map to the global
|
|
276
|
+
* --ak-ui-* design tokens (defined in assets/styles.src.css) so
|
|
277
|
+
* dark mode + consumer theme overrides keep working.
|
|
278
|
+
* ---------------------------------------------------------- */
|
|
279
|
+
.a-tel-input[data-v-8305dc81] {
|
|
280
|
+
display: flex;
|
|
281
|
+
width: 100%;
|
|
282
|
+
flex-direction: column;
|
|
283
|
+
gap: 0.375rem;
|
|
284
|
+
}
|
|
285
|
+
.a-tel-input__row[data-v-8305dc81] {
|
|
286
|
+
display: flex;
|
|
287
|
+
align-items: center;
|
|
288
|
+
gap: 0.5rem;
|
|
289
|
+
}
|
|
290
|
+
.a-tel-input__field[data-v-8305dc81] {
|
|
291
|
+
display: flex;
|
|
292
|
+
width: 100%;
|
|
293
|
+
align-items: center;
|
|
294
|
+
overflow: hidden;
|
|
295
|
+
border: 1px solid hsl(var(--ak-ui-input));
|
|
296
|
+
background: hsl(var(--ak-ui-background));
|
|
297
|
+
border-radius: calc(var(--ak-ui-radius) - 2px);
|
|
298
|
+
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
|
299
|
+
transition:
|
|
300
|
+
border-color 150ms,
|
|
301
|
+
box-shadow 150ms;
|
|
302
|
+
}
|
|
303
|
+
.a-tel-input__field[data-v-8305dc81]:focus-within {
|
|
304
|
+
outline: none;
|
|
305
|
+
box-shadow: 0 0 0 2px hsl(var(--ak-ui-ring) / 0.4);
|
|
306
|
+
}
|
|
307
|
+
.a-tel-input__field[data-v-8305dc81]:has(input:disabled) {
|
|
308
|
+
cursor: not-allowed;
|
|
309
|
+
opacity: 0.5;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/* Validation field colors — opt-in via `data-show-validation` on the root. */
|
|
313
|
+
.a-tel-input[data-show-validation] .a-tel-input__field[data-state='valid'][data-v-8305dc81] {
|
|
314
|
+
border-color: rgb(16 185 129 / 0.6);
|
|
315
|
+
box-shadow: 0 0 0 1px rgb(16 185 129 / 0.2);
|
|
316
|
+
}
|
|
317
|
+
.a-tel-input[data-show-validation] .a-tel-input__field[data-state='valid'][data-v-8305dc81]:focus-within {
|
|
318
|
+
box-shadow: 0 0 0 2px rgb(16 185 129 / 0.4);
|
|
319
|
+
}
|
|
320
|
+
.a-tel-input[data-show-validation] .a-tel-input__field[data-state='error'][data-v-8305dc81] {
|
|
321
|
+
border-color: hsl(var(--ak-ui-destructive) / 0.8);
|
|
322
|
+
box-shadow: 0 0 0 1px hsl(var(--ak-ui-destructive) / 0.2);
|
|
323
|
+
}
|
|
324
|
+
.a-tel-input[data-show-validation] .a-tel-input__field[data-state='error'][data-v-8305dc81]:focus-within {
|
|
325
|
+
box-shadow: 0 0 0 2px hsl(var(--ak-ui-destructive) / 0.4);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/* Size variants — values mirror the shared Size scale (see utils/sizes.ts). */
|
|
329
|
+
.a-tel-input[data-size='xs'] .a-tel-input__field[data-v-8305dc81] {
|
|
330
|
+
height: 1.75rem;
|
|
331
|
+
font-size: 0.75rem;
|
|
332
|
+
line-height: 1rem;
|
|
333
|
+
}
|
|
334
|
+
.a-tel-input[data-size='sm'] .a-tel-input__field[data-v-8305dc81] {
|
|
335
|
+
height: 2.25rem;
|
|
336
|
+
font-size: 0.875rem;
|
|
337
|
+
line-height: 1.25rem;
|
|
338
|
+
}
|
|
339
|
+
.a-tel-input[data-size='md'] .a-tel-input__field[data-v-8305dc81] {
|
|
340
|
+
height: 43px;
|
|
341
|
+
font-size: 0.875rem;
|
|
342
|
+
line-height: 1.25rem;
|
|
343
|
+
}
|
|
344
|
+
.a-tel-input[data-size='lg'] .a-tel-input__field[data-v-8305dc81] {
|
|
345
|
+
height: 52px;
|
|
346
|
+
font-size: 1rem;
|
|
347
|
+
line-height: 1.5rem;
|
|
348
|
+
}
|
|
349
|
+
.a-tel-input[data-size='xl'] .a-tel-input__field[data-v-8305dc81] {
|
|
350
|
+
height: 60px;
|
|
351
|
+
font-size: 1rem;
|
|
352
|
+
line-height: 1.5rem;
|
|
353
|
+
}
|
|
354
|
+
.a-tel-input__dial[data-v-8305dc81] {
|
|
355
|
+
flex-shrink: 0;
|
|
356
|
+
color: hsl(var(--ak-ui-muted-foreground));
|
|
357
|
+
font-variant-numeric: tabular-nums;
|
|
358
|
+
user-select: none;
|
|
359
|
+
padding: 0 0.5rem;
|
|
360
|
+
}
|
|
361
|
+
.a-tel-input[data-size='xs'] .a-tel-input__dial[data-v-8305dc81] {
|
|
362
|
+
font-size: 0.75rem;
|
|
363
|
+
}
|
|
364
|
+
.a-tel-input[data-size='sm'] .a-tel-input__dial[data-v-8305dc81],
|
|
365
|
+
.a-tel-input[data-size='md'] .a-tel-input__dial[data-v-8305dc81] {
|
|
366
|
+
font-size: 0.875rem;
|
|
367
|
+
}
|
|
368
|
+
.a-tel-input[data-size='lg'] .a-tel-input__dial[data-v-8305dc81],
|
|
369
|
+
.a-tel-input[data-size='xl'] .a-tel-input__dial[data-v-8305dc81] {
|
|
370
|
+
font-size: 1rem;
|
|
371
|
+
}
|
|
372
|
+
.a-tel-input__input[data-v-8305dc81] {
|
|
373
|
+
height: 100%;
|
|
374
|
+
width: 100%;
|
|
375
|
+
min-width: 0;
|
|
376
|
+
flex: 1;
|
|
377
|
+
background: transparent;
|
|
378
|
+
font-variant-numeric: tabular-nums;
|
|
379
|
+
outline: none;
|
|
380
|
+
border: 0;
|
|
381
|
+
color: inherit;
|
|
382
|
+
font: inherit;
|
|
383
|
+
}
|
|
384
|
+
.a-tel-input__input[data-v-8305dc81]::placeholder {
|
|
385
|
+
color: hsl(var(--ak-ui-muted-foreground));
|
|
386
|
+
}
|
|
387
|
+
.a-tel-input__input[data-v-8305dc81]:disabled {
|
|
388
|
+
cursor: not-allowed;
|
|
389
|
+
}
|
|
390
|
+
.a-tel-input__input[data-has-dial][data-v-8305dc81] {
|
|
391
|
+
padding-inline-start: 0.25rem;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/* Per-size horizontal padding for the input itself. */
|
|
395
|
+
.a-tel-input[data-size='xs'] .a-tel-input__input[data-v-8305dc81] {
|
|
396
|
+
padding-inline: 0.5rem;
|
|
397
|
+
}
|
|
398
|
+
.a-tel-input[data-size='sm'] .a-tel-input__input[data-v-8305dc81] {
|
|
399
|
+
padding-inline: 0.625rem;
|
|
400
|
+
}
|
|
401
|
+
.a-tel-input[data-size='md'] .a-tel-input__input[data-v-8305dc81] {
|
|
402
|
+
padding-inline: 0.75rem;
|
|
403
|
+
}
|
|
404
|
+
.a-tel-input[data-size='lg'] .a-tel-input__input[data-v-8305dc81] {
|
|
405
|
+
padding-inline: 0.875rem;
|
|
406
|
+
}
|
|
407
|
+
.a-tel-input[data-size='xl'] .a-tel-input__input[data-v-8305dc81] {
|
|
408
|
+
padding-inline: 1rem;
|
|
409
|
+
}
|
|
410
|
+
/* When the dial prefix is present, the input already inherits ps-1 via [data-has-dial]; collapse start padding. */
|
|
411
|
+
.a-tel-input__input[data-has-dial][data-v-8305dc81] {
|
|
412
|
+
padding-inline-start: 0.25rem;
|
|
413
|
+
}
|
|
414
|
+
.a-tel-input__detecting[data-v-8305dc81] {
|
|
415
|
+
display: inline-flex;
|
|
416
|
+
height: 100%;
|
|
417
|
+
flex-shrink: 0;
|
|
418
|
+
align-items: center;
|
|
419
|
+
padding: 0 0.5rem;
|
|
420
|
+
color: hsl(var(--ak-ui-muted-foreground));
|
|
421
|
+
}
|
|
422
|
+
.a-tel-input__detecting-icon[data-v-8305dc81] {
|
|
423
|
+
width: 1rem;
|
|
424
|
+
height: 1rem;
|
|
425
|
+
}
|
|
426
|
+
.a-tel-input__country-wrapper[data-v-8305dc81] {
|
|
427
|
+
display: inline-flex;
|
|
428
|
+
height: 100%;
|
|
429
|
+
flex-shrink: 0;
|
|
430
|
+
align-items: center;
|
|
431
|
+
}
|
|
432
|
+
.a-tel-input__icon[data-v-8305dc81] {
|
|
433
|
+
width: 1.25rem;
|
|
434
|
+
height: 1.25rem;
|
|
435
|
+
flex-shrink: 0;
|
|
436
|
+
}
|
|
437
|
+
.a-tel-input__icon--valid[data-v-8305dc81] {
|
|
438
|
+
color: rgb(16 185 129);
|
|
439
|
+
}
|
|
440
|
+
.a-tel-input__icon--error[data-v-8305dc81] {
|
|
441
|
+
color: hsl(var(--ak-ui-destructive));
|
|
442
|
+
}
|
|
443
|
+
.a-tel-input__error[data-v-8305dc81] {
|
|
444
|
+
color: hsl(var(--ak-ui-destructive));
|
|
445
|
+
font-size: 0.75rem;
|
|
446
|
+
line-height: 1rem;
|
|
447
|
+
margin: 0;
|
|
448
|
+
}
|
|
449
|
+
.a-tel-input__hint[data-v-8305dc81] {
|
|
450
|
+
color: hsl(var(--ak-ui-muted-foreground));
|
|
451
|
+
font-size: 0.75rem;
|
|
452
|
+
line-height: 1rem;
|
|
453
|
+
font-variant-numeric: tabular-nums;
|
|
454
|
+
margin: 0;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/* Detecting spinner transition (collapsible width + fade). */
|
|
458
|
+
.a-tell-detect-enter-active[data-v-8305dc81] {
|
|
459
|
+
transition:
|
|
460
|
+
opacity 200ms ease-out,
|
|
461
|
+
max-width 200ms ease-out;
|
|
462
|
+
overflow: hidden;
|
|
463
|
+
}
|
|
464
|
+
.a-tell-detect-leave-active[data-v-8305dc81] {
|
|
465
|
+
transition:
|
|
466
|
+
opacity 150ms ease-in,
|
|
467
|
+
max-width 150ms ease-in;
|
|
468
|
+
overflow: hidden;
|
|
469
|
+
}
|
|
470
|
+
.a-tell-detect-enter-from[data-v-8305dc81],
|
|
471
|
+
.a-tell-detect-leave-to[data-v-8305dc81] {
|
|
472
|
+
opacity: 0;
|
|
473
|
+
max-width: 0;
|
|
474
|
+
}
|
|
475
|
+
.a-tell-detect-enter-to[data-v-8305dc81],
|
|
476
|
+
.a-tell-detect-leave-from[data-v-8305dc81] {
|
|
477
|
+
opacity: 1;
|
|
478
|
+
max-width: 2.5rem;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/* Country picker reveal/hide transition. */
|
|
482
|
+
.a-tell-country-enter-active[data-v-8305dc81] {
|
|
483
|
+
transition:
|
|
484
|
+
opacity 200ms ease-out,
|
|
485
|
+
max-width 200ms ease-out;
|
|
486
|
+
overflow: hidden;
|
|
487
|
+
}
|
|
488
|
+
.a-tell-country-leave-active[data-v-8305dc81] {
|
|
489
|
+
transition:
|
|
490
|
+
opacity 150ms ease-in,
|
|
491
|
+
max-width 150ms ease-in;
|
|
492
|
+
overflow: hidden;
|
|
493
|
+
}
|
|
494
|
+
.a-tell-country-enter-from[data-v-8305dc81],
|
|
495
|
+
.a-tell-country-leave-to[data-v-8305dc81] {
|
|
496
|
+
opacity: 0;
|
|
497
|
+
max-width: 0;
|
|
498
|
+
}
|
|
499
|
+
.a-tell-country-enter-to[data-v-8305dc81],
|
|
500
|
+
.a-tell-country-leave-from[data-v-8305dc81] {
|
|
501
|
+
opacity: 1;
|
|
502
|
+
max-width: 12rem;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/* Validation icon swap. */
|
|
506
|
+
.a-tell-icon-enter-active[data-v-8305dc81] {
|
|
507
|
+
transition:
|
|
508
|
+
opacity 150ms ease-out,
|
|
509
|
+
transform 150ms ease-out;
|
|
510
|
+
}
|
|
511
|
+
.a-tell-icon-leave-active[data-v-8305dc81] {
|
|
512
|
+
transition:
|
|
513
|
+
opacity 100ms ease-in,
|
|
514
|
+
transform 100ms ease-in;
|
|
515
|
+
}
|
|
516
|
+
.a-tell-icon-enter-from[data-v-8305dc81],
|
|
517
|
+
.a-tell-icon-leave-to[data-v-8305dc81] {
|
|
518
|
+
opacity: 0;
|
|
519
|
+
transform: scale(0.9);
|
|
520
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@alikhalilll/a-tel-input",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Headless, shadcn-vue style Vue 3 international telephone input with country detection, validation, and a responsive country picker. Part of the @alikhalilll/a-* toolkit.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "alikhalilll",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/alikhalilll/ali-nuxt-toolkit.git",
|
|
10
|
+
"directory": "packages/ui-components/ATelInput"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://alikhalilll.github.io/ali-nuxt-toolkit/ui",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/alikhalilll/ali-nuxt-toolkit/issues"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"sideEffects": [
|
|
18
|
+
"**/*.css"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"vue",
|
|
25
|
+
"vue3",
|
|
26
|
+
"nuxt",
|
|
27
|
+
"tel-input",
|
|
28
|
+
"phone-input",
|
|
29
|
+
"headless",
|
|
30
|
+
"shadcn",
|
|
31
|
+
"libphonenumber"
|
|
32
|
+
],
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"import": {
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"default": "./dist/index.js"
|
|
38
|
+
},
|
|
39
|
+
"require": {
|
|
40
|
+
"types": "./dist/index.d.cts",
|
|
41
|
+
"default": "./dist/index.cjs"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"./nuxt": {
|
|
45
|
+
"import": {
|
|
46
|
+
"types": "./dist/nuxt/index.d.ts",
|
|
47
|
+
"default": "./dist/nuxt/index.js"
|
|
48
|
+
},
|
|
49
|
+
"require": {
|
|
50
|
+
"types": "./dist/nuxt/index.d.cts",
|
|
51
|
+
"default": "./dist/nuxt/index.cjs"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"./resolver": {
|
|
55
|
+
"import": {
|
|
56
|
+
"types": "./dist/resolver/index.d.ts",
|
|
57
|
+
"default": "./dist/resolver/index.js"
|
|
58
|
+
},
|
|
59
|
+
"require": {
|
|
60
|
+
"types": "./dist/resolver/index.d.cts",
|
|
61
|
+
"default": "./dist/resolver/index.cjs"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"./styles.css": "./dist/styles.css",
|
|
65
|
+
"./package.json": "./package.json"
|
|
66
|
+
},
|
|
67
|
+
"types": "./dist/index.d.ts",
|
|
68
|
+
"web-types": "./web-types.json",
|
|
69
|
+
"files": [
|
|
70
|
+
"dist",
|
|
71
|
+
"src",
|
|
72
|
+
"web-types.json",
|
|
73
|
+
"README.md",
|
|
74
|
+
"LICENSE"
|
|
75
|
+
],
|
|
76
|
+
"engines": {
|
|
77
|
+
"node": ">=18"
|
|
78
|
+
},
|
|
79
|
+
"peerDependencies": {
|
|
80
|
+
"@nuxt/kit": "^3.0.0 || ^4.0.0",
|
|
81
|
+
"@vueuse/core": "^14.0.0",
|
|
82
|
+
"unplugin-vue-components": "^28.0.0 || ^29.0.0 || ^30.0.0 || ^31.0.0 || ^32.0.0",
|
|
83
|
+
"vue": "^3.5.0"
|
|
84
|
+
},
|
|
85
|
+
"peerDependenciesMeta": {
|
|
86
|
+
"@nuxt/kit": {
|
|
87
|
+
"optional": true
|
|
88
|
+
},
|
|
89
|
+
"unplugin-vue-components": {
|
|
90
|
+
"optional": true
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"dependencies": {
|
|
94
|
+
"class-variance-authority": "^0.7.1",
|
|
95
|
+
"libphonenumber-js": "^1.12.0",
|
|
96
|
+
"@alikhalilll/a-responsive-popover": "1.0.1"
|
|
97
|
+
},
|
|
98
|
+
"devDependencies": {
|
|
99
|
+
"@nuxt/kit": "^4.4.2",
|
|
100
|
+
"@nuxt/schema": "^4.4.2",
|
|
101
|
+
"@tailwindcss/cli": "^4.0.0",
|
|
102
|
+
"@tsdown/css": "0.22.0",
|
|
103
|
+
"@types/node": "^22.13.0",
|
|
104
|
+
"@vueuse/core": "^14.0.0",
|
|
105
|
+
"rimraf": "^6.0.1",
|
|
106
|
+
"tailwindcss": "^4.0.0",
|
|
107
|
+
"tsdown": "0.22.0",
|
|
108
|
+
"typescript": "^5.9.2",
|
|
109
|
+
"unplugin-vue": "7.2.0",
|
|
110
|
+
"unplugin-vue-components": "^32.1.0",
|
|
111
|
+
"vue": "^3.5.0",
|
|
112
|
+
"vue-tsc": "^3.2.4",
|
|
113
|
+
"@alikhalilll/a-ui-base": "1.0.0"
|
|
114
|
+
},
|
|
115
|
+
"scripts": {
|
|
116
|
+
"clean": "rimraf dist web-types.json",
|
|
117
|
+
"build": "tsx ../../../scripts/build/run-component-build.ts",
|
|
118
|
+
"typecheck": "vue-tsc --noEmit -p tsconfig.json",
|
|
119
|
+
"validate-dist": "tsx ../../../scripts/validate/dist-validate.ts --pkg a-tel-input",
|
|
120
|
+
"validate-consumer": "tsx ../../../scripts/validate/consumer-validate.ts --pkg a-tel-input",
|
|
121
|
+
"validate": "pnpm build && pnpm validate-dist && pnpm validate-consumer"
|
|
122
|
+
}
|
|
123
|
+
}
|