@antify/ui 4.1.36 → 4.1.38
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/components/index.d.ts +3 -1
- package/dist/components/index.js +14 -0
- package/dist/components/index.mjs +4 -0
- package/dist/components/inputs/AntCheckbox.vue +37 -37
- package/dist/components/inputs/AntCountryInput.vue +366 -0
- package/dist/components/inputs/AntPhoneNumberInput.vue +347 -0
- package/dist/components/inputs/Elements/AntSelectMenu.vue +2 -0
- package/dist/components/inputs/__stories/AntCheckbox.stories.js +1 -1
- package/dist/components/inputs/__stories/AntCheckbox.stories.mjs +1 -1
- package/dist/components/inputs/__stories/AntCheckboxGroup.stories.d.ts +1 -0
- package/dist/components/inputs/__stories/AntCheckboxGroup.stories.js +35 -2
- package/dist/components/inputs/__stories/AntCheckboxGroup.stories.mjs +39 -1
- package/dist/components/inputs/__stories/AntCountryInput.stories.d.ts +16 -0
- package/dist/components/inputs/__stories/AntCountryInput.stories.js +286 -0
- package/dist/components/inputs/__stories/AntCountryInput.stories.mjs +289 -0
- package/dist/components/inputs/__stories/AntPhoneNumberInput.stories.d.ts +7 -0
- package/dist/components/inputs/__stories/AntPhoneNumberInput.stories.js +303 -0
- package/dist/components/inputs/__stories/AntPhoneNumberInput.stories.mjs +305 -0
- package/dist/components/inputs/__types/AntCountryInput.types.d.ts +11 -0
- package/dist/components/inputs/__types/AntCountryInput.types.js +1 -0
- package/dist/components/inputs/__types/AntCountryInput.types.mjs +0 -0
- package/dist/components/inputs/__types/index.d.ts +1 -0
- package/dist/components/inputs/__types/index.js +11 -0
- package/dist/components/inputs/__types/index.mjs +1 -0
- package/dist/constants/countries.d.ts +22 -0
- package/dist/constants/countries.js +2009 -0
- package/dist/constants/countries.mjs +2185 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +11 -0
- package/dist/index.mjs +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.summary = exports.default = exports.Default = void 0;
|
|
7
|
+
var _AntPhoneNumberInput = _interopRequireDefault(require("../AntPhoneNumberInput.vue"));
|
|
8
|
+
var _enums = require("../../../enums");
|
|
9
|
+
var _vue = require("vue");
|
|
10
|
+
var _countries = require("../../../constants/countries");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
const meta = {
|
|
13
|
+
title: "Inputs/Phone Number Input",
|
|
14
|
+
component: _AntPhoneNumberInput.default,
|
|
15
|
+
parameters: {
|
|
16
|
+
docs: {
|
|
17
|
+
description: {
|
|
18
|
+
component: "Komponente zur Eingabe der Telefonnummer mit Auswahl von Land und L\xE4ndervorwahl."
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
argTypes: {
|
|
23
|
+
size: {
|
|
24
|
+
control: {
|
|
25
|
+
type: "select"
|
|
26
|
+
},
|
|
27
|
+
options: Object.values(_enums.Size)
|
|
28
|
+
},
|
|
29
|
+
state: {
|
|
30
|
+
control: {
|
|
31
|
+
type: "select"
|
|
32
|
+
},
|
|
33
|
+
options: Object.values(_enums.InputState)
|
|
34
|
+
},
|
|
35
|
+
onValidate: {
|
|
36
|
+
action: "validate"
|
|
37
|
+
},
|
|
38
|
+
nullable: {
|
|
39
|
+
control: "boolean",
|
|
40
|
+
description: "Shows the clear icon in the input field."
|
|
41
|
+
},
|
|
42
|
+
locale: {
|
|
43
|
+
control: {
|
|
44
|
+
type: "select"
|
|
45
|
+
},
|
|
46
|
+
options: Object.values(_countries.Locale),
|
|
47
|
+
description: "Language for country names translation"
|
|
48
|
+
},
|
|
49
|
+
countryValueKey: {
|
|
50
|
+
control: {
|
|
51
|
+
type: "select"
|
|
52
|
+
},
|
|
53
|
+
options: Object.values(_countries.CountryValueKey)
|
|
54
|
+
},
|
|
55
|
+
countries: {
|
|
56
|
+
table: {
|
|
57
|
+
disable: true
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
module.exports = meta;
|
|
63
|
+
const Default = exports.Default = {
|
|
64
|
+
render: args => ({
|
|
65
|
+
components: {
|
|
66
|
+
AntPhoneNumberInput: _AntPhoneNumberInput.default
|
|
67
|
+
},
|
|
68
|
+
setup() {
|
|
69
|
+
const phoneDefault = (0, _vue.ref)(null);
|
|
70
|
+
const countryDefault = (0, _vue.ref)("DE");
|
|
71
|
+
const phoneNumericDefault = (0, _vue.ref)(null);
|
|
72
|
+
const countryNumericDefault = (0, _vue.ref)(49);
|
|
73
|
+
const phone1 = (0, _vue.ref)(null);
|
|
74
|
+
const country1 = (0, _vue.ref)(null);
|
|
75
|
+
const phone2 = (0, _vue.ref)(null);
|
|
76
|
+
const country2 = (0, _vue.ref)(null);
|
|
77
|
+
const phone3 = (0, _vue.ref)(null);
|
|
78
|
+
const country3 = (0, _vue.ref)(null);
|
|
79
|
+
const phone4 = (0, _vue.ref)("123456");
|
|
80
|
+
const country4 = (0, _vue.ref)("DE");
|
|
81
|
+
const phonePaste = (0, _vue.ref)(null);
|
|
82
|
+
const countryPaste = (0, _vue.ref)(null);
|
|
83
|
+
const copyToClipboard = async text => {
|
|
84
|
+
await navigator.clipboard?.writeText(text).catch(err => {
|
|
85
|
+
console.warn("Copy failed", err);
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
args,
|
|
90
|
+
phoneDefault,
|
|
91
|
+
countryDefault,
|
|
92
|
+
phoneNumericDefault,
|
|
93
|
+
countryNumericDefault,
|
|
94
|
+
phone1,
|
|
95
|
+
country1,
|
|
96
|
+
phone2,
|
|
97
|
+
country2,
|
|
98
|
+
phone3,
|
|
99
|
+
country3,
|
|
100
|
+
phone4,
|
|
101
|
+
country4,
|
|
102
|
+
phonePaste,
|
|
103
|
+
countryPaste,
|
|
104
|
+
copyToClipboard
|
|
105
|
+
};
|
|
106
|
+
},
|
|
107
|
+
template: `
|
|
108
|
+
<div class="grid grid-cols-2 gap-x-12 gap-y-12">
|
|
109
|
+
<div>
|
|
110
|
+
<h3 class="mb-2 text-sm font-bold text-for-white-bg-font uppercase tracking-wider">Default Country Prop</h3>
|
|
111
|
+
<p class="mb-2 text-xs text-base-400 italic text-wrap">
|
|
112
|
+
Initial values are null. Component selects Germany via <b>default-country-value="DE"</b> using the default "value" key.
|
|
113
|
+
</p>
|
|
114
|
+
<AntPhoneNumberInput
|
|
115
|
+
v-bind="args"
|
|
116
|
+
v-model="phoneDefault"
|
|
117
|
+
:locale="args.locale"
|
|
118
|
+
country-value-key="value"
|
|
119
|
+
v-model:country-value="countryDefault"
|
|
120
|
+
placeholder="Initialized with DE"
|
|
121
|
+
/>
|
|
122
|
+
<div class="mt-2 text-md text-for-white-bg-font">
|
|
123
|
+
Data: {{ countryDefault || 'null' }} | {{ phoneDefault || 'null' }}
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<div>
|
|
128
|
+
<h3 class="mb-2 text-sm font-bold text-for-white-bg-font uppercase tracking-wider">Default by Numeric Code (49)</h3>
|
|
129
|
+
<p class="mb-2 text-xs text-base-400 italic text-wrap">
|
|
130
|
+
Initial values are null. Component selects Germany via <b>numericCode: 49</b>. We tell the component to use "numericCode" as the value key.
|
|
131
|
+
</p>
|
|
132
|
+
<AntPhoneNumberInput
|
|
133
|
+
v-bind="args"
|
|
134
|
+
v-model="phoneNumericDefault"
|
|
135
|
+
v-model:country-value="countryNumericDefault"
|
|
136
|
+
country-value-key="numericCode"
|
|
137
|
+
placeholder="Initialized with 49"
|
|
138
|
+
/>
|
|
139
|
+
<div class="mt-2 text-md text-for-white-bg-font">
|
|
140
|
+
Data: {{ countryNumericDefault || 'null' }} | {{ phoneNumericDefault || 'null' }}
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<div>
|
|
145
|
+
<h3 class="mb-2 text-sm font-bold text-for-white-bg-font uppercase tracking-wider">Auto-detect Country on Paste</h3>
|
|
146
|
+
<p class="mb-2 text-xs text-base-400 italic text-wrap">
|
|
147
|
+
Click a number to copy, then paste it (Ctrl+V) into the input to see auto-detection in action.
|
|
148
|
+
</p>
|
|
149
|
+
|
|
150
|
+
<div class="flex gap-2 mb-4">
|
|
151
|
+
<button
|
|
152
|
+
v-for="num in ['+4915211111111', '+3715211111111', '+3725211111111']"
|
|
153
|
+
@click="copyToClipboard(num)"
|
|
154
|
+
class="px-2 py-1 text-xs bg-white border border-base-300 rounded hover:bg-base-100 transition-colors text-for-white-bg-font"
|
|
155
|
+
title="Click to copy"
|
|
156
|
+
>
|
|
157
|
+
{{ num }}
|
|
158
|
+
</button>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
<AntPhoneNumberInput
|
|
162
|
+
v-bind="args"
|
|
163
|
+
v-model="phonePaste"
|
|
164
|
+
v-model:country-value="countryPaste"
|
|
165
|
+
placeholder="Paste a number starting with +..."
|
|
166
|
+
/>
|
|
167
|
+
|
|
168
|
+
<div class="mt-2 text-md text-for-white-bg-font">
|
|
169
|
+
Data: {{ countryPaste || 'null' }} | {{ phonePaste || 'null' }}
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
<div>
|
|
174
|
+
<h3 class="mb-2 text-sm font-bold text-for-white-bg-font uppercase tracking-wider">Keep Country on Clear</h3>
|
|
175
|
+
<p class="mb-2 text-xs text-base-400 italic text-wrap">
|
|
176
|
+
Try clicking the "X" icon. The phone number will be null, but the country (DE) will remain selected.
|
|
177
|
+
</p>
|
|
178
|
+
<AntPhoneNumberInput
|
|
179
|
+
v-bind="args"
|
|
180
|
+
v-model="phone4"
|
|
181
|
+
v-model:country-value="country4"
|
|
182
|
+
:nullable="true"
|
|
183
|
+
country-value-key="value"
|
|
184
|
+
/>
|
|
185
|
+
<div class="mt-2 text-md text-for-white-bg-font">
|
|
186
|
+
Data: {{ country4 || 'null' }} | {{ phone4 || 'null' }}
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
<div>
|
|
191
|
+
<h3 class="mb-2 text-sm font-bold text-for-white-bg-font uppercase tracking-wider">With Search (Default)</h3>
|
|
192
|
+
<AntPhoneNumberInput
|
|
193
|
+
v-bind="args"
|
|
194
|
+
v-model="phone1"
|
|
195
|
+
v-model:country-value="country1"
|
|
196
|
+
/>
|
|
197
|
+
<div class="mt-2 text-md text-for-white-bg-font">
|
|
198
|
+
Data: {{ country1 || 'null' }} | {{ phone1 || 'null' }}
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
|
|
202
|
+
<div>
|
|
203
|
+
<h3 class="mb-2 text-sm font-bold text-for-white-bg-font uppercase tracking-wider">Without Search</h3>
|
|
204
|
+
<AntPhoneNumberInput
|
|
205
|
+
v-bind="args"
|
|
206
|
+
v-model="phone2"
|
|
207
|
+
v-model:country-value="country2"
|
|
208
|
+
:searchable="false"
|
|
209
|
+
/>
|
|
210
|
+
<div class="mt-2 text-md text-for-white-bg-font">
|
|
211
|
+
Data: {{ country2 || 'null' }} | {{ phone2 || 'null' }}
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
|
|
215
|
+
<div>
|
|
216
|
+
<h3 class="mb-2 text-sm font-bold text-for-white-bg-font uppercase tracking-wider">Numeric Code Output</h3>
|
|
217
|
+
<AntPhoneNumberInput
|
|
218
|
+
v-bind="args"
|
|
219
|
+
v-model="phone3"
|
|
220
|
+
v-model:country-value="country3"
|
|
221
|
+
country-value-key="numericCode"
|
|
222
|
+
country-placeholder="Select for numeric output"
|
|
223
|
+
/>
|
|
224
|
+
<div class="mt-2 text-md text-for-white-bg-font">
|
|
225
|
+
Data: {{ country3 || 'null' }} | {{ phone3 || 'null' }}
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
`
|
|
230
|
+
}),
|
|
231
|
+
args: {
|
|
232
|
+
label: "Phone Number",
|
|
233
|
+
description: "Enter your mobile phone number",
|
|
234
|
+
placeholder: "Enter digits",
|
|
235
|
+
countryPlaceholder: "Select your country",
|
|
236
|
+
countries: _countries.COUNTRIES,
|
|
237
|
+
size: _enums.Size.md,
|
|
238
|
+
state: _enums.InputState.base,
|
|
239
|
+
nullable: true,
|
|
240
|
+
locale: _countries.Locale.de
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
const summary = exports.summary = {
|
|
244
|
+
parameters: {
|
|
245
|
+
chromatic: {
|
|
246
|
+
disableSnapshot: false
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
render: args => ({
|
|
250
|
+
components: {
|
|
251
|
+
AntPhoneNumberInput: _AntPhoneNumberInput.default
|
|
252
|
+
},
|
|
253
|
+
setup() {
|
|
254
|
+
const phone = (0, _vue.ref)(null);
|
|
255
|
+
const country = (0, _vue.ref)("+49");
|
|
256
|
+
return {
|
|
257
|
+
args,
|
|
258
|
+
phone,
|
|
259
|
+
country,
|
|
260
|
+
InputState: _enums.InputState,
|
|
261
|
+
Size: _enums.Size,
|
|
262
|
+
COUNTRIES: _countries.COUNTRIES
|
|
263
|
+
};
|
|
264
|
+
},
|
|
265
|
+
template: `
|
|
266
|
+
<div class="flex flex-col gap-4">
|
|
267
|
+
<div class="flex flex-col gap-4">
|
|
268
|
+
<h2 class="text-xl font-bold border-b pb-2 text-base-700">Phone Number Input States</h2>
|
|
269
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
270
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" v-model:country-value="country" :state="InputState.base" label="Base State" />
|
|
271
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" v-model:country-value="country" :state="InputState.info" label="Info State" :messages="['Bitte geben Sie Ihre Mobilnummer ein']" />
|
|
272
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" v-model:country-value="country" :state="InputState.success" label="Success State" />
|
|
273
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" v-model:country-value="country" :state="InputState.warning" label="Warning State" :messages="['Pr\xFCfen Sie die Vorwahl']" />
|
|
274
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" v-model:country-value="country" :state="InputState.danger" label="Danger State" :messages="['Ung\xFCltige Telefonnummer']" />
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
|
|
278
|
+
<div class="flex flex-col gap-4">
|
|
279
|
+
<h2 class="text-xl font-bold border-b pb-2 text-base-700">Sizes</h2>
|
|
280
|
+
<div class="flex flex-col gap-4">
|
|
281
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" v-model:country-value="country" :size="Size.sm" label="Small (sm)" />
|
|
282
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" v-model:country-value="country" :size="Size.md" label="Medium (md)" />
|
|
283
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" v-model:country-value="country" :size="Size.lg" label="Large (lg)" />
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
286
|
+
|
|
287
|
+
<div class="flex flex-col gap-4">
|
|
288
|
+
<h2 class="text-xl font-bold border-b pb-2 text-base-700">Special Modes</h2>
|
|
289
|
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
|
|
290
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" country-value="DE" model-value="1512345678" disabled label="Disabled" />
|
|
291
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" country-value="DE" model-value="1512345678" readonly label="Readonly" />
|
|
292
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" country-value="DE" skeleton label="Skeleton" />
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
</div>
|
|
296
|
+
`
|
|
297
|
+
}),
|
|
298
|
+
args: {
|
|
299
|
+
countries: _countries.COUNTRIES,
|
|
300
|
+
countryPlaceholder: "Land w\xE4hlen",
|
|
301
|
+
searchPlaceholder: "Suchen..."
|
|
302
|
+
}
|
|
303
|
+
};
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import AntPhoneNumberInput from "../AntPhoneNumberInput.vue";
|
|
2
|
+
import {
|
|
3
|
+
Size,
|
|
4
|
+
InputState
|
|
5
|
+
} from "../../../enums/index.mjs";
|
|
6
|
+
import {
|
|
7
|
+
ref
|
|
8
|
+
} from "vue";
|
|
9
|
+
import {
|
|
10
|
+
COUNTRIES,
|
|
11
|
+
CountryValueKey,
|
|
12
|
+
Locale
|
|
13
|
+
} from "../../../constants/countries.mjs";
|
|
14
|
+
const meta = {
|
|
15
|
+
title: "Inputs/Phone Number Input",
|
|
16
|
+
component: AntPhoneNumberInput,
|
|
17
|
+
parameters: {
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component: "Komponente zur Eingabe der Telefonnummer mit Auswahl von Land und L\xE4ndervorwahl."
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
argTypes: {
|
|
25
|
+
size: {
|
|
26
|
+
control: {
|
|
27
|
+
type: "select"
|
|
28
|
+
},
|
|
29
|
+
options: Object.values(Size)
|
|
30
|
+
},
|
|
31
|
+
state: {
|
|
32
|
+
control: {
|
|
33
|
+
type: "select"
|
|
34
|
+
},
|
|
35
|
+
options: Object.values(InputState)
|
|
36
|
+
},
|
|
37
|
+
onValidate: {
|
|
38
|
+
action: "validate"
|
|
39
|
+
},
|
|
40
|
+
nullable: {
|
|
41
|
+
control: "boolean",
|
|
42
|
+
description: "Shows the clear icon in the input field."
|
|
43
|
+
},
|
|
44
|
+
locale: {
|
|
45
|
+
control: {
|
|
46
|
+
type: "select"
|
|
47
|
+
},
|
|
48
|
+
options: Object.values(Locale),
|
|
49
|
+
description: "Language for country names translation"
|
|
50
|
+
},
|
|
51
|
+
countryValueKey: {
|
|
52
|
+
control: {
|
|
53
|
+
type: "select"
|
|
54
|
+
},
|
|
55
|
+
options: Object.values(CountryValueKey)
|
|
56
|
+
},
|
|
57
|
+
countries: {
|
|
58
|
+
table: {
|
|
59
|
+
disable: true
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
export default meta;
|
|
65
|
+
export const Default = {
|
|
66
|
+
render: (args) => ({
|
|
67
|
+
components: {
|
|
68
|
+
AntPhoneNumberInput
|
|
69
|
+
},
|
|
70
|
+
setup() {
|
|
71
|
+
const phoneDefault = ref(null);
|
|
72
|
+
const countryDefault = ref("DE");
|
|
73
|
+
const phoneNumericDefault = ref(null);
|
|
74
|
+
const countryNumericDefault = ref(49);
|
|
75
|
+
const phone1 = ref(null);
|
|
76
|
+
const country1 = ref(null);
|
|
77
|
+
const phone2 = ref(null);
|
|
78
|
+
const country2 = ref(null);
|
|
79
|
+
const phone3 = ref(null);
|
|
80
|
+
const country3 = ref(null);
|
|
81
|
+
const phone4 = ref("123456");
|
|
82
|
+
const country4 = ref("DE");
|
|
83
|
+
const phonePaste = ref(null);
|
|
84
|
+
const countryPaste = ref(null);
|
|
85
|
+
const copyToClipboard = async (text) => {
|
|
86
|
+
await navigator.clipboard?.writeText(text).catch((err) => {
|
|
87
|
+
console.warn("Copy failed", err);
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
return {
|
|
91
|
+
args,
|
|
92
|
+
phoneDefault,
|
|
93
|
+
countryDefault,
|
|
94
|
+
phoneNumericDefault,
|
|
95
|
+
countryNumericDefault,
|
|
96
|
+
phone1,
|
|
97
|
+
country1,
|
|
98
|
+
phone2,
|
|
99
|
+
country2,
|
|
100
|
+
phone3,
|
|
101
|
+
country3,
|
|
102
|
+
phone4,
|
|
103
|
+
country4,
|
|
104
|
+
phonePaste,
|
|
105
|
+
countryPaste,
|
|
106
|
+
copyToClipboard
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
|
+
template: `
|
|
110
|
+
<div class="grid grid-cols-2 gap-x-12 gap-y-12">
|
|
111
|
+
<div>
|
|
112
|
+
<h3 class="mb-2 text-sm font-bold text-for-white-bg-font uppercase tracking-wider">Default Country Prop</h3>
|
|
113
|
+
<p class="mb-2 text-xs text-base-400 italic text-wrap">
|
|
114
|
+
Initial values are null. Component selects Germany via <b>default-country-value="DE"</b> using the default "value" key.
|
|
115
|
+
</p>
|
|
116
|
+
<AntPhoneNumberInput
|
|
117
|
+
v-bind="args"
|
|
118
|
+
v-model="phoneDefault"
|
|
119
|
+
:locale="args.locale"
|
|
120
|
+
country-value-key="value"
|
|
121
|
+
v-model:country-value="countryDefault"
|
|
122
|
+
placeholder="Initialized with DE"
|
|
123
|
+
/>
|
|
124
|
+
<div class="mt-2 text-md text-for-white-bg-font">
|
|
125
|
+
Data: {{ countryDefault || 'null' }} | {{ phoneDefault || 'null' }}
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
<div>
|
|
130
|
+
<h3 class="mb-2 text-sm font-bold text-for-white-bg-font uppercase tracking-wider">Default by Numeric Code (49)</h3>
|
|
131
|
+
<p class="mb-2 text-xs text-base-400 italic text-wrap">
|
|
132
|
+
Initial values are null. Component selects Germany via <b>numericCode: 49</b>. We tell the component to use "numericCode" as the value key.
|
|
133
|
+
</p>
|
|
134
|
+
<AntPhoneNumberInput
|
|
135
|
+
v-bind="args"
|
|
136
|
+
v-model="phoneNumericDefault"
|
|
137
|
+
v-model:country-value="countryNumericDefault"
|
|
138
|
+
country-value-key="numericCode"
|
|
139
|
+
placeholder="Initialized with 49"
|
|
140
|
+
/>
|
|
141
|
+
<div class="mt-2 text-md text-for-white-bg-font">
|
|
142
|
+
Data: {{ countryNumericDefault || 'null' }} | {{ phoneNumericDefault || 'null' }}
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
<div>
|
|
147
|
+
<h3 class="mb-2 text-sm font-bold text-for-white-bg-font uppercase tracking-wider">Auto-detect Country on Paste</h3>
|
|
148
|
+
<p class="mb-2 text-xs text-base-400 italic text-wrap">
|
|
149
|
+
Click a number to copy, then paste it (Ctrl+V) into the input to see auto-detection in action.
|
|
150
|
+
</p>
|
|
151
|
+
|
|
152
|
+
<div class="flex gap-2 mb-4">
|
|
153
|
+
<button
|
|
154
|
+
v-for="num in ['+4915211111111', '+3715211111111', '+3725211111111']"
|
|
155
|
+
@click="copyToClipboard(num)"
|
|
156
|
+
class="px-2 py-1 text-xs bg-white border border-base-300 rounded hover:bg-base-100 transition-colors text-for-white-bg-font"
|
|
157
|
+
title="Click to copy"
|
|
158
|
+
>
|
|
159
|
+
{{ num }}
|
|
160
|
+
</button>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<AntPhoneNumberInput
|
|
164
|
+
v-bind="args"
|
|
165
|
+
v-model="phonePaste"
|
|
166
|
+
v-model:country-value="countryPaste"
|
|
167
|
+
placeholder="Paste a number starting with +..."
|
|
168
|
+
/>
|
|
169
|
+
|
|
170
|
+
<div class="mt-2 text-md text-for-white-bg-font">
|
|
171
|
+
Data: {{ countryPaste || 'null' }} | {{ phonePaste || 'null' }}
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
<div>
|
|
176
|
+
<h3 class="mb-2 text-sm font-bold text-for-white-bg-font uppercase tracking-wider">Keep Country on Clear</h3>
|
|
177
|
+
<p class="mb-2 text-xs text-base-400 italic text-wrap">
|
|
178
|
+
Try clicking the "X" icon. The phone number will be null, but the country (DE) will remain selected.
|
|
179
|
+
</p>
|
|
180
|
+
<AntPhoneNumberInput
|
|
181
|
+
v-bind="args"
|
|
182
|
+
v-model="phone4"
|
|
183
|
+
v-model:country-value="country4"
|
|
184
|
+
:nullable="true"
|
|
185
|
+
country-value-key="value"
|
|
186
|
+
/>
|
|
187
|
+
<div class="mt-2 text-md text-for-white-bg-font">
|
|
188
|
+
Data: {{ country4 || 'null' }} | {{ phone4 || 'null' }}
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
|
|
192
|
+
<div>
|
|
193
|
+
<h3 class="mb-2 text-sm font-bold text-for-white-bg-font uppercase tracking-wider">With Search (Default)</h3>
|
|
194
|
+
<AntPhoneNumberInput
|
|
195
|
+
v-bind="args"
|
|
196
|
+
v-model="phone1"
|
|
197
|
+
v-model:country-value="country1"
|
|
198
|
+
/>
|
|
199
|
+
<div class="mt-2 text-md text-for-white-bg-font">
|
|
200
|
+
Data: {{ country1 || 'null' }} | {{ phone1 || 'null' }}
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
|
|
204
|
+
<div>
|
|
205
|
+
<h3 class="mb-2 text-sm font-bold text-for-white-bg-font uppercase tracking-wider">Without Search</h3>
|
|
206
|
+
<AntPhoneNumberInput
|
|
207
|
+
v-bind="args"
|
|
208
|
+
v-model="phone2"
|
|
209
|
+
v-model:country-value="country2"
|
|
210
|
+
:searchable="false"
|
|
211
|
+
/>
|
|
212
|
+
<div class="mt-2 text-md text-for-white-bg-font">
|
|
213
|
+
Data: {{ country2 || 'null' }} | {{ phone2 || 'null' }}
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
|
|
217
|
+
<div>
|
|
218
|
+
<h3 class="mb-2 text-sm font-bold text-for-white-bg-font uppercase tracking-wider">Numeric Code Output</h3>
|
|
219
|
+
<AntPhoneNumberInput
|
|
220
|
+
v-bind="args"
|
|
221
|
+
v-model="phone3"
|
|
222
|
+
v-model:country-value="country3"
|
|
223
|
+
country-value-key="numericCode"
|
|
224
|
+
country-placeholder="Select for numeric output"
|
|
225
|
+
/>
|
|
226
|
+
<div class="mt-2 text-md text-for-white-bg-font">
|
|
227
|
+
Data: {{ country3 || 'null' }} | {{ phone3 || 'null' }}
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
`
|
|
232
|
+
}),
|
|
233
|
+
args: {
|
|
234
|
+
label: "Phone Number",
|
|
235
|
+
description: "Enter your mobile phone number",
|
|
236
|
+
placeholder: "Enter digits",
|
|
237
|
+
countryPlaceholder: "Select your country",
|
|
238
|
+
countries: COUNTRIES,
|
|
239
|
+
size: Size.md,
|
|
240
|
+
state: InputState.base,
|
|
241
|
+
nullable: true,
|
|
242
|
+
locale: Locale.de
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
export const summary = {
|
|
246
|
+
parameters: {
|
|
247
|
+
chromatic: {
|
|
248
|
+
disableSnapshot: false
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
render: (args) => ({
|
|
252
|
+
components: {
|
|
253
|
+
AntPhoneNumberInput
|
|
254
|
+
},
|
|
255
|
+
setup() {
|
|
256
|
+
const phone = ref(null);
|
|
257
|
+
const country = ref("+49");
|
|
258
|
+
return {
|
|
259
|
+
args,
|
|
260
|
+
phone,
|
|
261
|
+
country,
|
|
262
|
+
InputState,
|
|
263
|
+
Size,
|
|
264
|
+
COUNTRIES
|
|
265
|
+
};
|
|
266
|
+
},
|
|
267
|
+
template: `
|
|
268
|
+
<div class="flex flex-col gap-4">
|
|
269
|
+
<div class="flex flex-col gap-4">
|
|
270
|
+
<h2 class="text-xl font-bold border-b pb-2 text-base-700">Phone Number Input States</h2>
|
|
271
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
272
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" v-model:country-value="country" :state="InputState.base" label="Base State" />
|
|
273
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" v-model:country-value="country" :state="InputState.info" label="Info State" :messages="['Bitte geben Sie Ihre Mobilnummer ein']" />
|
|
274
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" v-model:country-value="country" :state="InputState.success" label="Success State" />
|
|
275
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" v-model:country-value="country" :state="InputState.warning" label="Warning State" :messages="['Pr\xFCfen Sie die Vorwahl']" />
|
|
276
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" v-model:country-value="country" :state="InputState.danger" label="Danger State" :messages="['Ung\xFCltige Telefonnummer']" />
|
|
277
|
+
</div>
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
<div class="flex flex-col gap-4">
|
|
281
|
+
<h2 class="text-xl font-bold border-b pb-2 text-base-700">Sizes</h2>
|
|
282
|
+
<div class="flex flex-col gap-4">
|
|
283
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" v-model:country-value="country" :size="Size.sm" label="Small (sm)" />
|
|
284
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" v-model:country-value="country" :size="Size.md" label="Medium (md)" />
|
|
285
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" v-model:country-value="country" :size="Size.lg" label="Large (lg)" />
|
|
286
|
+
</div>
|
|
287
|
+
</div>
|
|
288
|
+
|
|
289
|
+
<div class="flex flex-col gap-4">
|
|
290
|
+
<h2 class="text-xl font-bold border-b pb-2 text-base-700">Special Modes</h2>
|
|
291
|
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
|
|
292
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" country-value="DE" model-value="1512345678" disabled label="Disabled" />
|
|
293
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" country-value="DE" model-value="1512345678" readonly label="Readonly" />
|
|
294
|
+
<AntPhoneNumberInput v-bind="args" v-model="phone" country-value="DE" skeleton label="Skeleton" />
|
|
295
|
+
</div>
|
|
296
|
+
</div>
|
|
297
|
+
</div>
|
|
298
|
+
`
|
|
299
|
+
}),
|
|
300
|
+
args: {
|
|
301
|
+
countries: COUNTRIES,
|
|
302
|
+
countryPlaceholder: "Land w\xE4hlen",
|
|
303
|
+
searchPlaceholder: "Suchen..."
|
|
304
|
+
}
|
|
305
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
File without changes
|
|
@@ -14,6 +14,17 @@ Object.keys(_AntCheckbox).forEach(function (key) {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
|
+
var _AntCountryInput = require("./AntCountryInput.types");
|
|
18
|
+
Object.keys(_AntCountryInput).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _AntCountryInput[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _AntCountryInput[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
17
28
|
var _AntDateInput = require("./AntDateInput.types");
|
|
18
29
|
Object.keys(_AntDateInput).forEach(function (key) {
|
|
19
30
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Country } from '../types';
|
|
2
|
+
export declare enum CountryValueKey {
|
|
3
|
+
value = "value",
|
|
4
|
+
dialCode = "dialCode",
|
|
5
|
+
numericCode = "numericCode"
|
|
6
|
+
}
|
|
7
|
+
export declare enum Locale {
|
|
8
|
+
en = "en",
|
|
9
|
+
de = "de"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* TODO: Detailed verification and data enrichment required.
|
|
13
|
+
* * ATTENTION:
|
|
14
|
+
* 1. The physical order of this array is pre-sorted by English labels (label.en).
|
|
15
|
+
* 2. Country ISO codes (isoCode) are NOT the same as phone dial codes (dialCode).
|
|
16
|
+
* Verify each dialCode and numericCode against official ITU-T standards.
|
|
17
|
+
* 3. Some territories share the same dialCode (e.g., US, CA, and various islands use +1),
|
|
18
|
+
* ensure the 'findCountryByPhone' logic in components handles these overlaps.
|
|
19
|
+
* 4. Phone masks need to be validated for each region to ensure correct formatting.
|
|
20
|
+
* 5. Kazakhstan was removed because he had the same dialCode of number as Russia
|
|
21
|
+
*/
|
|
22
|
+
export declare const COUNTRIES: Country[];
|