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.d.mts
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { ChangeEvent, FocusEvent, CompositionEvent } from 'react';
|
|
2
|
+
|
|
3
|
+
type NormalizeOn = 'blur' | 'compositionEnd' | 'change';
|
|
4
|
+
type ValidateOn = 'blur' | 'change' | 'submit';
|
|
5
|
+
interface BaseFieldReturn {
|
|
6
|
+
value: string;
|
|
7
|
+
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
8
|
+
onBlur: (e: FocusEvent<HTMLInputElement>) => void;
|
|
9
|
+
onCompositionStart: (e: CompositionEvent<HTMLInputElement>) => void;
|
|
10
|
+
onCompositionEnd: (e: CompositionEvent<HTMLInputElement>) => void;
|
|
11
|
+
error: string | null;
|
|
12
|
+
isValidating: boolean;
|
|
13
|
+
isComposing: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface UseNameFieldOptions {
|
|
16
|
+
kanaMode: 'auto-convert' | 'error-on-hiragana';
|
|
17
|
+
normalizeOn?: NormalizeOn;
|
|
18
|
+
validateOn?: ValidateOn;
|
|
19
|
+
errorMessages?: {
|
|
20
|
+
katakanaOnly?: string;
|
|
21
|
+
invalidFormat?: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
interface UseNameFieldReturn extends BaseFieldReturn {
|
|
25
|
+
}
|
|
26
|
+
interface UsePostalCodeFieldOptions {
|
|
27
|
+
widthMode: 'full-width-only' | 'half-width-only';
|
|
28
|
+
onInvalid: 'error' | 'auto-convert';
|
|
29
|
+
autoHyphen?: boolean;
|
|
30
|
+
normalizeOn?: NormalizeOn;
|
|
31
|
+
validateOn?: ValidateOn;
|
|
32
|
+
errorMessages?: {
|
|
33
|
+
invalidWidth?: string;
|
|
34
|
+
invalidFormat?: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
interface UsePostalCodeFieldReturn extends BaseFieldReturn {
|
|
38
|
+
}
|
|
39
|
+
interface UsePrefectureFieldOptions {
|
|
40
|
+
autoComplete?: boolean;
|
|
41
|
+
normalizeOn?: NormalizeOn;
|
|
42
|
+
validateOn?: ValidateOn;
|
|
43
|
+
errorMessages?: {
|
|
44
|
+
invalidPrefecture?: string;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
interface UsePrefectureFieldReturn extends BaseFieldReturn {
|
|
48
|
+
}
|
|
49
|
+
interface UseAddressFieldOptions {
|
|
50
|
+
alphanumericMode: 'full-width-only' | 'allow-half-width';
|
|
51
|
+
onInvalid: 'error' | 'auto-convert';
|
|
52
|
+
normalizeOn?: NormalizeOn;
|
|
53
|
+
validateOn?: ValidateOn;
|
|
54
|
+
errorMessages?: {
|
|
55
|
+
invalidWidth?: string;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
interface UseAddressFieldReturn extends BaseFieldReturn {
|
|
59
|
+
}
|
|
60
|
+
interface UsePhoneNumberFieldOptions {
|
|
61
|
+
widthMode?: 'half-width-only';
|
|
62
|
+
onInvalid: 'error' | 'auto-convert';
|
|
63
|
+
autoHyphen?: boolean;
|
|
64
|
+
normalizeOn?: NormalizeOn;
|
|
65
|
+
validateOn?: ValidateOn;
|
|
66
|
+
errorMessages?: {
|
|
67
|
+
invalidWidth?: string;
|
|
68
|
+
invalidFormat?: string;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
interface UsePhoneNumberFieldReturn extends BaseFieldReturn {
|
|
72
|
+
}
|
|
73
|
+
declare const defaultErrorMessages: {
|
|
74
|
+
katakanaOnly: string;
|
|
75
|
+
hiraganaOnly: string;
|
|
76
|
+
invalidPostalCode: string;
|
|
77
|
+
invalidPrefecture: string;
|
|
78
|
+
invalidPhoneNumber: string;
|
|
79
|
+
invalidWidth: string;
|
|
80
|
+
invalidFormat: string;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
declare function useNameField(options: UseNameFieldOptions): UseNameFieldReturn;
|
|
84
|
+
|
|
85
|
+
declare function usePostalCodeField(options: UsePostalCodeFieldOptions): UsePostalCodeFieldReturn;
|
|
86
|
+
|
|
87
|
+
declare function usePrefectureField(options?: UsePrefectureFieldOptions): UsePrefectureFieldReturn;
|
|
88
|
+
|
|
89
|
+
declare function useAddressField(options: UseAddressFieldOptions): UseAddressFieldReturn;
|
|
90
|
+
|
|
91
|
+
declare function usePhoneNumberField(options: UsePhoneNumberFieldOptions): UsePhoneNumberFieldReturn;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Validates if the string contains only Katakana characters
|
|
95
|
+
* Allows full-width Katakana (ァ-ヶ), prolonged sound mark (ー), and spaces
|
|
96
|
+
*/
|
|
97
|
+
declare function validateKatakana(value: string): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Checks if the string contains any Hiragana characters
|
|
100
|
+
*/
|
|
101
|
+
declare function containsHiragana(value: string): boolean;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Validates if the string contains only Hiragana characters
|
|
105
|
+
* Allows Hiragana (ぁ-ゖ), prolonged sound mark (ー), and spaces
|
|
106
|
+
*/
|
|
107
|
+
declare function validateHiragana(value: string): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Checks if the string contains any Katakana characters
|
|
110
|
+
*/
|
|
111
|
+
declare function containsKatakana(value: string): boolean;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Validates Japanese postal code format
|
|
115
|
+
* Accepts: 123-4567, 1234567, 123-4567, 1234567
|
|
116
|
+
*/
|
|
117
|
+
declare function validatePostalCode(value: string): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Checks if postal code contains only half-width characters
|
|
120
|
+
*/
|
|
121
|
+
declare function isHalfWidthPostalCode(value: string): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Checks if postal code contains only full-width characters
|
|
124
|
+
*/
|
|
125
|
+
declare function isFullWidthPostalCode(value: string): boolean;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* List of all 47 prefectures in Japan
|
|
129
|
+
*/
|
|
130
|
+
declare const PREFECTURES: readonly ["北海道", "青森県", "岩手県", "宮城県", "秋田県", "山形県", "福島県", "茨城県", "栃木県", "群馬県", "埼玉県", "千葉県", "東京都", "神奈川県", "新潟県", "富山県", "石川県", "福井県", "山梨県", "長野県", "岐阜県", "静岡県", "愛知県", "三重県", "滋賀県", "京都府", "大阪府", "兵庫県", "奈良県", "和歌山県", "鳥取県", "島根県", "岡山県", "広島県", "山口県", "徳島県", "香川県", "愛媛県", "高知県", "福岡県", "佐賀県", "長崎県", "熊本県", "大分県", "宮崎県", "鹿児島県", "沖縄県"];
|
|
131
|
+
type Prefecture = (typeof PREFECTURES)[number];
|
|
132
|
+
/**
|
|
133
|
+
* Short names for prefectures (without suffix)
|
|
134
|
+
*/
|
|
135
|
+
declare const PREFECTURE_SHORT_NAMES: Record<string, Prefecture>;
|
|
136
|
+
/**
|
|
137
|
+
* Validates if the value is a valid Japanese prefecture
|
|
138
|
+
*/
|
|
139
|
+
declare function validatePrefecture(value: string): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Normalizes prefecture name to full name
|
|
142
|
+
* e.g., "東京" -> "東京都", "大阪" -> "大阪府"
|
|
143
|
+
*/
|
|
144
|
+
declare function normalizePrefecture(value: string): string;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Validates Japanese phone number format
|
|
148
|
+
* Accepts various formats: 03-1234-5678, 090-1234-5678, 0312345678, etc.
|
|
149
|
+
*/
|
|
150
|
+
declare function validatePhoneNumber(value: string): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Checks if phone number contains only half-width characters
|
|
153
|
+
*/
|
|
154
|
+
declare function isHalfWidthPhoneNumber(value: string): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Checks if phone number contains full-width characters
|
|
157
|
+
*/
|
|
158
|
+
declare function containsFullWidthPhoneNumber(value: string): boolean;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Converts Hiragana to Katakana
|
|
162
|
+
* ひらがな (U+3040-U+309F) -> カタカナ (U+30A0-U+30FF)
|
|
163
|
+
*/
|
|
164
|
+
declare function toKatakana(value: string): string;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Converts Katakana to Hiragana
|
|
168
|
+
* カタカナ (U+30A0-U+30FF) -> ひらがな (U+3040-U+309F)
|
|
169
|
+
* Note: Some Katakana characters don't have Hiragana equivalents
|
|
170
|
+
*/
|
|
171
|
+
declare function toHiragana(value: string): string;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Converts half-width alphanumeric and symbols to full-width
|
|
175
|
+
* ASCII (U+0021-U+007E) -> Full-width (U+FF01-U+FF5E)
|
|
176
|
+
*/
|
|
177
|
+
declare function toFullWidth(value: string): string;
|
|
178
|
+
/**
|
|
179
|
+
* Converts only half-width numbers to full-width
|
|
180
|
+
* 0-9 -> 0-9
|
|
181
|
+
*/
|
|
182
|
+
declare function toFullWidthNumbers(value: string): string;
|
|
183
|
+
/**
|
|
184
|
+
* Converts half-width hyphen to full-width
|
|
185
|
+
*/
|
|
186
|
+
declare function toFullWidthHyphen(value: string): string;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Converts full-width alphanumeric and symbols to half-width
|
|
190
|
+
* Full-width (U+FF01-U+FF5E) -> ASCII (U+0021-U+007E)
|
|
191
|
+
*/
|
|
192
|
+
declare function toHalfWidth(value: string): string;
|
|
193
|
+
/**
|
|
194
|
+
* Converts only full-width numbers to half-width
|
|
195
|
+
* 0-9 -> 0-9
|
|
196
|
+
*/
|
|
197
|
+
declare function toHalfWidthNumbers(value: string): string;
|
|
198
|
+
/**
|
|
199
|
+
* Converts full-width hyphen/dash to half-width
|
|
200
|
+
*/
|
|
201
|
+
declare function toHalfWidthHyphen(value: string): string;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Adds hyphen to postal code
|
|
205
|
+
* 1234567 -> 123-4567
|
|
206
|
+
* Also normalizes to half-width
|
|
207
|
+
*/
|
|
208
|
+
declare function addPostalCodeHyphen(value: string): string;
|
|
209
|
+
/**
|
|
210
|
+
* Adds hyphens to phone number
|
|
211
|
+
* Handles various Japanese phone number formats
|
|
212
|
+
* Also normalizes to half-width
|
|
213
|
+
*/
|
|
214
|
+
declare function addPhoneNumberHyphen(value: string): string;
|
|
215
|
+
|
|
216
|
+
export { type BaseFieldReturn, type NormalizeOn, PREFECTURES, PREFECTURE_SHORT_NAMES, type Prefecture, type UseAddressFieldOptions, type UseAddressFieldReturn, type UseNameFieldOptions, type UseNameFieldReturn, type UsePhoneNumberFieldOptions, type UsePhoneNumberFieldReturn, type UsePostalCodeFieldOptions, type UsePostalCodeFieldReturn, type UsePrefectureFieldOptions, type UsePrefectureFieldReturn, type ValidateOn, addPhoneNumberHyphen, addPostalCodeHyphen, containsFullWidthPhoneNumber, containsHiragana, containsKatakana, defaultErrorMessages, isFullWidthPostalCode, isHalfWidthPhoneNumber, isHalfWidthPostalCode, normalizePrefecture, toFullWidth, toFullWidthHyphen, toFullWidthNumbers, toHalfWidth, toHalfWidthHyphen, toHalfWidthNumbers, toHiragana, toKatakana, useAddressField, useNameField, usePhoneNumberField, usePostalCodeField, usePrefectureField, validateHiragana, validateKatakana, validatePhoneNumber, validatePostalCode, validatePrefecture };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { ChangeEvent, FocusEvent, CompositionEvent } from 'react';
|
|
2
|
+
|
|
3
|
+
type NormalizeOn = 'blur' | 'compositionEnd' | 'change';
|
|
4
|
+
type ValidateOn = 'blur' | 'change' | 'submit';
|
|
5
|
+
interface BaseFieldReturn {
|
|
6
|
+
value: string;
|
|
7
|
+
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
8
|
+
onBlur: (e: FocusEvent<HTMLInputElement>) => void;
|
|
9
|
+
onCompositionStart: (e: CompositionEvent<HTMLInputElement>) => void;
|
|
10
|
+
onCompositionEnd: (e: CompositionEvent<HTMLInputElement>) => void;
|
|
11
|
+
error: string | null;
|
|
12
|
+
isValidating: boolean;
|
|
13
|
+
isComposing: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface UseNameFieldOptions {
|
|
16
|
+
kanaMode: 'auto-convert' | 'error-on-hiragana';
|
|
17
|
+
normalizeOn?: NormalizeOn;
|
|
18
|
+
validateOn?: ValidateOn;
|
|
19
|
+
errorMessages?: {
|
|
20
|
+
katakanaOnly?: string;
|
|
21
|
+
invalidFormat?: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
interface UseNameFieldReturn extends BaseFieldReturn {
|
|
25
|
+
}
|
|
26
|
+
interface UsePostalCodeFieldOptions {
|
|
27
|
+
widthMode: 'full-width-only' | 'half-width-only';
|
|
28
|
+
onInvalid: 'error' | 'auto-convert';
|
|
29
|
+
autoHyphen?: boolean;
|
|
30
|
+
normalizeOn?: NormalizeOn;
|
|
31
|
+
validateOn?: ValidateOn;
|
|
32
|
+
errorMessages?: {
|
|
33
|
+
invalidWidth?: string;
|
|
34
|
+
invalidFormat?: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
interface UsePostalCodeFieldReturn extends BaseFieldReturn {
|
|
38
|
+
}
|
|
39
|
+
interface UsePrefectureFieldOptions {
|
|
40
|
+
autoComplete?: boolean;
|
|
41
|
+
normalizeOn?: NormalizeOn;
|
|
42
|
+
validateOn?: ValidateOn;
|
|
43
|
+
errorMessages?: {
|
|
44
|
+
invalidPrefecture?: string;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
interface UsePrefectureFieldReturn extends BaseFieldReturn {
|
|
48
|
+
}
|
|
49
|
+
interface UseAddressFieldOptions {
|
|
50
|
+
alphanumericMode: 'full-width-only' | 'allow-half-width';
|
|
51
|
+
onInvalid: 'error' | 'auto-convert';
|
|
52
|
+
normalizeOn?: NormalizeOn;
|
|
53
|
+
validateOn?: ValidateOn;
|
|
54
|
+
errorMessages?: {
|
|
55
|
+
invalidWidth?: string;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
interface UseAddressFieldReturn extends BaseFieldReturn {
|
|
59
|
+
}
|
|
60
|
+
interface UsePhoneNumberFieldOptions {
|
|
61
|
+
widthMode?: 'half-width-only';
|
|
62
|
+
onInvalid: 'error' | 'auto-convert';
|
|
63
|
+
autoHyphen?: boolean;
|
|
64
|
+
normalizeOn?: NormalizeOn;
|
|
65
|
+
validateOn?: ValidateOn;
|
|
66
|
+
errorMessages?: {
|
|
67
|
+
invalidWidth?: string;
|
|
68
|
+
invalidFormat?: string;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
interface UsePhoneNumberFieldReturn extends BaseFieldReturn {
|
|
72
|
+
}
|
|
73
|
+
declare const defaultErrorMessages: {
|
|
74
|
+
katakanaOnly: string;
|
|
75
|
+
hiraganaOnly: string;
|
|
76
|
+
invalidPostalCode: string;
|
|
77
|
+
invalidPrefecture: string;
|
|
78
|
+
invalidPhoneNumber: string;
|
|
79
|
+
invalidWidth: string;
|
|
80
|
+
invalidFormat: string;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
declare function useNameField(options: UseNameFieldOptions): UseNameFieldReturn;
|
|
84
|
+
|
|
85
|
+
declare function usePostalCodeField(options: UsePostalCodeFieldOptions): UsePostalCodeFieldReturn;
|
|
86
|
+
|
|
87
|
+
declare function usePrefectureField(options?: UsePrefectureFieldOptions): UsePrefectureFieldReturn;
|
|
88
|
+
|
|
89
|
+
declare function useAddressField(options: UseAddressFieldOptions): UseAddressFieldReturn;
|
|
90
|
+
|
|
91
|
+
declare function usePhoneNumberField(options: UsePhoneNumberFieldOptions): UsePhoneNumberFieldReturn;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Validates if the string contains only Katakana characters
|
|
95
|
+
* Allows full-width Katakana (ァ-ヶ), prolonged sound mark (ー), and spaces
|
|
96
|
+
*/
|
|
97
|
+
declare function validateKatakana(value: string): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Checks if the string contains any Hiragana characters
|
|
100
|
+
*/
|
|
101
|
+
declare function containsHiragana(value: string): boolean;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Validates if the string contains only Hiragana characters
|
|
105
|
+
* Allows Hiragana (ぁ-ゖ), prolonged sound mark (ー), and spaces
|
|
106
|
+
*/
|
|
107
|
+
declare function validateHiragana(value: string): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Checks if the string contains any Katakana characters
|
|
110
|
+
*/
|
|
111
|
+
declare function containsKatakana(value: string): boolean;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Validates Japanese postal code format
|
|
115
|
+
* Accepts: 123-4567, 1234567, 123-4567, 1234567
|
|
116
|
+
*/
|
|
117
|
+
declare function validatePostalCode(value: string): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Checks if postal code contains only half-width characters
|
|
120
|
+
*/
|
|
121
|
+
declare function isHalfWidthPostalCode(value: string): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Checks if postal code contains only full-width characters
|
|
124
|
+
*/
|
|
125
|
+
declare function isFullWidthPostalCode(value: string): boolean;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* List of all 47 prefectures in Japan
|
|
129
|
+
*/
|
|
130
|
+
declare const PREFECTURES: readonly ["北海道", "青森県", "岩手県", "宮城県", "秋田県", "山形県", "福島県", "茨城県", "栃木県", "群馬県", "埼玉県", "千葉県", "東京都", "神奈川県", "新潟県", "富山県", "石川県", "福井県", "山梨県", "長野県", "岐阜県", "静岡県", "愛知県", "三重県", "滋賀県", "京都府", "大阪府", "兵庫県", "奈良県", "和歌山県", "鳥取県", "島根県", "岡山県", "広島県", "山口県", "徳島県", "香川県", "愛媛県", "高知県", "福岡県", "佐賀県", "長崎県", "熊本県", "大分県", "宮崎県", "鹿児島県", "沖縄県"];
|
|
131
|
+
type Prefecture = (typeof PREFECTURES)[number];
|
|
132
|
+
/**
|
|
133
|
+
* Short names for prefectures (without suffix)
|
|
134
|
+
*/
|
|
135
|
+
declare const PREFECTURE_SHORT_NAMES: Record<string, Prefecture>;
|
|
136
|
+
/**
|
|
137
|
+
* Validates if the value is a valid Japanese prefecture
|
|
138
|
+
*/
|
|
139
|
+
declare function validatePrefecture(value: string): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Normalizes prefecture name to full name
|
|
142
|
+
* e.g., "東京" -> "東京都", "大阪" -> "大阪府"
|
|
143
|
+
*/
|
|
144
|
+
declare function normalizePrefecture(value: string): string;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Validates Japanese phone number format
|
|
148
|
+
* Accepts various formats: 03-1234-5678, 090-1234-5678, 0312345678, etc.
|
|
149
|
+
*/
|
|
150
|
+
declare function validatePhoneNumber(value: string): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Checks if phone number contains only half-width characters
|
|
153
|
+
*/
|
|
154
|
+
declare function isHalfWidthPhoneNumber(value: string): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Checks if phone number contains full-width characters
|
|
157
|
+
*/
|
|
158
|
+
declare function containsFullWidthPhoneNumber(value: string): boolean;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Converts Hiragana to Katakana
|
|
162
|
+
* ひらがな (U+3040-U+309F) -> カタカナ (U+30A0-U+30FF)
|
|
163
|
+
*/
|
|
164
|
+
declare function toKatakana(value: string): string;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Converts Katakana to Hiragana
|
|
168
|
+
* カタカナ (U+30A0-U+30FF) -> ひらがな (U+3040-U+309F)
|
|
169
|
+
* Note: Some Katakana characters don't have Hiragana equivalents
|
|
170
|
+
*/
|
|
171
|
+
declare function toHiragana(value: string): string;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Converts half-width alphanumeric and symbols to full-width
|
|
175
|
+
* ASCII (U+0021-U+007E) -> Full-width (U+FF01-U+FF5E)
|
|
176
|
+
*/
|
|
177
|
+
declare function toFullWidth(value: string): string;
|
|
178
|
+
/**
|
|
179
|
+
* Converts only half-width numbers to full-width
|
|
180
|
+
* 0-9 -> 0-9
|
|
181
|
+
*/
|
|
182
|
+
declare function toFullWidthNumbers(value: string): string;
|
|
183
|
+
/**
|
|
184
|
+
* Converts half-width hyphen to full-width
|
|
185
|
+
*/
|
|
186
|
+
declare function toFullWidthHyphen(value: string): string;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Converts full-width alphanumeric and symbols to half-width
|
|
190
|
+
* Full-width (U+FF01-U+FF5E) -> ASCII (U+0021-U+007E)
|
|
191
|
+
*/
|
|
192
|
+
declare function toHalfWidth(value: string): string;
|
|
193
|
+
/**
|
|
194
|
+
* Converts only full-width numbers to half-width
|
|
195
|
+
* 0-9 -> 0-9
|
|
196
|
+
*/
|
|
197
|
+
declare function toHalfWidthNumbers(value: string): string;
|
|
198
|
+
/**
|
|
199
|
+
* Converts full-width hyphen/dash to half-width
|
|
200
|
+
*/
|
|
201
|
+
declare function toHalfWidthHyphen(value: string): string;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Adds hyphen to postal code
|
|
205
|
+
* 1234567 -> 123-4567
|
|
206
|
+
* Also normalizes to half-width
|
|
207
|
+
*/
|
|
208
|
+
declare function addPostalCodeHyphen(value: string): string;
|
|
209
|
+
/**
|
|
210
|
+
* Adds hyphens to phone number
|
|
211
|
+
* Handles various Japanese phone number formats
|
|
212
|
+
* Also normalizes to half-width
|
|
213
|
+
*/
|
|
214
|
+
declare function addPhoneNumberHyphen(value: string): string;
|
|
215
|
+
|
|
216
|
+
export { type BaseFieldReturn, type NormalizeOn, PREFECTURES, PREFECTURE_SHORT_NAMES, type Prefecture, type UseAddressFieldOptions, type UseAddressFieldReturn, type UseNameFieldOptions, type UseNameFieldReturn, type UsePhoneNumberFieldOptions, type UsePhoneNumberFieldReturn, type UsePostalCodeFieldOptions, type UsePostalCodeFieldReturn, type UsePrefectureFieldOptions, type UsePrefectureFieldReturn, type ValidateOn, addPhoneNumberHyphen, addPostalCodeHyphen, containsFullWidthPhoneNumber, containsHiragana, containsKatakana, defaultErrorMessages, isFullWidthPostalCode, isHalfWidthPhoneNumber, isHalfWidthPostalCode, normalizePrefecture, toFullWidth, toFullWidthHyphen, toFullWidthNumbers, toHalfWidth, toHalfWidthHyphen, toHalfWidthNumbers, toHiragana, toKatakana, useAddressField, useNameField, usePhoneNumberField, usePostalCodeField, usePrefectureField, validateHiragana, validateKatakana, validatePhoneNumber, validatePostalCode, validatePrefecture };
|