nihonput 0.1.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/LICENSE +21 -0
- package/README.ja.md +318 -0
- package/README.md +318 -0
- package/dist/index.d.mts +216 -0
- package/dist/index.d.ts +216 -0
- package/dist/index.js +948 -0
- package/dist/index.mjs +892 -0
- package/package.json +50 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,892 @@
|
|
|
1
|
+
// src/hooks/useNameField.ts
|
|
2
|
+
import { useState, useCallback, useRef } from "react";
|
|
3
|
+
|
|
4
|
+
// src/types/index.ts
|
|
5
|
+
var defaultErrorMessages = {
|
|
6
|
+
katakanaOnly: "\u30AB\u30BF\u30AB\u30CA\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
7
|
+
hiraganaOnly: "\u3072\u3089\u304C\u306A\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
8
|
+
invalidPostalCode: "\u6B63\u3057\u3044\u90F5\u4FBF\u756A\u53F7\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u4F8B: 123-4567\uFF09",
|
|
9
|
+
invalidPrefecture: "\u6B63\u3057\u3044\u90FD\u9053\u5E9C\u770C\u540D\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
10
|
+
invalidPhoneNumber: "\u6B63\u3057\u3044\u96FB\u8A71\u756A\u53F7\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
11
|
+
invalidWidth: "\u6B63\u3057\u3044\u6587\u5B57\u5E45\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
12
|
+
invalidFormat: "\u6B63\u3057\u3044\u5F62\u5F0F\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// src/validators/katakana.ts
|
|
16
|
+
function validateKatakana(value) {
|
|
17
|
+
if (!value) return true;
|
|
18
|
+
const katakanaRegex = /^[\u30A0-\u30FF\u3000\s]+$/;
|
|
19
|
+
return katakanaRegex.test(value);
|
|
20
|
+
}
|
|
21
|
+
function containsHiragana(value) {
|
|
22
|
+
if (!value) return false;
|
|
23
|
+
const hiraganaRegex = /[\u3040-\u309F]/;
|
|
24
|
+
return hiraganaRegex.test(value);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// src/normalizers/toKatakana.ts
|
|
28
|
+
function toKatakana(value) {
|
|
29
|
+
if (!value) return value;
|
|
30
|
+
return value.replace(/[\u3040-\u309F]/g, (char) => {
|
|
31
|
+
return String.fromCharCode(char.charCodeAt(0) + 96);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// src/hooks/useNameField.ts
|
|
36
|
+
function useNameField(options) {
|
|
37
|
+
const {
|
|
38
|
+
kanaMode,
|
|
39
|
+
normalizeOn = "blur",
|
|
40
|
+
validateOn = "blur",
|
|
41
|
+
errorMessages = {}
|
|
42
|
+
} = options;
|
|
43
|
+
const [value, setValue] = useState("");
|
|
44
|
+
const [error, setError] = useState(null);
|
|
45
|
+
const [isValidating, setIsValidating] = useState(false);
|
|
46
|
+
const isComposingRef = useRef(false);
|
|
47
|
+
const messages = {
|
|
48
|
+
katakanaOnly: errorMessages.katakanaOnly ?? defaultErrorMessages.katakanaOnly,
|
|
49
|
+
invalidFormat: errorMessages.invalidFormat ?? defaultErrorMessages.invalidFormat
|
|
50
|
+
};
|
|
51
|
+
const normalize = useCallback(
|
|
52
|
+
(val) => {
|
|
53
|
+
if (kanaMode === "auto-convert") {
|
|
54
|
+
return toKatakana(val);
|
|
55
|
+
}
|
|
56
|
+
return val;
|
|
57
|
+
},
|
|
58
|
+
[kanaMode]
|
|
59
|
+
);
|
|
60
|
+
const validate = useCallback(
|
|
61
|
+
(val) => {
|
|
62
|
+
if (!val) return null;
|
|
63
|
+
if (kanaMode === "error-on-hiragana") {
|
|
64
|
+
if (containsHiragana(val)) {
|
|
65
|
+
return messages.katakanaOnly;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (!validateKatakana(val)) {
|
|
69
|
+
return messages.katakanaOnly;
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
},
|
|
73
|
+
[kanaMode, messages.katakanaOnly]
|
|
74
|
+
);
|
|
75
|
+
const handleChange = useCallback(
|
|
76
|
+
(e) => {
|
|
77
|
+
const newValue = e.target.value;
|
|
78
|
+
setValue(newValue);
|
|
79
|
+
if (isComposingRef.current) return;
|
|
80
|
+
if (normalizeOn === "change") {
|
|
81
|
+
setValue(normalize(newValue));
|
|
82
|
+
}
|
|
83
|
+
if (validateOn === "change") {
|
|
84
|
+
setIsValidating(true);
|
|
85
|
+
const validationError = validate(
|
|
86
|
+
normalizeOn === "change" ? normalize(newValue) : newValue
|
|
87
|
+
);
|
|
88
|
+
setError(validationError);
|
|
89
|
+
setIsValidating(false);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
[normalize, validate, normalizeOn, validateOn]
|
|
93
|
+
);
|
|
94
|
+
const handleBlur = useCallback(
|
|
95
|
+
(e) => {
|
|
96
|
+
const currentValue = e.target.value;
|
|
97
|
+
if (normalizeOn === "blur") {
|
|
98
|
+
const normalized = normalize(currentValue);
|
|
99
|
+
setValue(normalized);
|
|
100
|
+
if (validateOn === "blur") {
|
|
101
|
+
setIsValidating(true);
|
|
102
|
+
setError(validate(normalized));
|
|
103
|
+
setIsValidating(false);
|
|
104
|
+
}
|
|
105
|
+
} else if (validateOn === "blur") {
|
|
106
|
+
setIsValidating(true);
|
|
107
|
+
setError(validate(currentValue));
|
|
108
|
+
setIsValidating(false);
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
[normalize, validate, normalizeOn, validateOn]
|
|
112
|
+
);
|
|
113
|
+
const handleCompositionStart = useCallback(
|
|
114
|
+
(_e) => {
|
|
115
|
+
isComposingRef.current = true;
|
|
116
|
+
},
|
|
117
|
+
[]
|
|
118
|
+
);
|
|
119
|
+
const handleCompositionEnd = useCallback(
|
|
120
|
+
(e) => {
|
|
121
|
+
isComposingRef.current = false;
|
|
122
|
+
const currentValue = e.currentTarget.value;
|
|
123
|
+
if (normalizeOn === "compositionEnd") {
|
|
124
|
+
const normalized = normalize(currentValue);
|
|
125
|
+
setValue(normalized);
|
|
126
|
+
if (validateOn === "blur" || validateOn === "change") {
|
|
127
|
+
setIsValidating(true);
|
|
128
|
+
setError(validate(normalized));
|
|
129
|
+
setIsValidating(false);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
[normalize, validate, normalizeOn, validateOn]
|
|
134
|
+
);
|
|
135
|
+
return {
|
|
136
|
+
value,
|
|
137
|
+
onChange: handleChange,
|
|
138
|
+
onBlur: handleBlur,
|
|
139
|
+
onCompositionStart: handleCompositionStart,
|
|
140
|
+
onCompositionEnd: handleCompositionEnd,
|
|
141
|
+
error,
|
|
142
|
+
isValidating,
|
|
143
|
+
isComposing: isComposingRef.current
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// src/hooks/usePostalCodeField.ts
|
|
148
|
+
import { useState as useState2, useCallback as useCallback2, useRef as useRef2 } from "react";
|
|
149
|
+
|
|
150
|
+
// src/validators/postalCode.ts
|
|
151
|
+
function validatePostalCode(value) {
|
|
152
|
+
if (!value) return true;
|
|
153
|
+
const normalized = value.replace(/[0-9]/g, (s) => String.fromCharCode(s.charCodeAt(0) - 65248)).replace(/[ー-]/g, "-");
|
|
154
|
+
const postalCodeRegex = /^\d{3}-?\d{4}$/;
|
|
155
|
+
return postalCodeRegex.test(normalized);
|
|
156
|
+
}
|
|
157
|
+
function isHalfWidthPostalCode(value) {
|
|
158
|
+
if (!value) return true;
|
|
159
|
+
const halfWidthRegex = /^[\d-]+$/;
|
|
160
|
+
return halfWidthRegex.test(value);
|
|
161
|
+
}
|
|
162
|
+
function isFullWidthPostalCode(value) {
|
|
163
|
+
if (!value) return true;
|
|
164
|
+
const fullWidthRegex = /^[0-9ー-]+$/;
|
|
165
|
+
return fullWidthRegex.test(value);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// src/normalizers/toHalfWidth.ts
|
|
169
|
+
function toHalfWidth(value) {
|
|
170
|
+
if (!value) return value;
|
|
171
|
+
return value.replace(/[\uFF01-\uFF5E]/g, (char) => {
|
|
172
|
+
return String.fromCharCode(char.charCodeAt(0) - 65248);
|
|
173
|
+
}).replace(/\u3000/g, " ");
|
|
174
|
+
}
|
|
175
|
+
function toHalfWidthNumbers(value) {
|
|
176
|
+
if (!value) return value;
|
|
177
|
+
return value.replace(/[0-9]/g, (char) => {
|
|
178
|
+
return String.fromCharCode(char.charCodeAt(0) - 65248);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function toHalfWidthHyphen(value) {
|
|
182
|
+
if (!value) return value;
|
|
183
|
+
return value.replace(/[ー-―]/g, "-");
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// src/normalizers/toFullWidth.ts
|
|
187
|
+
function toFullWidth(value) {
|
|
188
|
+
if (!value) return value;
|
|
189
|
+
return value.replace(/[\x21-\x7E]/g, (char) => {
|
|
190
|
+
return String.fromCharCode(char.charCodeAt(0) + 65248);
|
|
191
|
+
}).replace(/ /g, "\u3000");
|
|
192
|
+
}
|
|
193
|
+
function toFullWidthNumbers(value) {
|
|
194
|
+
if (!value) return value;
|
|
195
|
+
return value.replace(/[0-9]/g, (char) => {
|
|
196
|
+
return String.fromCharCode(char.charCodeAt(0) + 65248);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
function toFullWidthHyphen(value) {
|
|
200
|
+
if (!value) return value;
|
|
201
|
+
return value.replace(/-/g, "\u30FC");
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// src/normalizers/addHyphen.ts
|
|
205
|
+
function addPostalCodeHyphen(value) {
|
|
206
|
+
if (!value) return value;
|
|
207
|
+
let normalized = toHalfWidthNumbers(value);
|
|
208
|
+
normalized = toHalfWidthHyphen(normalized);
|
|
209
|
+
const digitsOnly = normalized.replace(/-/g, "");
|
|
210
|
+
if (digitsOnly.length >= 4) {
|
|
211
|
+
return digitsOnly.slice(0, 3) + "-" + digitsOnly.slice(3, 7);
|
|
212
|
+
}
|
|
213
|
+
return digitsOnly;
|
|
214
|
+
}
|
|
215
|
+
function addPhoneNumberHyphen(value) {
|
|
216
|
+
if (!value) return value;
|
|
217
|
+
let normalized = toHalfWidthNumbers(value);
|
|
218
|
+
normalized = toHalfWidthHyphen(normalized);
|
|
219
|
+
const digitsOnly = normalized.replace(/-/g, "");
|
|
220
|
+
if (digitsOnly.length === 11) {
|
|
221
|
+
if (digitsOnly.startsWith("0")) {
|
|
222
|
+
return digitsOnly.slice(0, 3) + "-" + digitsOnly.slice(3, 7) + "-" + digitsOnly.slice(7);
|
|
223
|
+
}
|
|
224
|
+
} else if (digitsOnly.length === 10) {
|
|
225
|
+
if (digitsOnly.startsWith("0")) {
|
|
226
|
+
if (digitsOnly.startsWith("03") || digitsOnly.startsWith("06")) {
|
|
227
|
+
return digitsOnly.slice(0, 2) + "-" + digitsOnly.slice(2, 6) + "-" + digitsOnly.slice(6);
|
|
228
|
+
}
|
|
229
|
+
return digitsOnly.slice(0, 4) + "-" + digitsOnly.slice(4, 6) + "-" + digitsOnly.slice(6);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return digitsOnly;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// src/hooks/usePostalCodeField.ts
|
|
236
|
+
function usePostalCodeField(options) {
|
|
237
|
+
const {
|
|
238
|
+
widthMode,
|
|
239
|
+
onInvalid,
|
|
240
|
+
autoHyphen = true,
|
|
241
|
+
normalizeOn = "blur",
|
|
242
|
+
validateOn = "blur",
|
|
243
|
+
errorMessages = {}
|
|
244
|
+
} = options;
|
|
245
|
+
const [value, setValue] = useState2("");
|
|
246
|
+
const [error, setError] = useState2(null);
|
|
247
|
+
const [isValidating, setIsValidating] = useState2(false);
|
|
248
|
+
const isComposingRef = useRef2(false);
|
|
249
|
+
const messages = {
|
|
250
|
+
invalidWidth: errorMessages.invalidWidth ?? defaultErrorMessages.invalidWidth,
|
|
251
|
+
invalidFormat: errorMessages.invalidFormat ?? defaultErrorMessages.invalidPostalCode
|
|
252
|
+
};
|
|
253
|
+
const normalizeWidth = useCallback2(
|
|
254
|
+
(val) => {
|
|
255
|
+
if (widthMode === "half-width-only") {
|
|
256
|
+
let normalized = toHalfWidthNumbers(val);
|
|
257
|
+
normalized = toHalfWidthHyphen(normalized);
|
|
258
|
+
return normalized;
|
|
259
|
+
} else {
|
|
260
|
+
let normalized = toFullWidthNumbers(val);
|
|
261
|
+
normalized = toFullWidthHyphen(normalized);
|
|
262
|
+
return normalized;
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
[widthMode]
|
|
266
|
+
);
|
|
267
|
+
const normalize = useCallback2(
|
|
268
|
+
(val) => {
|
|
269
|
+
let normalized = val;
|
|
270
|
+
if (onInvalid === "auto-convert") {
|
|
271
|
+
normalized = normalizeWidth(normalized);
|
|
272
|
+
}
|
|
273
|
+
if (autoHyphen && widthMode === "half-width-only") {
|
|
274
|
+
normalized = addPostalCodeHyphen(normalized);
|
|
275
|
+
}
|
|
276
|
+
return normalized;
|
|
277
|
+
},
|
|
278
|
+
[onInvalid, autoHyphen, widthMode, normalizeWidth]
|
|
279
|
+
);
|
|
280
|
+
const validate = useCallback2(
|
|
281
|
+
(val) => {
|
|
282
|
+
if (!val) return null;
|
|
283
|
+
if (onInvalid === "error") {
|
|
284
|
+
if (widthMode === "half-width-only" && !isHalfWidthPostalCode(val)) {
|
|
285
|
+
return messages.invalidWidth;
|
|
286
|
+
}
|
|
287
|
+
if (widthMode === "full-width-only" && !isFullWidthPostalCode(val)) {
|
|
288
|
+
return messages.invalidWidth;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (!validatePostalCode(val)) {
|
|
292
|
+
return messages.invalidFormat;
|
|
293
|
+
}
|
|
294
|
+
return null;
|
|
295
|
+
},
|
|
296
|
+
[onInvalid, widthMode, messages.invalidWidth, messages.invalidFormat]
|
|
297
|
+
);
|
|
298
|
+
const handleChange = useCallback2(
|
|
299
|
+
(e) => {
|
|
300
|
+
const newValue = e.target.value;
|
|
301
|
+
setValue(newValue);
|
|
302
|
+
if (isComposingRef.current) return;
|
|
303
|
+
if (normalizeOn === "change") {
|
|
304
|
+
setValue(normalize(newValue));
|
|
305
|
+
}
|
|
306
|
+
if (validateOn === "change") {
|
|
307
|
+
setIsValidating(true);
|
|
308
|
+
const validationError = validate(
|
|
309
|
+
normalizeOn === "change" ? normalize(newValue) : newValue
|
|
310
|
+
);
|
|
311
|
+
setError(validationError);
|
|
312
|
+
setIsValidating(false);
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
[normalize, validate, normalizeOn, validateOn]
|
|
316
|
+
);
|
|
317
|
+
const handleBlur = useCallback2(
|
|
318
|
+
(e) => {
|
|
319
|
+
const currentValue = e.target.value;
|
|
320
|
+
if (normalizeOn === "blur") {
|
|
321
|
+
const normalized = normalize(currentValue);
|
|
322
|
+
setValue(normalized);
|
|
323
|
+
if (validateOn === "blur") {
|
|
324
|
+
setIsValidating(true);
|
|
325
|
+
setError(validate(normalized));
|
|
326
|
+
setIsValidating(false);
|
|
327
|
+
}
|
|
328
|
+
} else if (validateOn === "blur") {
|
|
329
|
+
setIsValidating(true);
|
|
330
|
+
setError(validate(currentValue));
|
|
331
|
+
setIsValidating(false);
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
[normalize, validate, normalizeOn, validateOn]
|
|
335
|
+
);
|
|
336
|
+
const handleCompositionStart = useCallback2(
|
|
337
|
+
(_e) => {
|
|
338
|
+
isComposingRef.current = true;
|
|
339
|
+
},
|
|
340
|
+
[]
|
|
341
|
+
);
|
|
342
|
+
const handleCompositionEnd = useCallback2(
|
|
343
|
+
(e) => {
|
|
344
|
+
isComposingRef.current = false;
|
|
345
|
+
const currentValue = e.currentTarget.value;
|
|
346
|
+
if (normalizeOn === "compositionEnd") {
|
|
347
|
+
const normalized = normalize(currentValue);
|
|
348
|
+
setValue(normalized);
|
|
349
|
+
if (validateOn === "blur" || validateOn === "change") {
|
|
350
|
+
setIsValidating(true);
|
|
351
|
+
setError(validate(normalized));
|
|
352
|
+
setIsValidating(false);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
[normalize, validate, normalizeOn, validateOn]
|
|
357
|
+
);
|
|
358
|
+
return {
|
|
359
|
+
value,
|
|
360
|
+
onChange: handleChange,
|
|
361
|
+
onBlur: handleBlur,
|
|
362
|
+
onCompositionStart: handleCompositionStart,
|
|
363
|
+
onCompositionEnd: handleCompositionEnd,
|
|
364
|
+
error,
|
|
365
|
+
isValidating,
|
|
366
|
+
isComposing: isComposingRef.current
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// src/hooks/usePrefectureField.ts
|
|
371
|
+
import { useState as useState3, useCallback as useCallback3, useRef as useRef3 } from "react";
|
|
372
|
+
|
|
373
|
+
// src/validators/prefecture.ts
|
|
374
|
+
var PREFECTURES = [
|
|
375
|
+
"\u5317\u6D77\u9053",
|
|
376
|
+
"\u9752\u68EE\u770C",
|
|
377
|
+
"\u5CA9\u624B\u770C",
|
|
378
|
+
"\u5BAE\u57CE\u770C",
|
|
379
|
+
"\u79CB\u7530\u770C",
|
|
380
|
+
"\u5C71\u5F62\u770C",
|
|
381
|
+
"\u798F\u5CF6\u770C",
|
|
382
|
+
"\u8328\u57CE\u770C",
|
|
383
|
+
"\u6803\u6728\u770C",
|
|
384
|
+
"\u7FA4\u99AC\u770C",
|
|
385
|
+
"\u57FC\u7389\u770C",
|
|
386
|
+
"\u5343\u8449\u770C",
|
|
387
|
+
"\u6771\u4EAC\u90FD",
|
|
388
|
+
"\u795E\u5948\u5DDD\u770C",
|
|
389
|
+
"\u65B0\u6F5F\u770C",
|
|
390
|
+
"\u5BCC\u5C71\u770C",
|
|
391
|
+
"\u77F3\u5DDD\u770C",
|
|
392
|
+
"\u798F\u4E95\u770C",
|
|
393
|
+
"\u5C71\u68A8\u770C",
|
|
394
|
+
"\u9577\u91CE\u770C",
|
|
395
|
+
"\u5C90\u961C\u770C",
|
|
396
|
+
"\u9759\u5CA1\u770C",
|
|
397
|
+
"\u611B\u77E5\u770C",
|
|
398
|
+
"\u4E09\u91CD\u770C",
|
|
399
|
+
"\u6ECB\u8CC0\u770C",
|
|
400
|
+
"\u4EAC\u90FD\u5E9C",
|
|
401
|
+
"\u5927\u962A\u5E9C",
|
|
402
|
+
"\u5175\u5EAB\u770C",
|
|
403
|
+
"\u5948\u826F\u770C",
|
|
404
|
+
"\u548C\u6B4C\u5C71\u770C",
|
|
405
|
+
"\u9CE5\u53D6\u770C",
|
|
406
|
+
"\u5CF6\u6839\u770C",
|
|
407
|
+
"\u5CA1\u5C71\u770C",
|
|
408
|
+
"\u5E83\u5CF6\u770C",
|
|
409
|
+
"\u5C71\u53E3\u770C",
|
|
410
|
+
"\u5FB3\u5CF6\u770C",
|
|
411
|
+
"\u9999\u5DDD\u770C",
|
|
412
|
+
"\u611B\u5A9B\u770C",
|
|
413
|
+
"\u9AD8\u77E5\u770C",
|
|
414
|
+
"\u798F\u5CA1\u770C",
|
|
415
|
+
"\u4F50\u8CC0\u770C",
|
|
416
|
+
"\u9577\u5D0E\u770C",
|
|
417
|
+
"\u718A\u672C\u770C",
|
|
418
|
+
"\u5927\u5206\u770C",
|
|
419
|
+
"\u5BAE\u5D0E\u770C",
|
|
420
|
+
"\u9E7F\u5150\u5CF6\u770C",
|
|
421
|
+
"\u6C96\u7E04\u770C"
|
|
422
|
+
];
|
|
423
|
+
var PREFECTURE_SHORT_NAMES = {
|
|
424
|
+
\u5317\u6D77: "\u5317\u6D77\u9053",
|
|
425
|
+
\u9752\u68EE: "\u9752\u68EE\u770C",
|
|
426
|
+
\u5CA9\u624B: "\u5CA9\u624B\u770C",
|
|
427
|
+
\u5BAE\u57CE: "\u5BAE\u57CE\u770C",
|
|
428
|
+
\u79CB\u7530: "\u79CB\u7530\u770C",
|
|
429
|
+
\u5C71\u5F62: "\u5C71\u5F62\u770C",
|
|
430
|
+
\u798F\u5CF6: "\u798F\u5CF6\u770C",
|
|
431
|
+
\u8328\u57CE: "\u8328\u57CE\u770C",
|
|
432
|
+
\u6803\u6728: "\u6803\u6728\u770C",
|
|
433
|
+
\u7FA4\u99AC: "\u7FA4\u99AC\u770C",
|
|
434
|
+
\u57FC\u7389: "\u57FC\u7389\u770C",
|
|
435
|
+
\u5343\u8449: "\u5343\u8449\u770C",
|
|
436
|
+
\u6771\u4EAC: "\u6771\u4EAC\u90FD",
|
|
437
|
+
\u795E\u5948\u5DDD: "\u795E\u5948\u5DDD\u770C",
|
|
438
|
+
\u65B0\u6F5F: "\u65B0\u6F5F\u770C",
|
|
439
|
+
\u5BCC\u5C71: "\u5BCC\u5C71\u770C",
|
|
440
|
+
\u77F3\u5DDD: "\u77F3\u5DDD\u770C",
|
|
441
|
+
\u798F\u4E95: "\u798F\u4E95\u770C",
|
|
442
|
+
\u5C71\u68A8: "\u5C71\u68A8\u770C",
|
|
443
|
+
\u9577\u91CE: "\u9577\u91CE\u770C",
|
|
444
|
+
\u5C90\u961C: "\u5C90\u961C\u770C",
|
|
445
|
+
\u9759\u5CA1: "\u9759\u5CA1\u770C",
|
|
446
|
+
\u611B\u77E5: "\u611B\u77E5\u770C",
|
|
447
|
+
\u4E09\u91CD: "\u4E09\u91CD\u770C",
|
|
448
|
+
\u6ECB\u8CC0: "\u6ECB\u8CC0\u770C",
|
|
449
|
+
\u4EAC\u90FD: "\u4EAC\u90FD\u5E9C",
|
|
450
|
+
\u5927\u962A: "\u5927\u962A\u5E9C",
|
|
451
|
+
\u5175\u5EAB: "\u5175\u5EAB\u770C",
|
|
452
|
+
\u5948\u826F: "\u5948\u826F\u770C",
|
|
453
|
+
\u548C\u6B4C\u5C71: "\u548C\u6B4C\u5C71\u770C",
|
|
454
|
+
\u9CE5\u53D6: "\u9CE5\u53D6\u770C",
|
|
455
|
+
\u5CF6\u6839: "\u5CF6\u6839\u770C",
|
|
456
|
+
\u5CA1\u5C71: "\u5CA1\u5C71\u770C",
|
|
457
|
+
\u5E83\u5CF6: "\u5E83\u5CF6\u770C",
|
|
458
|
+
\u5C71\u53E3: "\u5C71\u53E3\u770C",
|
|
459
|
+
\u5FB3\u5CF6: "\u5FB3\u5CF6\u770C",
|
|
460
|
+
\u9999\u5DDD: "\u9999\u5DDD\u770C",
|
|
461
|
+
\u611B\u5A9B: "\u611B\u5A9B\u770C",
|
|
462
|
+
\u9AD8\u77E5: "\u9AD8\u77E5\u770C",
|
|
463
|
+
\u798F\u5CA1: "\u798F\u5CA1\u770C",
|
|
464
|
+
\u4F50\u8CC0: "\u4F50\u8CC0\u770C",
|
|
465
|
+
\u9577\u5D0E: "\u9577\u5D0E\u770C",
|
|
466
|
+
\u718A\u672C: "\u718A\u672C\u770C",
|
|
467
|
+
\u5927\u5206: "\u5927\u5206\u770C",
|
|
468
|
+
\u5BAE\u5D0E: "\u5BAE\u5D0E\u770C",
|
|
469
|
+
\u9E7F\u5150\u5CF6: "\u9E7F\u5150\u5CF6\u770C",
|
|
470
|
+
\u6C96\u7E04: "\u6C96\u7E04\u770C"
|
|
471
|
+
};
|
|
472
|
+
function validatePrefecture(value) {
|
|
473
|
+
if (!value) return true;
|
|
474
|
+
return PREFECTURES.includes(value) || Object.keys(PREFECTURE_SHORT_NAMES).includes(value);
|
|
475
|
+
}
|
|
476
|
+
function normalizePrefecture(value) {
|
|
477
|
+
if (!value) return value;
|
|
478
|
+
if (PREFECTURES.includes(value)) {
|
|
479
|
+
return value;
|
|
480
|
+
}
|
|
481
|
+
return PREFECTURE_SHORT_NAMES[value] || value;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
// src/hooks/usePrefectureField.ts
|
|
485
|
+
function usePrefectureField(options = {}) {
|
|
486
|
+
const {
|
|
487
|
+
autoComplete = true,
|
|
488
|
+
normalizeOn = "blur",
|
|
489
|
+
validateOn = "blur",
|
|
490
|
+
errorMessages = {}
|
|
491
|
+
} = options;
|
|
492
|
+
const [value, setValue] = useState3("");
|
|
493
|
+
const [error, setError] = useState3(null);
|
|
494
|
+
const [isValidating, setIsValidating] = useState3(false);
|
|
495
|
+
const isComposingRef = useRef3(false);
|
|
496
|
+
const messages = {
|
|
497
|
+
invalidPrefecture: errorMessages.invalidPrefecture ?? defaultErrorMessages.invalidPrefecture
|
|
498
|
+
};
|
|
499
|
+
const normalize = useCallback3(
|
|
500
|
+
(val) => {
|
|
501
|
+
if (autoComplete) {
|
|
502
|
+
return normalizePrefecture(val);
|
|
503
|
+
}
|
|
504
|
+
return val;
|
|
505
|
+
},
|
|
506
|
+
[autoComplete]
|
|
507
|
+
);
|
|
508
|
+
const validate = useCallback3(
|
|
509
|
+
(val) => {
|
|
510
|
+
if (!val) return null;
|
|
511
|
+
if (!validatePrefecture(val)) {
|
|
512
|
+
return messages.invalidPrefecture;
|
|
513
|
+
}
|
|
514
|
+
return null;
|
|
515
|
+
},
|
|
516
|
+
[messages.invalidPrefecture]
|
|
517
|
+
);
|
|
518
|
+
const handleChange = useCallback3(
|
|
519
|
+
(e) => {
|
|
520
|
+
const newValue = e.target.value;
|
|
521
|
+
setValue(newValue);
|
|
522
|
+
if (isComposingRef.current) return;
|
|
523
|
+
if (normalizeOn === "change") {
|
|
524
|
+
setValue(normalize(newValue));
|
|
525
|
+
}
|
|
526
|
+
if (validateOn === "change") {
|
|
527
|
+
setIsValidating(true);
|
|
528
|
+
const validationError = validate(
|
|
529
|
+
normalizeOn === "change" ? normalize(newValue) : newValue
|
|
530
|
+
);
|
|
531
|
+
setError(validationError);
|
|
532
|
+
setIsValidating(false);
|
|
533
|
+
}
|
|
534
|
+
},
|
|
535
|
+
[normalize, validate, normalizeOn, validateOn]
|
|
536
|
+
);
|
|
537
|
+
const handleBlur = useCallback3(
|
|
538
|
+
(e) => {
|
|
539
|
+
const currentValue = e.target.value;
|
|
540
|
+
if (normalizeOn === "blur") {
|
|
541
|
+
const normalized = normalize(currentValue);
|
|
542
|
+
setValue(normalized);
|
|
543
|
+
if (validateOn === "blur") {
|
|
544
|
+
setIsValidating(true);
|
|
545
|
+
setError(validate(normalized));
|
|
546
|
+
setIsValidating(false);
|
|
547
|
+
}
|
|
548
|
+
} else if (validateOn === "blur") {
|
|
549
|
+
setIsValidating(true);
|
|
550
|
+
setError(validate(currentValue));
|
|
551
|
+
setIsValidating(false);
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
[normalize, validate, normalizeOn, validateOn]
|
|
555
|
+
);
|
|
556
|
+
const handleCompositionStart = useCallback3(
|
|
557
|
+
(_e) => {
|
|
558
|
+
isComposingRef.current = true;
|
|
559
|
+
},
|
|
560
|
+
[]
|
|
561
|
+
);
|
|
562
|
+
const handleCompositionEnd = useCallback3(
|
|
563
|
+
(e) => {
|
|
564
|
+
isComposingRef.current = false;
|
|
565
|
+
const currentValue = e.currentTarget.value;
|
|
566
|
+
if (normalizeOn === "compositionEnd") {
|
|
567
|
+
const normalized = normalize(currentValue);
|
|
568
|
+
setValue(normalized);
|
|
569
|
+
if (validateOn === "blur" || validateOn === "change") {
|
|
570
|
+
setIsValidating(true);
|
|
571
|
+
setError(validate(normalized));
|
|
572
|
+
setIsValidating(false);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
},
|
|
576
|
+
[normalize, validate, normalizeOn, validateOn]
|
|
577
|
+
);
|
|
578
|
+
return {
|
|
579
|
+
value,
|
|
580
|
+
onChange: handleChange,
|
|
581
|
+
onBlur: handleBlur,
|
|
582
|
+
onCompositionStart: handleCompositionStart,
|
|
583
|
+
onCompositionEnd: handleCompositionEnd,
|
|
584
|
+
error,
|
|
585
|
+
isValidating,
|
|
586
|
+
isComposing: isComposingRef.current
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
// src/hooks/useAddressField.ts
|
|
591
|
+
import { useState as useState4, useCallback as useCallback4, useRef as useRef4 } from "react";
|
|
592
|
+
function containsHalfWidthAlphanumeric(value) {
|
|
593
|
+
return /[A-Za-z0-9]/.test(value);
|
|
594
|
+
}
|
|
595
|
+
function useAddressField(options) {
|
|
596
|
+
const {
|
|
597
|
+
alphanumericMode,
|
|
598
|
+
onInvalid,
|
|
599
|
+
normalizeOn = "blur",
|
|
600
|
+
validateOn = "blur",
|
|
601
|
+
errorMessages = {}
|
|
602
|
+
} = options;
|
|
603
|
+
const [value, setValue] = useState4("");
|
|
604
|
+
const [error, setError] = useState4(null);
|
|
605
|
+
const [isValidating, setIsValidating] = useState4(false);
|
|
606
|
+
const isComposingRef = useRef4(false);
|
|
607
|
+
const messages = {
|
|
608
|
+
invalidWidth: errorMessages.invalidWidth ?? defaultErrorMessages.invalidWidth
|
|
609
|
+
};
|
|
610
|
+
const normalize = useCallback4(
|
|
611
|
+
(val) => {
|
|
612
|
+
if (alphanumericMode === "full-width-only" && onInvalid === "auto-convert") {
|
|
613
|
+
return toFullWidth(val);
|
|
614
|
+
}
|
|
615
|
+
return val;
|
|
616
|
+
},
|
|
617
|
+
[alphanumericMode, onInvalid]
|
|
618
|
+
);
|
|
619
|
+
const validate = useCallback4(
|
|
620
|
+
(val) => {
|
|
621
|
+
if (!val) return null;
|
|
622
|
+
if (alphanumericMode === "full-width-only" && onInvalid === "error" && containsHalfWidthAlphanumeric(val)) {
|
|
623
|
+
return messages.invalidWidth;
|
|
624
|
+
}
|
|
625
|
+
return null;
|
|
626
|
+
},
|
|
627
|
+
[alphanumericMode, onInvalid, messages.invalidWidth]
|
|
628
|
+
);
|
|
629
|
+
const handleChange = useCallback4(
|
|
630
|
+
(e) => {
|
|
631
|
+
const newValue = e.target.value;
|
|
632
|
+
setValue(newValue);
|
|
633
|
+
if (isComposingRef.current) return;
|
|
634
|
+
if (normalizeOn === "change") {
|
|
635
|
+
setValue(normalize(newValue));
|
|
636
|
+
}
|
|
637
|
+
if (validateOn === "change") {
|
|
638
|
+
setIsValidating(true);
|
|
639
|
+
const validationError = validate(
|
|
640
|
+
normalizeOn === "change" ? normalize(newValue) : newValue
|
|
641
|
+
);
|
|
642
|
+
setError(validationError);
|
|
643
|
+
setIsValidating(false);
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
[normalize, validate, normalizeOn, validateOn]
|
|
647
|
+
);
|
|
648
|
+
const handleBlur = useCallback4(
|
|
649
|
+
(e) => {
|
|
650
|
+
const currentValue = e.target.value;
|
|
651
|
+
if (normalizeOn === "blur") {
|
|
652
|
+
const normalized = normalize(currentValue);
|
|
653
|
+
setValue(normalized);
|
|
654
|
+
if (validateOn === "blur") {
|
|
655
|
+
setIsValidating(true);
|
|
656
|
+
setError(validate(normalized));
|
|
657
|
+
setIsValidating(false);
|
|
658
|
+
}
|
|
659
|
+
} else if (validateOn === "blur") {
|
|
660
|
+
setIsValidating(true);
|
|
661
|
+
setError(validate(currentValue));
|
|
662
|
+
setIsValidating(false);
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
[normalize, validate, normalizeOn, validateOn]
|
|
666
|
+
);
|
|
667
|
+
const handleCompositionStart = useCallback4(
|
|
668
|
+
(_e) => {
|
|
669
|
+
isComposingRef.current = true;
|
|
670
|
+
},
|
|
671
|
+
[]
|
|
672
|
+
);
|
|
673
|
+
const handleCompositionEnd = useCallback4(
|
|
674
|
+
(e) => {
|
|
675
|
+
isComposingRef.current = false;
|
|
676
|
+
const currentValue = e.currentTarget.value;
|
|
677
|
+
if (normalizeOn === "compositionEnd") {
|
|
678
|
+
const normalized = normalize(currentValue);
|
|
679
|
+
setValue(normalized);
|
|
680
|
+
if (validateOn === "blur" || validateOn === "change") {
|
|
681
|
+
setIsValidating(true);
|
|
682
|
+
setError(validate(normalized));
|
|
683
|
+
setIsValidating(false);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
},
|
|
687
|
+
[normalize, validate, normalizeOn, validateOn]
|
|
688
|
+
);
|
|
689
|
+
return {
|
|
690
|
+
value,
|
|
691
|
+
onChange: handleChange,
|
|
692
|
+
onBlur: handleBlur,
|
|
693
|
+
onCompositionStart: handleCompositionStart,
|
|
694
|
+
onCompositionEnd: handleCompositionEnd,
|
|
695
|
+
error,
|
|
696
|
+
isValidating,
|
|
697
|
+
isComposing: isComposingRef.current
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
// src/hooks/usePhoneNumberField.ts
|
|
702
|
+
import { useState as useState5, useCallback as useCallback5, useRef as useRef5 } from "react";
|
|
703
|
+
|
|
704
|
+
// src/validators/phoneNumber.ts
|
|
705
|
+
function validatePhoneNumber(value) {
|
|
706
|
+
if (!value) return true;
|
|
707
|
+
const normalized = value.replace(/[0-9]/g, (s) => String.fromCharCode(s.charCodeAt(0) - 65248)).replace(/[ー-]/g, "-");
|
|
708
|
+
const digitsOnly = normalized.replace(/-/g, "");
|
|
709
|
+
if (digitsOnly.length < 10 || digitsOnly.length > 11) {
|
|
710
|
+
return false;
|
|
711
|
+
}
|
|
712
|
+
const phoneRegex = /^[\d-]+$/;
|
|
713
|
+
return phoneRegex.test(normalized);
|
|
714
|
+
}
|
|
715
|
+
function isHalfWidthPhoneNumber(value) {
|
|
716
|
+
if (!value) return true;
|
|
717
|
+
const halfWidthRegex = /^[\d-]+$/;
|
|
718
|
+
return halfWidthRegex.test(value);
|
|
719
|
+
}
|
|
720
|
+
function containsFullWidthPhoneNumber(value) {
|
|
721
|
+
if (!value) return false;
|
|
722
|
+
const fullWidthRegex = /[0-9ー-]/;
|
|
723
|
+
return fullWidthRegex.test(value);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
// src/hooks/usePhoneNumberField.ts
|
|
727
|
+
function usePhoneNumberField(options) {
|
|
728
|
+
const {
|
|
729
|
+
onInvalid,
|
|
730
|
+
autoHyphen = true,
|
|
731
|
+
normalizeOn = "blur",
|
|
732
|
+
validateOn = "blur",
|
|
733
|
+
errorMessages = {}
|
|
734
|
+
} = options;
|
|
735
|
+
const [value, setValue] = useState5("");
|
|
736
|
+
const [error, setError] = useState5(null);
|
|
737
|
+
const [isValidating, setIsValidating] = useState5(false);
|
|
738
|
+
const isComposingRef = useRef5(false);
|
|
739
|
+
const messages = {
|
|
740
|
+
invalidWidth: errorMessages.invalidWidth ?? defaultErrorMessages.invalidWidth,
|
|
741
|
+
invalidFormat: errorMessages.invalidFormat ?? defaultErrorMessages.invalidPhoneNumber
|
|
742
|
+
};
|
|
743
|
+
const normalize = useCallback5(
|
|
744
|
+
(val) => {
|
|
745
|
+
let normalized = val;
|
|
746
|
+
if (onInvalid === "auto-convert") {
|
|
747
|
+
normalized = toHalfWidthNumbers(normalized);
|
|
748
|
+
normalized = toHalfWidthHyphen(normalized);
|
|
749
|
+
}
|
|
750
|
+
if (autoHyphen) {
|
|
751
|
+
normalized = addPhoneNumberHyphen(normalized);
|
|
752
|
+
}
|
|
753
|
+
return normalized;
|
|
754
|
+
},
|
|
755
|
+
[onInvalid, autoHyphen]
|
|
756
|
+
);
|
|
757
|
+
const validate = useCallback5(
|
|
758
|
+
(val) => {
|
|
759
|
+
if (!val) return null;
|
|
760
|
+
if (onInvalid === "error" && containsFullWidthPhoneNumber(val)) {
|
|
761
|
+
return messages.invalidWidth;
|
|
762
|
+
}
|
|
763
|
+
if (!validatePhoneNumber(val)) {
|
|
764
|
+
return messages.invalidFormat;
|
|
765
|
+
}
|
|
766
|
+
return null;
|
|
767
|
+
},
|
|
768
|
+
[onInvalid, messages.invalidWidth, messages.invalidFormat]
|
|
769
|
+
);
|
|
770
|
+
const handleChange = useCallback5(
|
|
771
|
+
(e) => {
|
|
772
|
+
const newValue = e.target.value;
|
|
773
|
+
setValue(newValue);
|
|
774
|
+
if (isComposingRef.current) return;
|
|
775
|
+
if (normalizeOn === "change") {
|
|
776
|
+
setValue(normalize(newValue));
|
|
777
|
+
}
|
|
778
|
+
if (validateOn === "change") {
|
|
779
|
+
setIsValidating(true);
|
|
780
|
+
const validationError = validate(
|
|
781
|
+
normalizeOn === "change" ? normalize(newValue) : newValue
|
|
782
|
+
);
|
|
783
|
+
setError(validationError);
|
|
784
|
+
setIsValidating(false);
|
|
785
|
+
}
|
|
786
|
+
},
|
|
787
|
+
[normalize, validate, normalizeOn, validateOn]
|
|
788
|
+
);
|
|
789
|
+
const handleBlur = useCallback5(
|
|
790
|
+
(e) => {
|
|
791
|
+
const currentValue = e.target.value;
|
|
792
|
+
if (normalizeOn === "blur") {
|
|
793
|
+
const normalized = normalize(currentValue);
|
|
794
|
+
setValue(normalized);
|
|
795
|
+
if (validateOn === "blur") {
|
|
796
|
+
setIsValidating(true);
|
|
797
|
+
setError(validate(normalized));
|
|
798
|
+
setIsValidating(false);
|
|
799
|
+
}
|
|
800
|
+
} else if (validateOn === "blur") {
|
|
801
|
+
setIsValidating(true);
|
|
802
|
+
setError(validate(currentValue));
|
|
803
|
+
setIsValidating(false);
|
|
804
|
+
}
|
|
805
|
+
},
|
|
806
|
+
[normalize, validate, normalizeOn, validateOn]
|
|
807
|
+
);
|
|
808
|
+
const handleCompositionStart = useCallback5(
|
|
809
|
+
(_e) => {
|
|
810
|
+
isComposingRef.current = true;
|
|
811
|
+
},
|
|
812
|
+
[]
|
|
813
|
+
);
|
|
814
|
+
const handleCompositionEnd = useCallback5(
|
|
815
|
+
(e) => {
|
|
816
|
+
isComposingRef.current = false;
|
|
817
|
+
const currentValue = e.currentTarget.value;
|
|
818
|
+
if (normalizeOn === "compositionEnd") {
|
|
819
|
+
const normalized = normalize(currentValue);
|
|
820
|
+
setValue(normalized);
|
|
821
|
+
if (validateOn === "blur" || validateOn === "change") {
|
|
822
|
+
setIsValidating(true);
|
|
823
|
+
setError(validate(normalized));
|
|
824
|
+
setIsValidating(false);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
},
|
|
828
|
+
[normalize, validate, normalizeOn, validateOn]
|
|
829
|
+
);
|
|
830
|
+
return {
|
|
831
|
+
value,
|
|
832
|
+
onChange: handleChange,
|
|
833
|
+
onBlur: handleBlur,
|
|
834
|
+
onCompositionStart: handleCompositionStart,
|
|
835
|
+
onCompositionEnd: handleCompositionEnd,
|
|
836
|
+
error,
|
|
837
|
+
isValidating,
|
|
838
|
+
isComposing: isComposingRef.current
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
// src/validators/hiragana.ts
|
|
843
|
+
function validateHiragana(value) {
|
|
844
|
+
if (!value) return true;
|
|
845
|
+
const hiraganaRegex = /^[\u3040-\u309F\u30FC\u3000\s]+$/;
|
|
846
|
+
return hiraganaRegex.test(value);
|
|
847
|
+
}
|
|
848
|
+
function containsKatakana(value) {
|
|
849
|
+
if (!value) return false;
|
|
850
|
+
const katakanaRegex = /[\u30A0-\u30FF]/;
|
|
851
|
+
return katakanaRegex.test(value);
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
// src/normalizers/toHiragana.ts
|
|
855
|
+
function toHiragana(value) {
|
|
856
|
+
if (!value) return value;
|
|
857
|
+
return value.replace(/[\u30A1-\u30F6]/g, (char) => {
|
|
858
|
+
return String.fromCharCode(char.charCodeAt(0) - 96);
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
export {
|
|
862
|
+
PREFECTURES,
|
|
863
|
+
PREFECTURE_SHORT_NAMES,
|
|
864
|
+
addPhoneNumberHyphen,
|
|
865
|
+
addPostalCodeHyphen,
|
|
866
|
+
containsFullWidthPhoneNumber,
|
|
867
|
+
containsHiragana,
|
|
868
|
+
containsKatakana,
|
|
869
|
+
defaultErrorMessages,
|
|
870
|
+
isFullWidthPostalCode,
|
|
871
|
+
isHalfWidthPhoneNumber,
|
|
872
|
+
isHalfWidthPostalCode,
|
|
873
|
+
normalizePrefecture,
|
|
874
|
+
toFullWidth,
|
|
875
|
+
toFullWidthHyphen,
|
|
876
|
+
toFullWidthNumbers,
|
|
877
|
+
toHalfWidth,
|
|
878
|
+
toHalfWidthHyphen,
|
|
879
|
+
toHalfWidthNumbers,
|
|
880
|
+
toHiragana,
|
|
881
|
+
toKatakana,
|
|
882
|
+
useAddressField,
|
|
883
|
+
useNameField,
|
|
884
|
+
usePhoneNumberField,
|
|
885
|
+
usePostalCodeField,
|
|
886
|
+
usePrefectureField,
|
|
887
|
+
validateHiragana,
|
|
888
|
+
validateKatakana,
|
|
889
|
+
validatePhoneNumber,
|
|
890
|
+
validatePostalCode,
|
|
891
|
+
validatePrefecture
|
|
892
|
+
};
|