use-mask-input 3.6.0 → 3.7.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +53 -76
  2. package/README.md +2 -251
  3. package/dist/antd/index.cjs +67 -0
  4. package/dist/antd/index.cjs.map +1 -0
  5. package/dist/antd/index.d.cts +37 -0
  6. package/dist/antd/index.d.ts +37 -0
  7. package/dist/antd/index.js +64 -0
  8. package/dist/antd/index.js.map +1 -0
  9. package/dist/chunk-4Y2DTPBL.cjs +3841 -0
  10. package/dist/chunk-4Y2DTPBL.cjs.map +1 -0
  11. package/dist/chunk-JGOZSJMW.js +3829 -0
  12. package/dist/chunk-JGOZSJMW.js.map +1 -0
  13. package/dist/index-F3rlTTTe.d.cts +583 -0
  14. package/dist/index-F3rlTTTe.d.ts +583 -0
  15. package/dist/index.cjs +72 -3870
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +48 -585
  18. package/dist/index.d.ts +48 -585
  19. package/dist/index.js +72 -3870
  20. package/dist/index.js.map +1 -1
  21. package/package.json +27 -21
  22. package/src/antd/index.ts +9 -0
  23. package/src/antd/useHookFormMaskAntd.spec.ts +142 -0
  24. package/src/antd/useHookFormMaskAntd.ts +57 -0
  25. package/src/antd/useMaskInputAntd-server.spec.tsx +36 -0
  26. package/src/antd/useMaskInputAntd.spec.tsx +108 -0
  27. package/src/antd/useMaskInputAntd.ts +77 -0
  28. package/src/api/index.ts +4 -0
  29. package/src/api/useHookFormMask.spec.ts +146 -0
  30. package/src/api/useHookFormMask.ts +56 -0
  31. package/src/api/useMaskInput-server.spec.tsx +30 -0
  32. package/src/api/useMaskInput.spec.tsx +220 -0
  33. package/src/api/useMaskInput.ts +73 -0
  34. package/src/api/withHookFormMask.spec.ts +155 -0
  35. package/src/api/withHookFormMask.ts +54 -0
  36. package/src/api/withMask.spec.ts +93 -0
  37. package/src/api/withMask.ts +25 -0
  38. package/src/core/elementResolver.spec.ts +175 -0
  39. package/src/core/elementResolver.ts +84 -0
  40. package/src/core/index.ts +3 -0
  41. package/src/core/maskConfig.spec.ts +183 -0
  42. package/src/core/maskConfig.ts +56 -0
  43. package/src/core/maskEngine.spec.ts +108 -0
  44. package/src/core/maskEngine.ts +47 -0
  45. package/src/index.tsx +12 -5
  46. package/src/{types.ts → types/index.ts} +13 -0
  47. package/src/utils/flow.spec.ts +27 -30
  48. package/src/utils/flow.ts +2 -2
  49. package/src/utils/index.ts +1 -1
  50. package/src/utils/isServer.spec.ts +15 -0
  51. package/src/utils/moduleInterop.spec.ts +37 -0
  52. package/src/useHookFormMask.ts +0 -47
  53. package/src/useMaskInput.ts +0 -41
  54. package/src/utils/getMaskOptions.spec.ts +0 -126
  55. package/src/utils/getMaskOptions.ts +0 -94
  56. package/src/withHookFormMask.ts +0 -34
  57. package/src/withMask.ts +0 -18
  58. /package/src/{inputmask.types.ts → types/inputmask.types.ts} +0 -0
