@skbkontur/react-ui 6.1.4-05b51.0 → 6.1.4-ff219.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/components/Autocomplete/Autocomplete.js +3 -2
- package/components/Autocomplete/Autocomplete.js.map +1 -1
- package/components/FxInput/FxInput.js +2 -2
- package/components/FxInput/FxInput.js.map +1 -1
- package/components/Group/Group.js +2 -3
- package/components/Group/Group.js.map +1 -1
- package/components/Input/Input.d.ts +1 -1
- package/components/Input/Input.js.map +1 -1
- package/components/MaskedInput/MaskedInput.d.ts +2 -0
- package/components/MaskedInput/MaskedInput.js +6 -0
- package/components/MaskedInput/MaskedInput.js.map +1 -1
- package/components/MaskedInputV2/MaskedInputV2.d.ts +57 -0
- package/components/MaskedInputV2/MaskedInputV2.helpers.d.ts +9 -0
- package/components/MaskedInputV2/MaskedInputV2.helpers.js +17 -0
- package/components/MaskedInputV2/MaskedInputV2.helpers.js.map +1 -0
- package/components/MaskedInputV2/MaskedInputV2.js +234 -0
- package/components/MaskedInputV2/MaskedInputV2.js.map +1 -0
- package/{internal/TimeInput/TimeInput.styles.d.ts → components/MaskedInputV2/MaskedInputV2.styles.d.ts} +4 -3
- package/components/MaskedInputV2/MaskedInputV2.styles.js +19 -0
- package/components/MaskedInputV2/MaskedInputV2.styles.js.map +1 -0
- package/components/MaskedInputV2/index.d.ts +1 -0
- package/components/MaskedInputV2/index.js +2 -0
- package/components/MaskedInputV2/index.js.map +1 -0
- package/components/MaskedInputV2/internal/MaskOverlay.d.ts +19 -0
- package/components/MaskedInputV2/internal/MaskOverlay.js +54 -0
- package/components/MaskedInputV2/internal/MaskOverlay.js.map +1 -0
- package/components/MaskedInputV2/internal/MaskedCore.d.ts +8 -0
- package/components/MaskedInputV2/internal/MaskedCore.js +101 -0
- package/components/MaskedInputV2/internal/MaskedCore.js.map +1 -0
- package/components/MaskedInputV2/internal/MaskedCore.types.d.ts +30 -0
- package/components/MaskedInputV2/internal/MaskedCore.types.js +2 -0
- package/components/MaskedInputV2/internal/MaskedCore.types.js.map +1 -0
- package/components/MaskedInputV2/internal/MaskedInternal.styles.d.ts +15 -0
- package/components/MaskedInputV2/internal/MaskedInternal.styles.js +34 -0
- package/components/MaskedInputV2/internal/MaskedInternal.styles.js.map +1 -0
- package/components/MaskedInputV2/internal/buildSlotMap.d.ts +11 -0
- package/components/MaskedInputV2/internal/buildSlotMap.js +37 -0
- package/components/MaskedInputV2/internal/buildSlotMap.js.map +1 -0
- package/components/MaskedInputV2/internal/extractRaw.d.ts +10 -0
- package/components/MaskedInputV2/internal/extractRaw.js +16 -0
- package/components/MaskedInputV2/internal/extractRaw.js.map +1 -0
- package/components/MaskedInputV2/internal/findNearestRawLeft.d.ts +10 -0
- package/components/MaskedInputV2/internal/findNearestRawLeft.js +18 -0
- package/components/MaskedInputV2/internal/findNearestRawLeft.js.map +1 -0
- package/components/MaskedInputV2/internal/helpers.d.ts +5 -0
- package/components/MaskedInputV2/internal/helpers.js +6 -0
- package/components/MaskedInputV2/internal/helpers.js.map +1 -0
- package/components/MaskedInputV2/internal/maskedCoreClipboard.d.ts +25 -0
- package/components/MaskedInputV2/internal/maskedCoreClipboard.js +30 -0
- package/components/MaskedInputV2/internal/maskedCoreClipboard.js.map +1 -0
- package/components/MaskedInputV2/internal/maskedCoreDeletion.d.ts +28 -0
- package/components/MaskedInputV2/internal/maskedCoreDeletion.js +70 -0
- package/components/MaskedInputV2/internal/maskedCoreDeletion.js.map +1 -0
- package/components/MaskedInputV2/internal/maskedCoreInputChange.d.ts +35 -0
- package/components/MaskedInputV2/internal/maskedCoreInputChange.js +31 -0
- package/components/MaskedInputV2/internal/maskedCoreInputChange.js.map +1 -0
- package/components/MaskedInputV2/internal/maskedCoreNavigation.d.ts +13 -0
- package/components/MaskedInputV2/internal/maskedCoreNavigation.js +79 -0
- package/components/MaskedInputV2/internal/maskedCoreNavigation.js.map +1 -0
- package/components/MaskedInputV2/internal/stripMaskChars.d.ts +11 -0
- package/components/MaskedInputV2/internal/stripMaskChars.js +20 -0
- package/components/MaskedInputV2/internal/stripMaskChars.js.map +1 -0
- package/components/MaskedInputV2/internal/types.d.ts +74 -0
- package/components/MaskedInputV2/internal/types.js.map +1 -0
- package/components/MaskedInputV2/internal/useMaskEngine.d.ts +42 -0
- package/components/MaskedInputV2/internal/useMaskEngine.js +82 -0
- package/components/MaskedInputV2/internal/useMaskEngine.js.map +1 -0
- package/components/MaskedInputV2/internal/useMaskedCoreHandlers.d.ts +28 -0
- package/components/MaskedInputV2/internal/useMaskedCoreHandlers.js +190 -0
- package/components/MaskedInputV2/internal/useMaskedCoreHandlers.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/controls/html-input-mask-element.d.ts +16 -0
- package/components/MaskedInputV2/react-imask/imask/controls/html-input-mask-element.js +59 -0
- package/components/MaskedInputV2/react-imask/imask/controls/html-input-mask-element.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/controls/html-mask-element.d.ts +20 -0
- package/components/MaskedInputV2/react-imask/imask/controls/html-mask-element.js +106 -0
- package/components/MaskedInputV2/react-imask/imask/controls/html-mask-element.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/controls/input-history.d.ts +17 -0
- package/components/MaskedInputV2/react-imask/imask/controls/input-history.js +49 -0
- package/components/MaskedInputV2/react-imask/imask/controls/input-history.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/controls/input.d.ts +95 -0
- package/components/MaskedInputV2/react-imask/imask/controls/input.js +420 -0
- package/components/MaskedInputV2/react-imask/imask/controls/input.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/controls/mask-element.d.ts +30 -0
- package/components/MaskedInputV2/react-imask/imask/controls/mask-element.js +59 -0
- package/components/MaskedInputV2/react-imask/imask/controls/mask-element.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/core/action-details.d.ts +30 -0
- package/components/MaskedInputV2/react-imask/imask/core/action-details.js +100 -0
- package/components/MaskedInputV2/react-imask/imask/core/action-details.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/core/change-details.d.ts +20 -0
- package/components/MaskedInputV2/react-imask/imask/core/change-details.js +46 -0
- package/components/MaskedInputV2/react-imask/imask/core/change-details.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/core/continuous-tail-details.d.ts +21 -0
- package/components/MaskedInputV2/react-imask/imask/core/continuous-tail-details.js +52 -0
- package/components/MaskedInputV2/react-imask/imask/core/continuous-tail-details.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/core/holder.d.ts +34 -0
- package/components/MaskedInputV2/react-imask/imask/core/holder.js +38 -0
- package/components/MaskedInputV2/react-imask/imask/core/holder.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/core/tail-details.d.ts +20 -0
- package/components/MaskedInputV2/react-imask/imask/core/tail-details.js +2 -0
- package/components/MaskedInputV2/react-imask/imask/core/tail-details.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/core/utils.d.ts +24 -0
- package/components/MaskedInputV2/react-imask/imask/core/utils.js +100 -0
- package/components/MaskedInputV2/react-imask/imask/core/utils.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/imask.d.ts +5 -0
- package/components/MaskedInputV2/react-imask/imask/imask.js +7 -0
- package/components/MaskedInputV2/react-imask/imask/imask.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/index.d.ts +17 -0
- package/components/MaskedInputV2/react-imask/imask/index.js +16 -0
- package/components/MaskedInputV2/react-imask/imask/index.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/masked/base.d.ts +114 -0
- package/components/MaskedInputV2/react-imask/imask/masked/base.js +411 -0
- package/components/MaskedInputV2/react-imask/imask/masked/base.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/masked/factory.d.ts +62 -0
- package/components/MaskedInputV2/react-imask/imask/masked/factory.js +96 -0
- package/components/MaskedInputV2/react-imask/imask/masked/factory.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/masked/pattern.d.ts +101 -0
- package/components/MaskedInputV2/react-imask/imask/masked/pattern.js +543 -0
- package/components/MaskedInputV2/react-imask/imask/masked/pattern.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/block.d.ts +30 -0
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/block.js +2 -0
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/block.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/chunk-tail-details.d.ts +21 -0
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/chunk-tail-details.js +180 -0
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/chunk-tail-details.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/cursor.d.ts +31 -0
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/cursor.js +163 -0
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/cursor.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/fixed-definition.d.ts +42 -0
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/fixed-definition.js +158 -0
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/fixed-definition.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/input-definition.d.ts +56 -0
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/input-definition.js +185 -0
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/input-definition.js.map +1 -0
- package/components/MaskedInputV2/react-imask/imask/masked/regexp.d.ts +17 -0
- package/components/MaskedInputV2/react-imask/imask/masked/regexp.js +36 -0
- package/components/MaskedInputV2/react-imask/imask/masked/regexp.js.map +1 -0
- package/components/MaskedInputV2/react-imask/index.d.ts +3 -0
- package/components/MaskedInputV2/react-imask/index.js +4 -0
- package/components/MaskedInputV2/react-imask/index.js.map +1 -0
- package/components/MaskedInputV2/react-imask/input.d.ts +8 -0
- package/components/MaskedInputV2/react-imask/input.js +35 -0
- package/components/MaskedInputV2/react-imask/input.js.map +1 -0
- package/components/MaskedInputV2/react-imask/mixin.d.ts +31 -0
- package/components/MaskedInputV2/react-imask/mixin.js +246 -0
- package/components/MaskedInputV2/react-imask/mixin.js.map +1 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/internal/CustomComboBox/ComboBoxView.js +2 -2
- package/internal/CustomComboBox/ComboBoxView.js.map +1 -1
- package/internal/FeaturedMaskedInput/FeaturedMaskedInput.d.ts +4 -0
- package/internal/FeaturedMaskedInput/FeaturedMaskedInput.js +24 -0
- package/internal/FeaturedMaskedInput/FeaturedMaskedInput.js.map +1 -0
- package/internal/themes/BasicTheme.d.ts +0 -34
- package/internal/themes/BasicTheme.js +0 -96
- package/internal/themes/BasicTheme.js.map +1 -1
- package/lib/events/keyboard/KeyboardEventCodes.d.ts +2 -0
- package/lib/events/keyboard/KeyboardEventCodes.js +2 -0
- package/lib/events/keyboard/KeyboardEventCodes.js.map +1 -1
- package/lib/events/keyboard/KeyboardMapKeys.js +2 -0
- package/lib/events/keyboard/KeyboardMapKeys.js.map +1 -1
- package/lib/events/keyboard/identifiers.d.ts +2 -0
- package/lib/events/keyboard/identifiers.js +6 -0
- package/lib/events/keyboard/identifiers.js.map +1 -1
- package/lib/featureFlagsContext/ReactUIFeatureFlagsContext.d.ts +2 -0
- package/lib/featureFlagsContext/ReactUIFeatureFlagsContext.js +1 -0
- package/lib/featureFlagsContext/ReactUIFeatureFlagsContext.js.map +1 -1
- package/lib/locale/types.d.ts +0 -2
- package/lib/locale/types.js.map +1 -1
- package/lib/utils.d.ts +0 -2
- package/lib/utils.js +0 -1
- package/lib/utils.js.map +1 -1
- package/package.json +4 -9
- package/components/TimePicker/TimeClockIcon.d.ts +0 -3
- package/components/TimePicker/TimeClockIcon.js +0 -11
- package/components/TimePicker/TimeClockIcon.js.map +0 -1
- package/components/TimePicker/TimePicker.d.ts +0 -79
- package/components/TimePicker/TimePicker.js +0 -513
- package/components/TimePicker/TimePicker.js.map +0 -1
- package/components/TimePicker/TimePicker.styles.d.ts +0 -11
- package/components/TimePicker/TimePicker.styles.js +0 -36
- package/components/TimePicker/TimePicker.styles.js.map +0 -1
- package/components/TimePicker/TimePickerItems.d.ts +0 -17
- package/components/TimePicker/TimePickerItems.js +0 -80
- package/components/TimePicker/TimePickerItems.js.map +0 -1
- package/components/TimePicker/TimePickerMobilePopup.d.ts +0 -38
- package/components/TimePicker/TimePickerMobilePopup.js +0 -21
- package/components/TimePicker/TimePickerMobilePopup.js.map +0 -1
- package/components/TimePicker/TimePickerPopup.d.ts +0 -20
- package/components/TimePicker/TimePickerPopup.js +0 -18
- package/components/TimePicker/TimePickerPopup.js.map +0 -1
- package/components/TimePicker/helpers/TimePicker.constants.d.ts +0 -22
- package/components/TimePicker/helpers/TimePicker.constants.js +0 -31
- package/components/TimePicker/helpers/TimePicker.constants.js.map +0 -1
- package/components/TimePicker/helpers/TimePicker.editing.d.ts +0 -23
- package/components/TimePicker/helpers/TimePicker.editing.js +0 -101
- package/components/TimePicker/helpers/TimePicker.editing.js.map +0 -1
- package/components/TimePicker/helpers/TimePicker.layout.d.ts +0 -6
- package/components/TimePicker/helpers/TimePicker.layout.js +0 -49
- package/components/TimePicker/helpers/TimePicker.layout.js.map +0 -1
- package/components/TimePicker/helpers/TimePicker.selection.d.ts +0 -5
- package/components/TimePicker/helpers/TimePicker.selection.js +0 -23
- package/components/TimePicker/helpers/TimePicker.selection.js.map +0 -1
- package/components/TimePicker/helpers/TimePicker.shared.d.ts +0 -47
- package/components/TimePicker/helpers/TimePicker.shared.js +0 -70
- package/components/TimePicker/helpers/TimePicker.shared.js.map +0 -1
- package/components/TimePicker/helpers/TimePicker.value.d.ts +0 -30
- package/components/TimePicker/helpers/TimePicker.value.js +0 -96
- package/components/TimePicker/helpers/TimePicker.value.js.map +0 -1
- package/components/TimePicker/helpers/scrollSelectedItemIntoView.d.ts +0 -4
- package/components/TimePicker/helpers/scrollSelectedItemIntoView.js +0 -24
- package/components/TimePicker/helpers/scrollSelectedItemIntoView.js.map +0 -1
- package/components/TimePicker/helpers/validateTimePicker.d.ts +0 -8
- package/components/TimePicker/helpers/validateTimePicker.js +0 -16
- package/components/TimePicker/helpers/validateTimePicker.js.map +0 -1
- package/components/TimePicker/hooks/useTimePickerDropdown.d.ts +0 -17
- package/components/TimePicker/hooks/useTimePickerDropdown.js +0 -62
- package/components/TimePicker/hooks/useTimePickerDropdown.js.map +0 -1
- package/components/TimePicker/hooks/useTimePickerSelection.d.ts +0 -18
- package/components/TimePicker/hooks/useTimePickerSelection.js +0 -66
- package/components/TimePicker/hooks/useTimePickerSelection.js.map +0 -1
- package/components/TimePicker/hooks/useTimePickerValue.d.ts +0 -18
- package/components/TimePicker/hooks/useTimePickerValue.js +0 -59
- package/components/TimePicker/hooks/useTimePickerValue.js.map +0 -1
- package/components/TimePicker/index.d.ts +0 -2
- package/components/TimePicker/index.js +0 -2
- package/components/TimePicker/index.js.map +0 -1
- package/components/TimePicker/locale/index.d.ts +0 -4
- package/components/TimePicker/locale/index.js +0 -9
- package/components/TimePicker/locale/index.js.map +0 -1
- package/components/TimePicker/locale/locales/en.d.ts +0 -2
- package/components/TimePicker/locale/locales/en.js +0 -5
- package/components/TimePicker/locale/locales/en.js.map +0 -1
- package/components/TimePicker/locale/locales/ru.d.ts +0 -2
- package/components/TimePicker/locale/locales/ru.js +0 -5
- package/components/TimePicker/locale/locales/ru.js.map +0 -1
- package/components/TimePicker/locale/types.d.ts +0 -4
- package/components/TimePicker/locale/types.js.map +0 -1
- package/internal/NativeTimeInput/NativeTimeInput.d.ts +0 -16
- package/internal/NativeTimeInput/NativeTimeInput.js +0 -25
- package/internal/NativeTimeInput/NativeTimeInput.js.map +0 -1
- package/internal/NativeTimeInput/NativeTimeInput.styles.d.ts +0 -3
- package/internal/NativeTimeInput/NativeTimeInput.styles.js +0 -15
- package/internal/NativeTimeInput/NativeTimeInput.styles.js.map +0 -1
- package/internal/NativeTimeInput/NativeTimeInput.utils.d.ts +0 -7
- package/internal/NativeTimeInput/NativeTimeInput.utils.js +0 -28
- package/internal/NativeTimeInput/NativeTimeInput.utils.js.map +0 -1
- package/internal/NativeTimeInput/index.d.ts +0 -1
- package/internal/NativeTimeInput/index.js +0 -2
- package/internal/NativeTimeInput/index.js.map +0 -1
- package/internal/TimeInput/TimeFragments.d.ts +0 -15
- package/internal/TimeInput/TimeFragments.js +0 -72
- package/internal/TimeInput/TimeFragments.js.map +0 -1
- package/internal/TimeInput/TimeFragments.styles.d.ts +0 -12
- package/internal/TimeInput/TimeFragments.styles.js +0 -43
- package/internal/TimeInput/TimeFragments.styles.js.map +0 -1
- package/internal/TimeInput/TimeInput.d.ts +0 -22
- package/internal/TimeInput/TimeInput.js +0 -103
- package/internal/TimeInput/TimeInput.js.map +0 -1
- package/internal/TimeInput/TimeInput.styles.js +0 -21
- package/internal/TimeInput/TimeInput.styles.js.map +0 -1
- package/internal/TimeInput/index.d.ts +0 -1
- package/internal/TimeInput/index.js +0 -2
- package/internal/TimeInput/index.js.map +0 -1
- package/internal/icons2022/TimeClockIcon/TimeClockIcon16Light.d.ts +0 -2
- package/internal/icons2022/TimeClockIcon/TimeClockIcon16Light.js +0 -20
- package/internal/icons2022/TimeClockIcon/TimeClockIcon16Light.js.map +0 -1
- package/internal/icons2022/TimeClockIcon/TimeClockIcon20Light.d.ts +0 -2
- package/internal/icons2022/TimeClockIcon/TimeClockIcon20Light.js +0 -20
- package/internal/icons2022/TimeClockIcon/TimeClockIcon20Light.js.map +0 -1
- package/internal/icons2022/TimeClockIcon/TimeClockIcon24Regular.d.ts +0 -2
- package/internal/icons2022/TimeClockIcon/TimeClockIcon24Regular.js +0 -20
- package/internal/icons2022/TimeClockIcon/TimeClockIcon24Regular.js.map +0 -1
- /package/components/{TimePicker/locale → MaskedInputV2/internal}/types.js +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ChangeDetails } from '../../core/change-details.js';
|
|
2
|
+
import { type TailDetails } from '../../core/tail-details.js';
|
|
3
|
+
import { type Direction } from '../../core/utils.js';
|
|
4
|
+
import type { Masked, ExtractFlags, AppendFlags, MaskedState } from '../base.js';
|
|
5
|
+
import { type FactoryArg, type FactoryOpts, type FactoryReturnMasked } from '../factory.js';
|
|
6
|
+
import type { MaskedPattern } from '../pattern.js';
|
|
7
|
+
import type { PatternBlock } from './block.js';
|
|
8
|
+
export type PatternInputDefinitionOptions<Opts extends FactoryOpts> = Omit<Opts, 'parent' | 'isOptional' | 'lazy' | 'eager' | 'placeholderChar' | 'displayChar'> & Partial<Pick<PatternInputDefinition, 'parent' | 'isOptional' | 'lazy' | 'eager' | 'placeholderChar' | 'displayChar'>>;
|
|
9
|
+
export type PatternInputDefinitionState<Opts extends FactoryArg> = MaskedState & {
|
|
10
|
+
masked: FactoryReturnMasked<Opts>['state'];
|
|
11
|
+
isFilled: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare class PatternInputDefinition<Opts extends FactoryOpts = any> implements PatternBlock<PatternInputDefinitionState<Opts>> {
|
|
14
|
+
static DEFAULT_DEFINITIONS: {
|
|
15
|
+
[k: string]: RegExp;
|
|
16
|
+
};
|
|
17
|
+
/** */
|
|
18
|
+
readonly masked: FactoryReturnMasked<Opts>;
|
|
19
|
+
/** */
|
|
20
|
+
parent: Masked;
|
|
21
|
+
/** */
|
|
22
|
+
isOptional: boolean;
|
|
23
|
+
/** */
|
|
24
|
+
isFilled: boolean;
|
|
25
|
+
/** */
|
|
26
|
+
lazy: MaskedPattern['lazy'];
|
|
27
|
+
/** */
|
|
28
|
+
eager: MaskedPattern['eager'];
|
|
29
|
+
/** */
|
|
30
|
+
placeholderChar: MaskedPattern['placeholderChar'];
|
|
31
|
+
/** */
|
|
32
|
+
displayChar: MaskedPattern['displayChar'];
|
|
33
|
+
constructor(opts: PatternInputDefinitionOptions<Opts>);
|
|
34
|
+
reset(): void;
|
|
35
|
+
remove(fromPos?: number, toPos?: number): ChangeDetails;
|
|
36
|
+
get value(): string;
|
|
37
|
+
get unmaskedValue(): string;
|
|
38
|
+
get rawInputValue(): string;
|
|
39
|
+
get displayValue(): string;
|
|
40
|
+
get isComplete(): boolean;
|
|
41
|
+
_appendChar(ch: string, flags?: AppendFlags<PatternInputDefinitionState<Opts>>): ChangeDetails;
|
|
42
|
+
append(str: string, flags?: AppendFlags<PatternInputDefinitionState<Opts>>, tail?: TailDetails): ChangeDetails;
|
|
43
|
+
_appendPlaceholder(): ChangeDetails;
|
|
44
|
+
_appendEager(): ChangeDetails;
|
|
45
|
+
extractTail(fromPos?: number, toPos?: number): TailDetails;
|
|
46
|
+
appendTail(tail: string | TailDetails): ChangeDetails;
|
|
47
|
+
extractInput(fromPos?: number, toPos?: number, flags?: ExtractFlags): string;
|
|
48
|
+
nearestInputPos(cursorPos: number, direction?: Direction): number;
|
|
49
|
+
totalInputPositions(fromPos?: number, toPos?: number): number;
|
|
50
|
+
doValidate(flags: AppendFlags<PatternInputDefinitionState<Opts>>): boolean;
|
|
51
|
+
doCommit(): void;
|
|
52
|
+
get state(): PatternInputDefinitionState<Opts>;
|
|
53
|
+
set state(state: PatternInputDefinitionState<Opts>);
|
|
54
|
+
currentMaskFlags(flags?: AppendFlags<PatternInputDefinitionState<Opts>>): AppendFlags;
|
|
55
|
+
pad(): ChangeDetails;
|
|
56
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { ChangeDetails } from '../../core/change-details.js';
|
|
24
|
+
import { DIRECTION } from '../../core/utils.js';
|
|
25
|
+
import { createMask } from '../factory.js';
|
|
26
|
+
var PatternInputDefinition = /** @class */ (function () {
|
|
27
|
+
function PatternInputDefinition(opts) {
|
|
28
|
+
var parent = opts.parent, isOptional = opts.isOptional, placeholderChar = opts.placeholderChar, displayChar = opts.displayChar, lazy = opts.lazy, eager = opts.eager, maskOpts = __rest(opts, ["parent", "isOptional", "placeholderChar", "displayChar", "lazy", "eager"]);
|
|
29
|
+
this.masked = createMask(maskOpts);
|
|
30
|
+
Object.assign(this, { parent: parent, isOptional: isOptional, placeholderChar: placeholderChar, displayChar: displayChar, lazy: lazy, eager: eager });
|
|
31
|
+
}
|
|
32
|
+
PatternInputDefinition.prototype.reset = function () {
|
|
33
|
+
this.isFilled = false;
|
|
34
|
+
this.masked.reset();
|
|
35
|
+
};
|
|
36
|
+
PatternInputDefinition.prototype.remove = function (fromPos, toPos) {
|
|
37
|
+
if (fromPos === void 0) { fromPos = 0; }
|
|
38
|
+
if (toPos === void 0) { toPos = this.value.length; }
|
|
39
|
+
if (fromPos === 0 && toPos >= 1) {
|
|
40
|
+
this.isFilled = false;
|
|
41
|
+
return this.masked.remove(fromPos, toPos);
|
|
42
|
+
}
|
|
43
|
+
return new ChangeDetails();
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(PatternInputDefinition.prototype, "value", {
|
|
46
|
+
get: function () {
|
|
47
|
+
return this.masked.value || (this.isFilled && !this.isOptional ? this.placeholderChar : '');
|
|
48
|
+
},
|
|
49
|
+
enumerable: false,
|
|
50
|
+
configurable: true
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(PatternInputDefinition.prototype, "unmaskedValue", {
|
|
53
|
+
get: function () {
|
|
54
|
+
return this.masked.unmaskedValue;
|
|
55
|
+
},
|
|
56
|
+
enumerable: false,
|
|
57
|
+
configurable: true
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(PatternInputDefinition.prototype, "rawInputValue", {
|
|
60
|
+
get: function () {
|
|
61
|
+
return this.masked.rawInputValue;
|
|
62
|
+
},
|
|
63
|
+
enumerable: false,
|
|
64
|
+
configurable: true
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(PatternInputDefinition.prototype, "displayValue", {
|
|
67
|
+
get: function () {
|
|
68
|
+
return (this.masked.value && this.displayChar) || this.value;
|
|
69
|
+
},
|
|
70
|
+
enumerable: false,
|
|
71
|
+
configurable: true
|
|
72
|
+
});
|
|
73
|
+
Object.defineProperty(PatternInputDefinition.prototype, "isComplete", {
|
|
74
|
+
get: function () {
|
|
75
|
+
return Boolean(this.masked.value) || this.isOptional;
|
|
76
|
+
},
|
|
77
|
+
enumerable: false,
|
|
78
|
+
configurable: true
|
|
79
|
+
});
|
|
80
|
+
PatternInputDefinition.prototype._appendChar = function (ch, flags) {
|
|
81
|
+
if (flags === void 0) { flags = {}; }
|
|
82
|
+
if (this.isFilled) {
|
|
83
|
+
return new ChangeDetails();
|
|
84
|
+
}
|
|
85
|
+
var state = this.masked.state;
|
|
86
|
+
// simulate input
|
|
87
|
+
var details = this.masked._appendChar(ch, this.currentMaskFlags(flags));
|
|
88
|
+
if (details.inserted && this.doValidate(flags) === false) {
|
|
89
|
+
details = new ChangeDetails();
|
|
90
|
+
this.masked.state = state;
|
|
91
|
+
}
|
|
92
|
+
if (!details.inserted && !this.isOptional && !this.lazy && !flags.input) {
|
|
93
|
+
details.inserted = this.placeholderChar;
|
|
94
|
+
}
|
|
95
|
+
details.skip = !details.inserted && !this.isOptional;
|
|
96
|
+
this.isFilled = Boolean(details.inserted);
|
|
97
|
+
return details;
|
|
98
|
+
};
|
|
99
|
+
PatternInputDefinition.prototype.append = function (str, flags, tail) {
|
|
100
|
+
// TODO probably should be done via _appendChar
|
|
101
|
+
return this.masked.append(str, this.currentMaskFlags(flags), tail);
|
|
102
|
+
};
|
|
103
|
+
PatternInputDefinition.prototype._appendPlaceholder = function () {
|
|
104
|
+
if (this.isFilled || this.isOptional) {
|
|
105
|
+
return new ChangeDetails();
|
|
106
|
+
}
|
|
107
|
+
this.isFilled = true;
|
|
108
|
+
return new ChangeDetails({ inserted: this.placeholderChar });
|
|
109
|
+
};
|
|
110
|
+
PatternInputDefinition.prototype._appendEager = function () {
|
|
111
|
+
return new ChangeDetails();
|
|
112
|
+
};
|
|
113
|
+
PatternInputDefinition.prototype.extractTail = function (fromPos, toPos) {
|
|
114
|
+
return this.masked.extractTail(fromPos, toPos);
|
|
115
|
+
};
|
|
116
|
+
PatternInputDefinition.prototype.appendTail = function (tail) {
|
|
117
|
+
return this.masked.appendTail(tail);
|
|
118
|
+
};
|
|
119
|
+
// eslint-disable-next-line default-param-last
|
|
120
|
+
PatternInputDefinition.prototype.extractInput = function (fromPos, toPos, flags) {
|
|
121
|
+
if (fromPos === void 0) { fromPos = 0; }
|
|
122
|
+
if (toPos === void 0) { toPos = this.value.length; }
|
|
123
|
+
return this.masked.extractInput(fromPos, toPos, flags);
|
|
124
|
+
};
|
|
125
|
+
PatternInputDefinition.prototype.nearestInputPos = function (cursorPos, direction) {
|
|
126
|
+
if (direction === void 0) { direction = DIRECTION.NONE; }
|
|
127
|
+
var minPos = 0;
|
|
128
|
+
var maxPos = this.value.length;
|
|
129
|
+
var boundPos = Math.min(Math.max(cursorPos, minPos), maxPos);
|
|
130
|
+
switch (direction) {
|
|
131
|
+
case DIRECTION.LEFT:
|
|
132
|
+
case DIRECTION.FORCE_LEFT:
|
|
133
|
+
return this.isComplete ? boundPos : minPos;
|
|
134
|
+
case DIRECTION.RIGHT:
|
|
135
|
+
case DIRECTION.FORCE_RIGHT:
|
|
136
|
+
return this.isComplete ? boundPos : maxPos;
|
|
137
|
+
case DIRECTION.NONE:
|
|
138
|
+
default:
|
|
139
|
+
return boundPos;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
PatternInputDefinition.prototype.totalInputPositions = function (fromPos, toPos) {
|
|
143
|
+
if (fromPos === void 0) { fromPos = 0; }
|
|
144
|
+
if (toPos === void 0) { toPos = this.value.length; }
|
|
145
|
+
return this.value.slice(fromPos, toPos).length;
|
|
146
|
+
};
|
|
147
|
+
PatternInputDefinition.prototype.doValidate = function (flags) {
|
|
148
|
+
return (this.masked.doValidate(this.currentMaskFlags(flags)) &&
|
|
149
|
+
(!this.parent || this.parent.doValidate(this.currentMaskFlags(flags))));
|
|
150
|
+
};
|
|
151
|
+
PatternInputDefinition.prototype.doCommit = function () {
|
|
152
|
+
this.masked.doCommit();
|
|
153
|
+
};
|
|
154
|
+
Object.defineProperty(PatternInputDefinition.prototype, "state", {
|
|
155
|
+
get: function () {
|
|
156
|
+
return {
|
|
157
|
+
_value: this.value,
|
|
158
|
+
_rawInputValue: this.rawInputValue,
|
|
159
|
+
masked: this.masked.state,
|
|
160
|
+
isFilled: this.isFilled,
|
|
161
|
+
};
|
|
162
|
+
},
|
|
163
|
+
set: function (state) {
|
|
164
|
+
this.masked.state = state.masked;
|
|
165
|
+
this.isFilled = state.isFilled;
|
|
166
|
+
},
|
|
167
|
+
enumerable: false,
|
|
168
|
+
configurable: true
|
|
169
|
+
});
|
|
170
|
+
PatternInputDefinition.prototype.currentMaskFlags = function (flags) {
|
|
171
|
+
var _a;
|
|
172
|
+
return __assign(__assign({}, flags), { _beforeTailState: ((_a = flags === null || flags === void 0 ? void 0 : flags._beforeTailState) === null || _a === void 0 ? void 0 : _a.masked) || (flags === null || flags === void 0 ? void 0 : flags._beforeTailState) });
|
|
173
|
+
};
|
|
174
|
+
PatternInputDefinition.prototype.pad = function () {
|
|
175
|
+
return new ChangeDetails();
|
|
176
|
+
};
|
|
177
|
+
PatternInputDefinition.DEFAULT_DEFINITIONS = {
|
|
178
|
+
'0': /\d/,
|
|
179
|
+
a: /[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/, // http://stackoverflow.com/a/22075070
|
|
180
|
+
'*': /./,
|
|
181
|
+
};
|
|
182
|
+
return PatternInputDefinition;
|
|
183
|
+
}());
|
|
184
|
+
export { PatternInputDefinition };
|
|
185
|
+
//# sourceMappingURL=input-definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-definition.js","sourceRoot":"","sources":["input-definition.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAkB,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,UAAU,EAA+D,MAAM,eAAe,CAAC;AAexG;IA0BE,gCAAY,IAAyC;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BAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CACvE,CAAC;IACJ,CAAC;IAED,yCAAQ,GAAR;QACE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IAED,sBAAI,yCAAK;aAAT;YACE,OAAO;gBACL,MAAM,EAAE,IAAI,CAAC,KAAK;gBAClB,cAAc,EAAE,IAAI,CAAC,aAAa;gBAClC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;gBACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB,CAAC;QACJ,CAAC;aAED,UAAU,KAAwC;YAChD,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;YACjC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QACjC,CAAC;;;OALA;IAOD,iDAAgB,GAAhB,UAAiB,KAAsD;;QACrE,6BACK,KAAK,KACR,gBAAgB,EAAE,CAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,gBAAgB,0CAAE,MAAM,MAAK,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,gBAA2C,CAAA,IACxG;IACJ,CAAC;IAED,oCAAG,GAAH;QACE,OAAO,IAAI,aAAa,EAAE,CAAC;IAC7B,CAAC;IA9KM,0CAAmB,GAA4B;QACpD,GAAG,EAAE,IAAI;QACT,CAAC,EAAE,qnIAAqnI,EAAE,sCAAsC;QAChqI,GAAG,EAAE,GAAG;KACT,CAAC;IA2KJ,6BAAC;CAAA,AAlLD,IAkLC;SAlLY,sBAAsB","sourcesContent":["import { ChangeDetails } from '../../core/change-details.js';\nimport { type TailDetails } from '../../core/tail-details.js';\nimport { DIRECTION, type Direction } from '../../core/utils.js';\nimport type { Masked, ExtractFlags, AppendFlags, MaskedState } from '../base.js';\nimport { createMask, type FactoryArg, type FactoryOpts, type FactoryReturnMasked } from '../factory.js';\nimport type { MaskedPattern } from '../pattern.js';\nimport type { PatternBlock } from './block.js';\n\nexport type PatternInputDefinitionOptions<Opts extends FactoryOpts> = Omit<\n Opts,\n 'parent' | 'isOptional' | 'lazy' | 'eager' | 'placeholderChar' | 'displayChar'\n> &\n Partial<Pick<PatternInputDefinition, 'parent' | 'isOptional' | 'lazy' | 'eager' | 'placeholderChar' | 'displayChar'>>;\n\nexport type PatternInputDefinitionState<Opts extends FactoryArg> = MaskedState & {\n masked: FactoryReturnMasked<Opts>['state'];\n isFilled: boolean;\n};\n\nexport class PatternInputDefinition<Opts extends FactoryOpts = any> implements PatternBlock<\n PatternInputDefinitionState<Opts>\n> {\n static DEFAULT_DEFINITIONS: { [k: string]: RegExp } = {\n '0': /\\d/,\n a: /[\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0\\u08A2-\\u08AC\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097F\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u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\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191C\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA697\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA793\\uA7A0-\\uA7AA\\uA7F8-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA80-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]/, // http://stackoverflow.com/a/22075070\n '*': /./,\n };\n\n /** */\n readonly masked: FactoryReturnMasked<Opts>;\n /** */\n parent!: Masked;\n /** */\n isOptional!: boolean;\n /** */\n isFilled!: boolean;\n /** */\n lazy!: MaskedPattern['lazy'];\n /** */\n eager!: MaskedPattern['eager'];\n /** */\n placeholderChar!: MaskedPattern['placeholderChar'];\n /** */\n displayChar!: MaskedPattern['displayChar'];\n\n constructor(opts: PatternInputDefinitionOptions<Opts>) {\n const { parent, isOptional, placeholderChar, displayChar, lazy, eager, ...maskOpts } = opts;\n\n this.masked = createMask(maskOpts as Opts);\n Object.assign(this, { parent, isOptional, placeholderChar, displayChar, lazy, eager });\n }\n\n reset(): void {\n this.isFilled = false;\n this.masked.reset();\n }\n\n remove(fromPos: number = 0, toPos: number = this.value.length): ChangeDetails {\n if (fromPos === 0 && toPos >= 1) {\n this.isFilled = false;\n return this.masked.remove(fromPos, toPos);\n }\n\n return new ChangeDetails();\n }\n\n get value(): string {\n return this.masked.value || (this.isFilled && !this.isOptional ? this.placeholderChar : '');\n }\n\n get unmaskedValue(): string {\n return this.masked.unmaskedValue;\n }\n\n get rawInputValue(): string {\n return this.masked.rawInputValue;\n }\n\n get displayValue(): string {\n return (this.masked.value && this.displayChar) || this.value;\n }\n\n get isComplete(): boolean {\n return Boolean(this.masked.value) || this.isOptional;\n }\n\n _appendChar(ch: string, flags: AppendFlags<PatternInputDefinitionState<Opts>> = {}): ChangeDetails {\n if (this.isFilled) {\n return new ChangeDetails();\n }\n\n const state = this.masked.state;\n // simulate input\n let details = this.masked._appendChar(ch, this.currentMaskFlags(flags));\n\n if (details.inserted && this.doValidate(flags) === false) {\n details = new ChangeDetails();\n this.masked.state = state;\n }\n\n if (!details.inserted && !this.isOptional && !this.lazy && !flags.input) {\n details.inserted = this.placeholderChar;\n }\n details.skip = !details.inserted && !this.isOptional;\n this.isFilled = Boolean(details.inserted);\n\n return details;\n }\n\n append(str: string, flags?: AppendFlags<PatternInputDefinitionState<Opts>>, tail?: TailDetails): ChangeDetails {\n // TODO probably should be done via _appendChar\n return this.masked.append(str, this.currentMaskFlags(flags), tail);\n }\n\n _appendPlaceholder(): ChangeDetails {\n if (this.isFilled || this.isOptional) {\n return new ChangeDetails();\n }\n\n this.isFilled = true;\n return new ChangeDetails({ inserted: this.placeholderChar });\n }\n\n _appendEager(): ChangeDetails {\n return new ChangeDetails();\n }\n\n extractTail(fromPos?: number, toPos?: number): TailDetails {\n return this.masked.extractTail(fromPos, toPos);\n }\n\n appendTail(tail: string | TailDetails): ChangeDetails {\n return this.masked.appendTail(tail);\n }\n\n // eslint-disable-next-line default-param-last\n extractInput(fromPos: number = 0, toPos: number = this.value.length, flags?: ExtractFlags): string {\n return this.masked.extractInput(fromPos, toPos, flags);\n }\n\n nearestInputPos(cursorPos: number, direction: Direction = DIRECTION.NONE): number {\n const minPos = 0;\n const maxPos = this.value.length;\n const boundPos = Math.min(Math.max(cursorPos, minPos), maxPos);\n\n switch (direction) {\n case DIRECTION.LEFT:\n case DIRECTION.FORCE_LEFT:\n return this.isComplete ? boundPos : minPos;\n case DIRECTION.RIGHT:\n case DIRECTION.FORCE_RIGHT:\n return this.isComplete ? boundPos : maxPos;\n case DIRECTION.NONE:\n default:\n return boundPos;\n }\n }\n\n totalInputPositions(fromPos: number = 0, toPos: number = this.value.length): number {\n return this.value.slice(fromPos, toPos).length;\n }\n\n doValidate(flags: AppendFlags<PatternInputDefinitionState<Opts>>): boolean {\n return (\n this.masked.doValidate(this.currentMaskFlags(flags)) &&\n (!this.parent || this.parent.doValidate(this.currentMaskFlags(flags)))\n );\n }\n\n doCommit(): void {\n this.masked.doCommit();\n }\n\n get state(): PatternInputDefinitionState<Opts> {\n return {\n _value: this.value,\n _rawInputValue: this.rawInputValue,\n masked: this.masked.state,\n isFilled: this.isFilled,\n };\n }\n\n set state(state: PatternInputDefinitionState<Opts>) {\n this.masked.state = state.masked;\n this.isFilled = state.isFilled;\n }\n\n currentMaskFlags(flags?: AppendFlags<PatternInputDefinitionState<Opts>>): AppendFlags {\n return {\n ...flags,\n _beforeTailState: flags?._beforeTailState?.masked || (flags?._beforeTailState as unknown as MaskedState),\n };\n }\n\n pad(): ChangeDetails {\n return new ChangeDetails();\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Masked, type MaskedOptions } from './base.js';
|
|
2
|
+
export type MaskedRegExpOptions = MaskedOptions<MaskedRegExp>;
|
|
3
|
+
/** Masking by RegExp */
|
|
4
|
+
export declare class MaskedRegExp extends Masked<string> {
|
|
5
|
+
/** */
|
|
6
|
+
mask: RegExp;
|
|
7
|
+
/** Enable characters overwriting */
|
|
8
|
+
overwrite?: boolean | 'shift' | undefined;
|
|
9
|
+
/** */
|
|
10
|
+
eager?: boolean | 'remove' | 'append' | undefined;
|
|
11
|
+
/** */
|
|
12
|
+
skipInvalid?: boolean | undefined;
|
|
13
|
+
/** */
|
|
14
|
+
autofix?: boolean | 'pad' | undefined;
|
|
15
|
+
updateOptions(opts: Partial<MaskedRegExpOptions>): void;
|
|
16
|
+
_update(opts: Partial<MaskedRegExpOptions>): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
import { Masked } from './base.js';
|
|
17
|
+
/** Masking by RegExp */
|
|
18
|
+
var MaskedRegExp = /** @class */ (function (_super) {
|
|
19
|
+
__extends(MaskedRegExp, _super);
|
|
20
|
+
function MaskedRegExp() {
|
|
21
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
22
|
+
}
|
|
23
|
+
MaskedRegExp.prototype.updateOptions = function (opts) {
|
|
24
|
+
_super.prototype.updateOptions.call(this, opts);
|
|
25
|
+
};
|
|
26
|
+
MaskedRegExp.prototype._update = function (opts) {
|
|
27
|
+
var mask = opts.mask;
|
|
28
|
+
if (mask) {
|
|
29
|
+
opts.validate = function (value) { return value.search(mask) >= 0; };
|
|
30
|
+
}
|
|
31
|
+
_super.prototype._update.call(this, opts);
|
|
32
|
+
};
|
|
33
|
+
return MaskedRegExp;
|
|
34
|
+
}(Masked));
|
|
35
|
+
export { MaskedRegExp };
|
|
36
|
+
//# sourceMappingURL=regexp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regexp.js","sourceRoot":"","sources":["regexp.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAsB,MAAM,WAAW,CAAC;AAIvD,wBAAwB;AACxB;IAAkC,gCAAc;IAAhD;;IAuBA,CAAC;IAXU,oCAAa,GAAtB,UAAuB,IAAkC;QACvD,gBAAK,CAAC,aAAa,YAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAEQ,8BAAO,GAAhB,UAAiB,IAAkC;QACjD,IAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,QAAQ,GAAG,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAvB,CAAuB,CAAC;QACrD,CAAC;QACD,gBAAK,CAAC,OAAO,YAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IACH,mBAAC;AAAD,CAAC,AAvBD,CAAkC,MAAM,GAuBvC","sourcesContent":["import { Masked, type MaskedOptions } from './base.js';\n\nexport type MaskedRegExpOptions = MaskedOptions<MaskedRegExp>;\n\n/** Masking by RegExp */\nexport class MaskedRegExp extends Masked<string> {\n /** */\n mask!: RegExp;\n /** Enable characters overwriting */\n overwrite?: boolean | 'shift' | undefined;\n /** */\n eager?: boolean | 'remove' | 'append' | undefined;\n /** */\n skipInvalid?: boolean | undefined;\n /** */\n autofix?: boolean | 'pad' | undefined;\n\n override updateOptions(opts: Partial<MaskedRegExpOptions>): void {\n super.updateOptions(opts);\n }\n\n override _update(opts: Partial<MaskedRegExpOptions>): void {\n const mask = opts.mask;\n if (mask) {\n opts.validate = (value) => value.search(mask) >= 0;\n }\n super._update(opts);\n }\n}\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { IMask } from './imask/index.js';
|
|
2
|
+
export { IMaskInput } from './input.js';
|
|
3
|
+
export { IMaskMixin, type MaskPropsKeys, type ExtractMaskOpts, type ReactElementProps, type ReactMaskProps, type ReactMixinComponent, type IMaskMixinProps, type IMaskInputProps, type ReactMaskOpts, } from './mixin.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EACL,UAAU,GASX,MAAM,YAAY,CAAC","sourcesContent":["export { IMask } from './imask/index.js';\nexport { IMaskInput } from './input.js';\nexport {\n IMaskMixin,\n type MaskPropsKeys,\n type ExtractMaskOpts,\n type ReactElementProps,\n type ReactMaskProps,\n type ReactMixinComponent,\n type IMaskMixinProps,\n type IMaskInputProps,\n type ReactMaskOpts,\n} from './mixin.js';\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type IMaskInputProps } from './mixin.js';
|
|
3
|
+
declare const IMaskInput: React.ForwardRefExoticComponent<Omit<import("./mixin.js").ReactElementProps<HTMLInputElement> & Omit<import("./mixin.js").ReactMaskProps<HTMLInputElement, {
|
|
4
|
+
[x: string]: unknown;
|
|
5
|
+
}>, "ref"> & Partial<Pick<import("./imask/index.js").MaskedPattern<string>, "mask" | "parent" | "format" | "prepare" | "prepareChar" | "validate" | "commit" | "parse" | "overwrite" | "eager" | "skipInvalid" | "autofix" | "definitions" | "blocks" | "placeholderChar" | "displayChar" | "lazy">> & {
|
|
6
|
+
ref?: React.Ref<React.ComponentType<IMaskInputProps<HTMLInputElement>>> | undefined;
|
|
7
|
+
}, "ref"> & React.RefAttributes<unknown>>;
|
|
8
|
+
export { IMaskInput };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import { IMaskMixin } from './mixin.js';
|
|
25
|
+
// eslint-disable-next-line new-cap
|
|
26
|
+
var IMaskInputClass = IMaskMixin(function (_a) {
|
|
27
|
+
var inputRef = _a.inputRef, props = __rest(_a, ["inputRef"]);
|
|
28
|
+
return React.createElement('input', __assign(__assign({}, props), { ref: inputRef }));
|
|
29
|
+
});
|
|
30
|
+
var IMaskInputFn = function (props, ref) {
|
|
31
|
+
return React.createElement(IMaskInputClass, __assign(__assign({}, props), { ref: ref }));
|
|
32
|
+
};
|
|
33
|
+
var IMaskInput = React.forwardRef(IMaskInputFn);
|
|
34
|
+
export { IMaskInput };
|
|
35
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["input.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAwB,MAAM,YAAY,CAAC;AAE9D,mCAAmC;AACnC,IAAM,eAAe,GAAG,UAAU,CAChC,UAAC,EAAqG;IAAnG,IAAA,QAAQ,cAAA,EAAK,KAAK,cAApB,YAAsB,CAAF;IACnB,OAAA,KAAK,CAAC,aAAa,CAAC,OAAO,wBACtB,KAAK,KACR,GAAG,EAAE,QAAQ,IACb,CAAA;CAAA,CACL,CAAC;AAEF,IAAM,YAAY,GAAG,UACnB,KAAY,EACZ,GAA0C;IAE1C,OAAA,KAAK,CAAC,aAAa,CAAC,eAA+F,wBAC9G,KAAK,KACR,GAAG,KAAA,IACH;AAHF,CAGE,CAAC;AACL,IAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CACjC,YAE8B,CAC/B,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import React from 'react';\n\nimport { IMaskMixin, type IMaskInputProps } from './mixin.js';\n\n// eslint-disable-next-line new-cap\nconst IMaskInputClass = IMaskMixin(\n ({ inputRef, ...props }: { inputRef: React.Ref<HTMLInputElement> } & React.HTMLProps<HTMLInputElement>) =>\n React.createElement('input', {\n ...props,\n ref: inputRef,\n }),\n);\n\nconst IMaskInputFn = <Props extends IMaskInputProps<HTMLInputElement>>(\n props: Props,\n ref: React.Ref<React.ComponentType<Props>>,\n) =>\n React.createElement(IMaskInputClass as React.ComponentType<Props & { ref?: React.Ref<React.ComponentType<Props>> }>, {\n ...props,\n ref,\n });\nconst IMaskInput = React.forwardRef(\n IMaskInputFn as unknown as <Props extends IMaskInputProps<HTMLInputElement>>(\n props: Props & { ref?: React.Ref<React.ComponentType<Props>> },\n ) => React.ReactElement<Props>,\n);\n\nexport { IMaskInput };\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type InputMask, type InputMaskElement, type FactoryOpts } from './imask/index.js';
|
|
3
|
+
import { type MaskedPatternOptions } from './imask/masked/pattern.js';
|
|
4
|
+
type AnyProps = Record<string, unknown>;
|
|
5
|
+
export type Falsy = false | 0 | '' | null | undefined;
|
|
6
|
+
export type ReactMaskOpts = MaskedPatternOptions & {
|
|
7
|
+
unmask?: 'typed' | boolean;
|
|
8
|
+
};
|
|
9
|
+
export type UnmaskValue<Opts extends ReactMaskOpts> = Opts['unmask'] extends 'typed' ? InputMask<Opts>['typedValue'] : Opts['unmask'] extends Falsy ? InputMask<Opts>['value'] : InputMask<Opts>['unmaskedValue'];
|
|
10
|
+
export type ExtractReactMaskOpts<MaskElement extends InputMaskElement, Props extends IMaskInputProps<MaskElement>> = Extract<Props, ReactMaskOpts>;
|
|
11
|
+
export interface ReactMaskProps<MaskElement extends InputMaskElement, Props extends IMaskInputProps<MaskElement> = AnyProps> {
|
|
12
|
+
onAccept?: (value: UnmaskValue<ExtractReactMaskOpts<MaskElement, Props>>, maskRef: InputMask<ExtractMaskOpts<MaskElement, Props>>, e?: InputEvent) => void;
|
|
13
|
+
onComplete?: (value: UnmaskValue<ExtractReactMaskOpts<MaskElement, Props>>, maskRef: InputMask<ExtractMaskOpts<MaskElement, Props>>, e?: InputEvent) => void;
|
|
14
|
+
unmask?: ExtractReactMaskOpts<MaskElement, Props>['unmask'];
|
|
15
|
+
value?: UnmaskValue<ExtractReactMaskOpts<MaskElement, Props>>;
|
|
16
|
+
inputRef?: React.Ref<MaskElement>;
|
|
17
|
+
ref?: React.Ref<React.ComponentType<Props>>;
|
|
18
|
+
}
|
|
19
|
+
declare const MASK_PROPS_NAMES: readonly ["mask", "unmask", "prepare", "prepareChar", "validate", "commit", "overwrite", "eager", "skipInvalid", "autofix", "onAccept", "onComplete", "placeholderChar", "displayChar", "lazy", "definitions", "blocks", "inputRef"];
|
|
20
|
+
declare const NON_MASK_OPTIONS_NAMES: readonly ["value", "unmask", "onAccept", "onComplete", "inputRef"];
|
|
21
|
+
export type ReactElementProps<MaskElement extends InputMaskElement> = Omit<React.HTMLProps<MaskElement>, (typeof MASK_PROPS_NAMES)[number] | 'value' | (typeof NON_MASK_OPTIONS_NAMES)[number] | 'ref'>;
|
|
22
|
+
type NonMaskProps<MaskElement extends InputMaskElement, Props extends IMaskMixinProps<MaskElement> = AnyProps> = Omit<Props, keyof FactoryOpts>;
|
|
23
|
+
export type ReactMixinComponent<MaskElement extends InputMaskElement, Props extends IMaskMixinProps<MaskElement> = AnyProps> = React.ComponentType<ReactElementProps<MaskElement> & {
|
|
24
|
+
inputRef: React.Ref<MaskElement>;
|
|
25
|
+
} & NonMaskProps<MaskElement, Props>>;
|
|
26
|
+
export type MaskPropsKeys = Exclude<(typeof MASK_PROPS_NAMES)[number], (typeof NON_MASK_OPTIONS_NAMES)[number]>;
|
|
27
|
+
export type ExtractMaskOpts<MaskElement extends InputMaskElement, Props extends IMaskInputProps<MaskElement>> = Extract<Props, FactoryOpts>;
|
|
28
|
+
export type IMaskMixinProps<MaskElement extends InputMaskElement> = Omit<ReactMaskProps<MaskElement>, 'ref'> & MaskedPatternOptions;
|
|
29
|
+
export type IMaskInputProps<MaskElement extends InputMaskElement> = ReactElementProps<MaskElement> & IMaskMixinProps<MaskElement>;
|
|
30
|
+
export declare function IMaskMixin<MaskElement extends InputMaskElement, Props extends IMaskInputProps<MaskElement> = AnyProps>(ComposedComponent: ReactMixinComponent<MaskElement, Props>): React.ComponentType<Props>;
|
|
31
|
+
export {};
|