@@ -0,0 +1,583 @@
1
+ import { RefCallback } from 'react';
2
+ import { FieldValues, UseFormRegisterReturn, Path } from 'react-hook-form';
3
+
4
+ type Range = {
5
+ start: string;
6
+ end: string;
7
+ } | [string, string];
8
+ type PositionCaretOnClick = 'none' | 'lvp' | 'radixFocus' | 'select' | 'ignore';
9
+ type InputMode = 'verbatim' | 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';
10
+ type Casing = 'upper' | 'lower' | 'title';
11
+ type DefinitionValidator = (chrs: string, maskset: any, pos: number, strict: boolean, opts: Options$1) => boolean | CommandObject;
12
+ interface Options$1 {
13
+ /**
14
+ * Change the mask placeholder. Instead of "_", you can change the unfilled
15
+ * characters mask as you like, simply by adding the placeholder option.
16
+ * For example, placeholder: " " will change the default autofill with empty
17
+ * values.
18
+ *
19
+ * @default "_"
20
+ */
21
+ placeholder?: string | undefined;
22
+ /**
23
+ * Definition of the symbols used to indicate an optional part in the mask.
24
+ *
25
+ * @default { start: "[", end: "]" }
26
+ */
27
+ optionalmarker?: Range | undefined;
28
+ /**
29
+ * Definition of the symbols used to indicate a quantifier in the mask.
30
+ *
31
+ * @default { start: "{", end: "}" }
32
+ */
33
+ quantifiermarker?: Range | undefined;
34
+ /**
35
+ * Definition of the symbols used to indicate a group in the mask.
36
+ *
37
+ * @default { start: "(", end: ")" }
38
+ */
39
+ groupmarker?: Range | undefined;
40
+ /**
41
+ * Definition of the symbols used to indicate an alternator part in the mask.
42
+ *
43
+ * @default "|"
44
+ */
45
+ alternatormarker?: string | undefined;
46
+ /**
47
+ * Definition of the symbols used to escape a part in the mask.
48
+ *
49
+ * @default "\\"
50
+ */
51
+ escapeChar?: string | undefined;
52
+ /**
53
+ * The mask to use.
54
+ */
55
+ mask?: string | string[] | ((opts: Options$1) => string | string[]) | undefined;
56
+ /**
57
+ * Use a regular expression as a mask. When using shorthands be aware that you need to double escape or use
58
+ * String.raw with a string literal.
59
+ */
60
+ regex?: string | undefined;
61
+ /**
62
+ * Execute a function when the mask is completed.
63
+ */
64
+ oncomplete?: (() => void) | undefined;
65
+ /**
66
+ * Execute a function when the mask is cleared.
67
+ */
68
+ onincomplete?: (() => void) | undefined;
69
+ /**
70
+ * Execute a function when the mask is cleared.
71
+ */
72
+ oncleared?: (() => void) | undefined;
73
+ /**
74
+ * Mask repeat function. Repeat the mask definition x-times.
75
+ * `*` ~ forever, otherwise specify an integer
76
+ *
77
+ * @default 0
78
+ */
79
+ repeat?: number | string | undefined;
80
+ /**
81
+ * Toggle to allocate as much possible or the opposite. Non-greedy repeat function. With the non-greedy option
82
+ * set to `false`, you can specify `*` as repeat. This makes an endless repeat.
83
+ *
84
+ * @default false
85
+ */
86
+ greedy?: boolean | undefined;
87
+ /**
88
+ * Automatically unmask the value when retrieved.
89
+ *
90
+ * When setting this option to true the plugin also expects the initial value from the server to be unmasked.
91
+ *
92
+ * @default false
93
+ */
94
+ autoUnmask?: boolean | undefined;
95
+ /**
96
+ * Remove the mask before submitting the form.
97
+ *
98
+ * @default false
99
+ */
100
+ removeMaskOnSubmit?: boolean | undefined;
101
+ /**
102
+ * Remove the empty mask on blur or when not empty remove the optional trailing part.
103
+ *
104
+ * @default true
105
+ */
106
+ clearMaskOnLostFocus?: boolean | undefined;
107
+ /**
108
+ * Toggle to insert or overwrite input. This option can be altered by pressing the Insert key.
109
+ *
110
+ * @default true
111
+ */
112
+ insertMode?: boolean | undefined;
113
+ /**
114
+ * Show selected caret when `insertMode = false`.
115
+ *
116
+ * @default true
117
+ */
118
+ insertModeVisual?: boolean | undefined;
119
+ /**
120
+ * Clear the incomplete input on blur.
121
+ *
122
+ * @default false
123
+ */
124
+ clearIncomplete?: boolean | undefined;
125
+ /**
126
+ * The alias to use.
127
+ *
128
+ * @default null
129
+ */
130
+ alias?: string | undefined;
131
+ /**
132
+ * Callback to implement autocomplete on certain keys for example.
133
+ */
134
+ onKeyDown?: ((event: KeyboardEvent, buffer: string[], caretPos: {
135
+ begin: number;
136
+ end: number;
137
+ }, opts: Options$1) => void) | undefined;
138
+ /**
139
+ * Executes before masking the initial value to allow preprocessing of the initial value.
140
+ */
141
+ onBeforeMask?: ((initialValue: string, opts: Options$1) => string) | undefined;
142
+ /**
143
+ * This callback allows for preprocessing the pasted value before actually handling the value for masking.
144
+ * This can be useful for stripping away some characters before processing. You can also disable pasting
145
+ * a value by returning false in the `onBeforePaste` call.
146
+ */
147
+ onBeforePaste?: ((pastedValue: string, opts: Options$1) => string) | undefined;
148
+ /**
149
+ * Executes before writing to the masked element. Use this to do some extra processing of the input. This can
150
+ * be useful when implementing an alias, ex. decimal alias, autofill the digits when leaving the inputfield.
151
+ */
152
+ onBeforeWrite?: ((event: KeyboardEvent, buffer: string[], caretPos: number, opts: Options$1) => CommandObject) | undefined;
153
+ /**
154
+ * Executes after unmasking to allow post-processing of the unmaskedvalue.
155
+ *
156
+ * @returns New unmasked value
157
+ */
158
+ onUnMask?: ((maskedValue: string, unmaskedValue: string) => string) | undefined;
159
+ /**
160
+ * Shows the mask when the input gets focus.
161
+ *
162
+ * @default true
163
+ */
164
+ showMaskOnFocus?: boolean | undefined;
165
+ /**
166
+ * Shows the mask when the input is hevered by the mouse cursor.
167
+ *
168
+ * @default true
169
+ */
170
+ showMaskOnHover?: boolean | undefined;
171
+ /**
172
+ * Callback function is executed on every keyvalidation with the key, result as the parameter.
173
+ */
174
+ onKeyValidation?: ((key: number, result: boolean) => void) | undefined;
175
+ /**
176
+ * A character which can be used to skip an optional part of a mask.
177
+ *
178
+ * @default " "
179
+ */
180
+ skipOptionalPartCharacter?: string | undefined;
181
+ /**
182
+ * Numeric input direction. Keeps the caret at the end.
183
+ *
184
+ * @default false
185
+ */
186
+ numericInput?: boolean | undefined;
187
+ /**
188
+ * Align the input to the right
189
+ *
190
+ * By setting the rightAlign you can specify to right-align an inputmask. This is only applied in combination of
191
+ * the `numericInput` option or the `dir-attribute`.
192
+ *
193
+ * @default true
194
+ */
195
+ rightAlign?: boolean | undefined;
196
+ /**
197
+ * Make escape behave like undo. (ctrl-Z) Pressing escape reverts the value to the value before focus.
198
+ *
199
+ * @default true
200
+ */
201
+ undoOnEscape?: boolean | undefined;
202
+ /**
203
+ * Define the radixpoint (decimal separator)
204
+ *
205
+ * @default ""
206
+ */
207
+ radixPoint?: string | undefined;
208
+ /**
209
+ * Define the groupseparator.
210
+ *
211
+ * @default ""
212
+ */
213
+ groupSeparator?: string | undefined;
214
+ /**
215
+ * Use in combination with the alternator syntax Try to keep the mask static while typing. Decisions to alter the
216
+ * mask will be postponed if possible.
217
+ *
218
+ * ex. $(selector).inputmask({ mask: ["+55-99-9999-9999", "+55-99-99999-9999", ], keepStatic: true });
219
+ *
220
+ * typing 1212345123 => should result in +55-12-1234-5123 type extra 4 => switch to +55-12-12345-1234
221
+ *
222
+ * When the option is not set, it will default to `false`, except for multiple masks it will default to `true`!
223
+ */
224
+ keepStatic?: boolean | null | undefined;
225
+ /**
226
+ * When enabled the caret position is set after the latest valid position on TAB.
227
+ *
228
+ * @default true
229
+ */
230
+ positionCaretOnTab?: boolean | undefined;
231
+ /**
232
+ * Allows for tabbing through the different parts of the masked field.
233
+ *
234
+ * @default false
235
+ */
236
+ tabThrough?: boolean | undefined;
237
+ /**
238
+ * List with the supported input types
239
+ *
240
+ * @default ["text", "tel", "url", "password", "search"]
241
+ */
242
+ supportsInputType?: string[] | undefined;
243
+ /**
244
+ * Specify keyCodes which should not be considered in the keypress event, otherwise the `preventDefault` will
245
+ * stop their default behavior especially in FF.
246
+ */
247
+ ignorables?: number[] | undefined;
248
+ /**
249
+ * With this call-in (hook) you can override the default implementation of the isComplete function.
250
+ */
251
+ isComplete?: ((buffer: string[], opts: Options$1) => boolean) | undefined;
252
+ /**
253
+ * Hook to postValidate the result from `isValid`. Useful for validating the entry as a whole.
254
+ */
255
+ postValidation?: ((buffer: string[], pos: number, char: string, currentResult: boolean, opts: Options$1, maskset: any, strict: boolean, fromCheckval: boolean) => boolean | CommandObject) | undefined;
256
+ /**
257
+ * Hook to preValidate the input. Useful for validating regardless of the definition.
258
+ *
259
+ * When returning `true`, the normal validation kicks in, otherwise, it is skipped.
260
+ *
261
+ * When returning a command object the actions are executed and further validation is stopped. If you want to
262
+ * continue further validation, you need to add the `rewritePosition` action.
263
+ */
264
+ preValidation?: ((buffer: string[], pos: number, char: string, isSelection: boolean, opts: Options$1, maskset: any, caretPos: {
265
+ begin: number;
266
+ end: number;
267
+ }, strict: boolean) => boolean | CommandObject) | undefined;
268
+ /**
269
+ * The `staticDefinitionSymbol` option is used to indicate that the static entries in the mask can match a
270
+ * certain definition. Especially useful with alternators so that static element in the mask can match
271
+ * another alternation.
272
+ *
273
+ * @default undefined
274
+ */
275
+ staticDefinitionSymbol?: string | undefined;
276
+ /**
277
+ * Just in time masking. With the `jitMasking` option you can enable jit masking. The mask will only be
278
+ * visible for the user entered characters.
279
+ *
280
+ * @default false
281
+ */
282
+ jitMasking?: boolean | undefined;
283
+ /**
284
+ * Return nothing from the input `value` property when the user hasn't entered anything. If this is false,
285
+ * the mask might be returned.
286
+ *
287
+ * @default true
288
+ */
289
+ nullable?: boolean | undefined;
290
+ /**
291
+ * Disable value property patching
292
+ *
293
+ * @default false
294
+ */
295
+ noValuePatching?: boolean | undefined;
296
+ /**
297
+ * Positioning of the caret on click.
298
+ *
299
+ * Options:
300
+ *
301
+ * * `none`
302
+ * * `lvp` - based on the last valid position (default)
303
+ * * `radixFocus` - position caret to radixpoint on initial click
304
+ * * `select` - select the whole input
305
+ * * `ignore` - ignore the click and continue the mask
306
+ *
307
+ * @default "lvp"
308
+ */
309
+ positionCaretOnClick?: PositionCaretOnClick | undefined;
310
+ /**
311
+ * Apply casing at the mask-level.
312
+ *
313
+ * @default undefined
314
+ */
315
+ casing?: Casing | undefined;
316
+ /**
317
+ * Specify the inputmode - already in place for when browsers start to support them
318
+ * https://html.spec.whatwg.org/#input-modalities:-the-inputmode-attribute
319
+ *
320
+ * @default "verbatim"
321
+ */
322
+ inputmode?: InputMode | undefined;
323
+ /**
324
+ * Specify to use the `data-inputmask` attributes or to ignore them.
325
+ *
326
+ * If you don't use data attributes you can disable the import by specifying `importDataAttributes: false`.
327
+ *
328
+ * @default true
329
+ */
330
+ importDataAttributes?: boolean | undefined;
331
+ /**
332
+ * Alter the behavior of the char shifting on entry or deletion.
333
+ *
334
+ * In some cases shifting the mask entries or deletion should be more restrictive.
335
+ *
336
+ * Ex. date masks. Shifting month to day makes no sense
337
+ *
338
+ * @default true
339
+ */
340
+ shiftPositions?: boolean | undefined;
341
+ /**
342
+ * Use the default defined definitions from the prototype.
343
+ *
344
+ * @default true
345
+ */
346
+ usePrototypeDefinitions?: boolean | undefined;
347
+ /**
348
+ * Minimum value. This needs to be in the same format as the `inputFormat` when used with the datetime alias.
349
+ */
350
+ min?: string | number | undefined;
351
+ /**
352
+ * Maximum value. This needs to be in the same format as the `inputFormat` when used with the datetime alias.
353
+ */
354
+ max?: string | number | undefined;
355
+ /**
356
+ * Number of fractionalDigits.
357
+ *
358
+ * Possible values:
359
+ *
360
+ * * A number describing the number of fractional digits.
361
+ * * `*`
362
+ * * Quantifier syntax like `2,4`. When the quantifier syntax is used, the `digitsOptional` option is ignored
363
+ *
364
+ * @default "*"
365
+ */
366
+ digits?: string | number | undefined;
367
+ /**
368
+ * Specify wheter the digits are optional.
369
+ *
370
+ * @default true
371
+ */
372
+ digitsOptional?: boolean | undefined;
373
+ /**
374
+ * Enforces the decimal part when leaving the input field.
375
+ *
376
+ * @default false
377
+ */
378
+ enforceDigitsOnBlur?: boolean | undefined;
379
+ /**
380
+ * Allow to enter -.
381
+ *
382
+ * @default true
383
+ */
384
+ allowMinus?: boolean | undefined;
385
+ /**
386
+ * Define your negationSymbol.
387
+ *
388
+ * @default { front: "-", back: "" }
389
+ */
390
+ negationSymbol?: {
391
+ front: string;
392
+ back: string;
393
+ } | undefined;
394
+ /**
395
+ * Define a prefix.
396
+ *
397
+ * @default ""
398
+ */
399
+ prefix?: string | undefined;
400
+ /**
401
+ * Define a suffix.
402
+ *
403
+ * @default ""
404
+ */
405
+ suffix?: string | undefined;
406
+ /**
407
+ * Set the maximum value when the user types a number which is greater that the value of max.
408
+ *
409
+ * @default false
410
+ */
411
+ SetMaxOnOverflow?: boolean | undefined;
412
+ /**
413
+ * Define the step the ctrl-up & ctrl-down must take.
414
+ *
415
+ * @default 1
416
+ */
417
+ step?: number | undefined;
418
+ /**
419
+ * Make unmasking returning a number instead of a string.
420
+ *
421
+ * Be warned that using the unmaskAsNumber option together with jQuery.serialize will fail as serialize expects a string. (See issue #1288)
422
+ *
423
+ * @default false
424
+ */
425
+ unmaskAsNumber?: boolean | undefined;
426
+ /**
427
+ * Indicates whether the value passed for initialization is text or a number.
428
+ *
429
+ * * `text` - radixpoint should be the same as in the options
430
+ * * `number` - radixpoint should be a . as the default for a number in js
431
+ *
432
+ * @default "text"
433
+ */
434
+ inputType?: 'text' | 'number' | undefined;
435
+ /**
436
+ * Set the function for rounding the values when set.
437
+ *
438
+ * Other examples:
439
+ * * `Math.floor`
440
+ * * `fn(x) { // do your own rounding logic // return x; }`
441
+ *
442
+ * @default Math.round
443
+ */
444
+ roundingFN?: ((input: number) => number) | undefined;
445
+ /**
446
+ * Define shortcuts. This will allow typing 1k => 1000, 2m => 2000000
447
+ *
448
+ * To disable just pass shortcuts: `null` as option
449
+ *
450
+ * @default {k: "000", m: "000000"}
451
+ */
452
+ shortcuts?: Record<string, string> | null | undefined;
453
+ /**
454
+ * Format used to input a date. This option is only effective for the datetime alias.
455
+ *
456
+ * Supported symbols
457
+ *
458
+ * * `d` - Day of the month as digits; no leading zero for single-digit days.
459
+ * * `dd` - Day of the month as digits; leading zero for single-digit days.
460
+ * * `ddd` - Day of the week as a three-letter abbreviation.
461
+ * * `dddd` - Day of the week as its full name.
462
+ * * `m` - Month as digits; no leading zero for single-digit months.
463
+ * * `mm` - Month as digits; leading zero for single-digit months.
464
+ * * `mmm` - Month as a three-letter abbreviation.
465
+ * * `mmmm` - Month as its full name.
466
+ * * `yy` - Year as last two digits; leading zero for years less than 10.
467
+ * * `yyyy` - Year as 4 digits.
468
+ * * `h` - Hours; no leading zero for single-digit hours (12-hour clock).
469
+ * * `hh` - Hours; leading zero for single-digit hours (12-hour clock).
470
+ * * `hx` - Hours; no limit; `x` = number of digits ~ use as h2, h3, ...
471
+ * * `H` - Hours; no leading zero for single-digit hours (24-hour clock).
472
+ * * `HH` - Hours; leading zero for single-digit hours (24-hour clock).
473
+ * * `Hx` - Hours; no limit; `x` = number of digits ~ use as H2, H3, ...
474
+ * * `M` - Minutes; no leading zero for single-digit minutes. Uppercase M unlike CF timeFormat's m to avoid
475
+ * conflict with months.
476
+ * * `MM` - Minutes; leading zero for single-digit minutes. Uppercase MM unlike CF timeFormat's mm to avoid
477
+ * conflict with months.
478
+ * * `s` - Seconds; no leading zero for single-digit seconds.
479
+ * * `ss` - Seconds; leading zero for single-digit seconds.
480
+ * * `l` - Milliseconds. 3 digits.
481
+ * * `L` - Milliseconds. 2 digits.
482
+ * * `t` - Lowercase, single-character time marker string: a or p.
483
+ * * `tt` - Two-character time marker string: am or pm.
484
+ * * `T` - Single-character time marker string: A or P.
485
+ * * `TT` - Two-character time marker string: AM or PM.
486
+ * * `Z` - US timezone abbreviation, e.g. EST or MDT. With non-US timezones or in the Opera browser, the
487
+ * GMT/UTC offset is returned, e.g. GMT-0500
488
+ * * `o` - GMT/UTC timezone offset, e.g. -0500 or +0230.
489
+ * * `S` - The date's ordinal suffix (st, nd, rd, or th). Works well with d.
490
+ *
491
+ * @default "isoDateTime"
492
+ */
493
+ inputFormat?: string | undefined;
494
+ /**
495
+ * Format of the unmasked value. This is only effective when used with the datetime alias.
496
+ */
497
+ outputFormat?: string | undefined;
498
+ /**
499
+ * Visual format when the input looses focus
500
+ */
501
+ displayFormat?: string | undefined;
502
+ /**
503
+ * Add new definitions to this inputmask.
504
+ */
505
+ definitions?: Record<string, Definition> | undefined;
506
+ /**
507
+ * Enable/disable prefilling of the year.
508
+ * Although you can just over type the proposed value without deleting, many seems to see a problem with the year prediction.
509
+ * This options is to disable this feature.
510
+ *
511
+ * @default true
512
+ */
513
+ prefillYear?: boolean | undefined;
514
+ }
515
+ interface Definition {
516
+ validator: string | DefinitionValidator;
517
+ casing?: Casing | undefined;
518
+ cardinality?: number | undefined;
519
+ placeholder?: string | undefined;
520
+ definitionSymbol?: string | undefined;
521
+ }
522
+ interface InsertPosition {
523
+ /**
524
+ * Position to insert.
525
+ */
526
+ pos: number;
527
+ /**
528
+ * Character to insert.
529
+ */
530
+ c: string;
531
+ /**
532
+ * @default true
533
+ */
534
+ fromIsValid?: boolean | undefined;
535
+ /**
536
+ * @default true
537
+ */
538
+ strict?: boolean | undefined;
539
+ }
540
+ interface CommandObject {
541
+ /**
542
+ * Position to insert.
543
+ */
544
+ pos?: number | undefined;
545
+ /**
546
+ * Character to insert.
547
+ */
548
+ c?: string | undefined;
549
+ /**
550
+ * Position of the caret.
551
+ */
552
+ caret?: number | undefined;
553
+ /**
554
+ * Position(s) to remove.
555
+ */
556
+ remove?: number | number[] | undefined;
557
+ /**
558
+ * Position(s) to add.
559
+ */
560
+ insert?: InsertPosition | InsertPosition[] | undefined;
561
+ /**
562
+ * * `true` => refresh validPositions from the complete buffer .
563
+ * * `{ start: , end: }` => refresh from start to end.
564
+ */
565
+ refreshFromBuffer?: true | {
566
+ start: number;
567
+ end: number;
568
+ } | undefined;
569
+ /**
570
+ * Rewrite the maskPos within the isvalid function.
571
+ */
572
+ rewritePosition?: number | undefined;
573
+ }
574
+
575
+ type Mask = 'datetime' | 'email' | 'numeric' | 'currency' | 'decimal' | 'integer' | 'percentage' | 'url' | 'ip' | 'mac' | 'ssn' | 'brl-currency' | 'cpf' | 'cnpj' | (string & {}) | (string[] & {}) | null;
576
+ type Options = Options$1;
577
+ type Input = HTMLInputElement | HTMLTextAreaElement | HTMLElement;
578
+ interface UseHookFormMaskReturn<T extends FieldValues> extends UseFormRegisterReturn<Path<T>> {
579
+ ref: RefCallback<HTMLElement | null>;
580
+ prevRef: RefCallback<HTMLElement | null>;
581
+ }
582
+
583
+ export type { Input as I, Mask as M, Options as O, UseHookFormMaskReturn as U };