@skbkontur/react-ui 6.1.4-eef21.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/components/MaskedInputV2/MaskedInputV2.styles.d.ts +7 -0
- 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 +2 -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/utils.d.ts +0 -2
- package/lib/utils.js +0 -1
- package/lib/utils.js.map +1 -1
- package/package.json +4 -5
- 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/TimeFragmentsView.d.ts +0 -15
- package/components/TimePicker/TimeFragmentsView.js +0 -72
- package/components/TimePicker/TimeFragmentsView.js.map +0 -1
- package/components/TimePicker/TimeFragmentsView.styles.d.ts +0 -12
- package/components/TimePicker/TimeFragmentsView.styles.js +0 -43
- package/components/TimePicker/TimeFragmentsView.styles.js.map +0 -1
- package/components/TimePicker/TimeInput.d.ts +0 -22
- package/components/TimePicker/TimeInput.js +0 -103
- package/components/TimePicker/TimeInput.js.map +0 -1
- package/components/TimePicker/TimePicker.d.ts +0 -77
- package/components/TimePicker/TimePicker.js +0 -508
- package/components/TimePicker/TimePicker.js.map +0 -1
- package/components/TimePicker/TimePicker.styles.d.ts +0 -14
- package/components/TimePicker/TimePicker.styles.js +0 -45
- 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/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/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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMaskedCoreHandlers.js","sourceRoot":"","sources":["useMaskedCoreHandlers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EACL,UAAU,EACV,cAAc,EACd,WAAW,EACX,QAAQ,EACR,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,cAAc,GACf,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAqBpE;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAA6B;IA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AAS,WAAA;QACT,WAAW,aAAA;QACX,aAAa,eAAA;QACb,WAAW,aAAA;KACZ,CAAC;AACJ,CAAC","sourcesContent":["import type React from 'react';\nimport { useCallback, useRef, useState } from 'react';\n\nimport {\n isKeyArrow,\n isKeyBackspace,\n isKeyDelete,\n isKeyEnd,\n isKeyHome,\n isShortcutRedo,\n isShortcutSelectAll,\n isShortcutUndo,\n} from '../../../lib/events/keyboard/identifiers.js';\nimport { scrollInputCaretIntoView } from '../../../lib/scrollInputCaretIntoView.js';\nimport { extractRaw } from './extractRaw.js';\nimport type { MaskedCoreProps } from './MaskedCore.types.js';\nimport { computeMaskedCut, getMaskedCopyText } from './maskedCoreClipboard.js';\nimport { computeMaskedDeletion } from './maskedCoreDeletion.js';\nimport { applyMaskedInputChange } from './maskedCoreInputChange.js';\nimport { calcNavigationSelection } from './maskedCoreNavigation.js';\n\ntype MaskedCoreHandlerProps = Pick<\n MaskedCoreProps,\n | 'maskState'\n | 'slotMap'\n | 'engine'\n | 'currentRaw'\n | 'onRawChange'\n | 'onUnexpectedInput'\n | 'onUndo'\n | 'onRedo'\n | 'coreInputRef'\n | 'onKeyDown'\n | 'onMouseUp'\n | 'onInput'\n | 'onSelect'\n | 'onFocus'\n | 'onPaste'\n>;\n\n/**\n * Собирает обработчики DOM-событий для {@link MaskedCore}.\n * Инкапсулирует логику ввода, навигации, clipboard и undo/redo.\n *\n * @param props — состояние маски, движок и колбэки от MaskedInputV2.\n * @returns refs и обработчики для прямого `<input>`.\n */\nexport function useMaskedCoreHandlers(props: MaskedCoreHandlerProps) {\n const {\n maskState,\n slotMap,\n engine,\n currentRaw,\n onRawChange,\n onUnexpectedInput,\n onUndo,\n onRedo,\n coreInputRef,\n onKeyDown: inputOnKeyDown,\n onMouseUp: inputOnMouseUp,\n onInput: inputOnInput,\n onSelect: inputOnSelect,\n onFocus: inputOnFocus,\n onPaste: inputOnPaste,\n } = props;\n\n const pendingCursorRef = useRef<number | null>(null);\n const lastSelectionRef = useRef<{ start: number; end: number }>({ start: 0, end: 0 });\n const [selectionRange, setSelectionRange] = useState({ start: 0, end: 0 });\n\n const syncSelection = useCallback((el: HTMLInputElement) => {\n const start = el.selectionStart ?? 0;\n const end = el.selectionEnd ?? 0;\n lastSelectionRef.current = { start, end };\n setSelectionRange((prev) => (prev.start === start && prev.end === end ? prev : { start, end }));\n }, []);\n\n function setPendingCursor(pos: number) {\n pendingCursorRef.current = pos;\n coreInputRef.current?.setSelectionRange(pos, pos);\n }\n\n function handleChange(e: React.ChangeEvent<HTMLInputElement>) {\n const { newRaw, cursorPos, rejected } = applyMaskedInputChange({\n browserDraft: e.target.value,\n cursorPos: e.target.selectionStart ?? 0,\n typedValue: maskState.typedValue,\n currentRaw,\n oldSelection: lastSelectionRef.current,\n engine,\n });\n\n setPendingCursor(cursorPos);\n\n if (rejected) {\n onUnexpectedInput();\n return;\n }\n\n onRawChange(newRaw, 'input', cursorPos);\n }\n\n function handleKeyDown(e: React.KeyboardEvent<HTMLInputElement>) {\n const el = coreInputRef.current;\n\n if (isShortcutSelectAll(e) || isKeyArrow(e) || isKeyEnd(e) || isKeyHome(e) || isKeyBackspace(e) || isKeyDelete(e)) {\n pendingCursorRef.current = null;\n }\n\n if (isShortcutSelectAll(e)) {\n e.preventDefault();\n el?.setSelectionRange(0, maskState.typedLength);\n if (el) {\n scrollInputCaretIntoView(el);\n syncSelection(el);\n }\n } else if (isKeyArrow(e) || isKeyEnd(e) || isKeyHome(e)) {\n e.preventDefault();\n const [start, end, dir] = calcNavigationSelection(e, maskState.typedLength, el);\n el?.setSelectionRange(start, end, dir);\n if (el) {\n scrollInputCaretIntoView(el);\n syncSelection(el);\n }\n } else if (isKeyBackspace(e) || isKeyDelete(e)) {\n e.preventDefault();\n if (el) {\n handleDeletion(isKeyBackspace(e), el);\n }\n } else if (isShortcutUndo(e)) {\n e.preventDefault();\n onUndo?.();\n } else if (isShortcutRedo(e)) {\n e.preventDefault();\n onRedo?.();\n }\n\n inputOnKeyDown?.(e);\n }\n\n function handleDeletion(isBackspace: boolean, el: HTMLInputElement) {\n const result = computeMaskedDeletion({\n isBackspace,\n selStart: el.selectionStart ?? 0,\n selEnd: el.selectionEnd ?? 0,\n currentRaw,\n slotMap,\n });\n\n if (!result) {\n onUnexpectedInput();\n return;\n }\n\n pendingCursorRef.current = result.cursorPos;\n onRawChange(result.newRaw, 'input', result.cursorPos);\n }\n\n function handleSelect(e?: React.SyntheticEvent<HTMLInputElement>) {\n const el = coreInputRef.current;\n if (!el) {\n return;\n }\n\n const max = maskState.typedLength;\n const start = el.selectionStart ?? 0;\n const end = el.selectionEnd ?? 0;\n lastSelectionRef.current = { start, end };\n\n if (end > max) {\n el.setSelectionRange(Math.min(start, max), max, el.selectionDirection ?? 'none');\n }\n\n syncSelection(el);\n\n if (e) {\n inputOnSelect?.(e);\n }\n }\n\n function handlePaste(e: React.ClipboardEvent<HTMLInputElement>) {\n inputOnPaste?.(e);\n e.preventDefault();\n\n if (!e.clipboardData) {\n return;\n }\n\n onRawChange(e.clipboardData.getData('text/plain'), 'paste');\n }\n\n function handleCopy(e: React.ClipboardEvent<HTMLInputElement>) {\n const el = coreInputRef.current;\n if (!el) {\n return;\n }\n\n const start = el.selectionStart ?? 0;\n const end = el.selectionEnd ?? 0;\n e.clipboardData.setData('text/plain', getMaskedCopyText(maskState.displayValue, start, end));\n e.preventDefault();\n }\n\n function handleCut(e: React.ClipboardEvent<HTMLInputElement>) {\n handleCopy(e);\n\n const el = coreInputRef.current;\n if (!el) {\n return;\n }\n\n const start = el.selectionStart ?? 0;\n const end = el.selectionEnd ?? 0;\n const { newRaw, cursorPos } = computeMaskedCut(start, end, currentRaw, slotMap);\n\n pendingCursorRef.current = cursorPos;\n onRawChange(newRaw, 'input', cursorPos);\n }\n\n function handleInput(e: React.ChangeEvent<HTMLInputElement>) {\n inputOnInput?.(e);\n }\n\n function handleMouseUp(e: React.MouseEvent<HTMLInputElement>) {\n handleSelect();\n inputOnMouseUp?.(e);\n }\n\n function handleFocus(e: React.FocusEvent<HTMLInputElement>) {\n const domValue = e.currentTarget.value;\n if (domValue !== maskState.typedValue) {\n const syncedRaw = extractRaw(domValue, engine);\n if (syncedRaw !== currentRaw) {\n onRawChange(syncedRaw, 'input');\n }\n }\n\n const clickedPos = e.target.selectionStart ?? 0;\n pendingCursorRef.current = Math.min(clickedPos, maskState.typedLength);\n inputOnFocus?.(e);\n syncSelection(e.currentTarget);\n }\n\n return {\n pendingCursorRef,\n selectionRange,\n syncSelection,\n handleChange,\n handleKeyDown,\n handleSelect,\n handlePaste,\n handleCopy,\n handleCut,\n handleInput,\n handleMouseUp,\n handleFocus,\n };\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HTMLMaskElement } from './html-mask-element.js';
|
|
2
|
+
export type InputElement = HTMLTextAreaElement | HTMLInputElement;
|
|
3
|
+
/** Bridge between InputElement and {@link Masked} */
|
|
4
|
+
export declare class HTMLInputMaskElement extends HTMLMaskElement {
|
|
5
|
+
/** InputElement to use mask on */
|
|
6
|
+
input: InputElement;
|
|
7
|
+
constructor(input: InputElement);
|
|
8
|
+
/** Returns InputElement selection start */
|
|
9
|
+
get _unsafeSelectionStart(): number | null;
|
|
10
|
+
/** Returns InputElement selection end */
|
|
11
|
+
get _unsafeSelectionEnd(): number | null;
|
|
12
|
+
/** Sets InputElement selection */
|
|
13
|
+
_unsafeSelect(start: number, end: number): void;
|
|
14
|
+
get value(): string;
|
|
15
|
+
set value(value: string);
|
|
16
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
/* eslint-disable eqeqeq */
|
|
17
|
+
import { HTMLMaskElement } from './html-mask-element.js';
|
|
18
|
+
/** Bridge between InputElement and {@link Masked} */
|
|
19
|
+
var HTMLInputMaskElement = /** @class */ (function (_super) {
|
|
20
|
+
__extends(HTMLInputMaskElement, _super);
|
|
21
|
+
function HTMLInputMaskElement(input) {
|
|
22
|
+
var _this = _super.call(this, input) || this;
|
|
23
|
+
_this.input = input;
|
|
24
|
+
return _this;
|
|
25
|
+
}
|
|
26
|
+
Object.defineProperty(HTMLInputMaskElement.prototype, "_unsafeSelectionStart", {
|
|
27
|
+
/** Returns InputElement selection start */
|
|
28
|
+
get: function () {
|
|
29
|
+
return this.input.selectionStart != null ? this.input.selectionStart : this.value.length;
|
|
30
|
+
},
|
|
31
|
+
enumerable: false,
|
|
32
|
+
configurable: true
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(HTMLInputMaskElement.prototype, "_unsafeSelectionEnd", {
|
|
35
|
+
/** Returns InputElement selection end */
|
|
36
|
+
get: function () {
|
|
37
|
+
return this.input.selectionEnd;
|
|
38
|
+
},
|
|
39
|
+
enumerable: false,
|
|
40
|
+
configurable: true
|
|
41
|
+
});
|
|
42
|
+
/** Sets InputElement selection */
|
|
43
|
+
HTMLInputMaskElement.prototype._unsafeSelect = function (start, end) {
|
|
44
|
+
this.input.setSelectionRange(start, end);
|
|
45
|
+
};
|
|
46
|
+
Object.defineProperty(HTMLInputMaskElement.prototype, "value", {
|
|
47
|
+
get: function () {
|
|
48
|
+
return this.input.value;
|
|
49
|
+
},
|
|
50
|
+
set: function (value) {
|
|
51
|
+
this.input.value = value;
|
|
52
|
+
},
|
|
53
|
+
enumerable: false,
|
|
54
|
+
configurable: true
|
|
55
|
+
});
|
|
56
|
+
return HTMLInputMaskElement;
|
|
57
|
+
}(HTMLMaskElement));
|
|
58
|
+
export { HTMLInputMaskElement };
|
|
59
|
+
//# sourceMappingURL=html-input-mask-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-input-mask-element.js","sourceRoot":"","sources":["html-input-mask-element.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2BAA2B;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzD,qDAAqD;AACrD;IAA0C,wCAAe;IAIvD,8BAAY,KAAmB;QAC7B,YAAA,MAAK,YAAC,KAAK,CAAC,SAAC;QACb,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;;IACrB,CAAC;IAGD,sBAAa,uDAAqB;QADlC,2CAA2C;aAC3C;YACE,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QAC3F,CAAC;;;OAAA;IAGD,sBAAa,qDAAmB;QADhC,yCAAyC;aACzC;YACE,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;QACjC,CAAC;;;OAAA;IAED,kCAAkC;IAClC,4CAAa,GAAb,UAAc,KAAa,EAAE,GAAW;QACtC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC3C,CAAC;IAED,sBAAa,uCAAK;aAAlB;YACE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QAC1B,CAAC;aACD,UAAmB,KAAa;YAC9B,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;QAC3B,CAAC;;;OAHA;IAIH,2BAAC;AAAD,CAAC,AA9BD,CAA0C,eAAe,GA8BxD","sourcesContent":["/* eslint-disable eqeqeq */\nimport { HTMLMaskElement } from './html-mask-element.js';\n\nexport type InputElement = HTMLTextAreaElement | HTMLInputElement;\n\n/** Bridge between InputElement and {@link Masked} */\nexport class HTMLInputMaskElement extends HTMLMaskElement {\n /** InputElement to use mask on */\n input!: InputElement;\n\n constructor(input: InputElement) {\n super(input);\n this.input = input;\n }\n\n /** Returns InputElement selection start */\n override get _unsafeSelectionStart(): number | null {\n return this.input.selectionStart != null ? this.input.selectionStart : this.value.length;\n }\n\n /** Returns InputElement selection end */\n override get _unsafeSelectionEnd(): number | null {\n return this.input.selectionEnd;\n }\n\n /** Sets InputElement selection */\n _unsafeSelect(start: number, end: number): void {\n this.input.setSelectionRange(start, end);\n }\n\n override get value(): string {\n return this.input.value;\n }\n override set value(value: string) {\n this.input.value = value;\n }\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { MaskElement, type EventHandlers } from './mask-element.js';
|
|
2
|
+
/** Bridge between HTMLElement and {@link Masked} */
|
|
3
|
+
export declare abstract class HTMLMaskElement extends MaskElement {
|
|
4
|
+
/** HTMLElement to use mask on */
|
|
5
|
+
input: HTMLElement;
|
|
6
|
+
_handlers: EventHandlers;
|
|
7
|
+
abstract value: string;
|
|
8
|
+
constructor(input: HTMLElement);
|
|
9
|
+
get rootElement(): HTMLDocument;
|
|
10
|
+
/** Is element in focus */
|
|
11
|
+
get isActive(): boolean;
|
|
12
|
+
/** Binds HTMLElement events to mask internal events */
|
|
13
|
+
bindEvents(handlers: EventHandlers): void;
|
|
14
|
+
_onKeydown(e: KeyboardEvent): void;
|
|
15
|
+
_onBeforeinput(e: InputEvent): void;
|
|
16
|
+
_onCompositionEnd(e: CompositionEvent): void;
|
|
17
|
+
_onInput(e: InputEvent): void;
|
|
18
|
+
/** Unbinds HTMLElement events to mask internal events */
|
|
19
|
+
unbindEvents(): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
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 { MaskElement } from './mask-element.js';
|
|
17
|
+
/** Bridge between HTMLElement and {@link Masked} */
|
|
18
|
+
var HTMLMaskElement = /** @class */ (function (_super) {
|
|
19
|
+
__extends(HTMLMaskElement, _super);
|
|
20
|
+
function HTMLMaskElement(input) {
|
|
21
|
+
var _this = _super.call(this) || this;
|
|
22
|
+
_this.input = input;
|
|
23
|
+
_this._onKeydown = _this._onKeydown.bind(_this);
|
|
24
|
+
_this._onInput = _this._onInput.bind(_this);
|
|
25
|
+
_this._onBeforeinput = _this._onBeforeinput.bind(_this);
|
|
26
|
+
_this._onCompositionEnd = _this._onCompositionEnd.bind(_this);
|
|
27
|
+
return _this;
|
|
28
|
+
}
|
|
29
|
+
Object.defineProperty(HTMLMaskElement.prototype, "rootElement", {
|
|
30
|
+
get: function () {
|
|
31
|
+
var _a, _b, _c;
|
|
32
|
+
return ((_c = (_b = (_a = this.input).getRootNode) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : document);
|
|
33
|
+
},
|
|
34
|
+
enumerable: false,
|
|
35
|
+
configurable: true
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(HTMLMaskElement.prototype, "isActive", {
|
|
38
|
+
/** Is element in focus */
|
|
39
|
+
get: function () {
|
|
40
|
+
return this.input === this.rootElement.activeElement;
|
|
41
|
+
},
|
|
42
|
+
enumerable: false,
|
|
43
|
+
configurable: true
|
|
44
|
+
});
|
|
45
|
+
/** Binds HTMLElement events to mask internal events */
|
|
46
|
+
HTMLMaskElement.prototype.bindEvents = function (handlers) {
|
|
47
|
+
this.input.addEventListener('keydown', this._onKeydown);
|
|
48
|
+
this.input.addEventListener('input', this._onInput);
|
|
49
|
+
this.input.addEventListener('beforeinput', this._onBeforeinput);
|
|
50
|
+
this.input.addEventListener('compositionend', this._onCompositionEnd);
|
|
51
|
+
this.input.addEventListener('drop', handlers.drop);
|
|
52
|
+
this.input.addEventListener('click', handlers.click);
|
|
53
|
+
this.input.addEventListener('focus', handlers.focus);
|
|
54
|
+
this.input.addEventListener('blur', handlers.commit);
|
|
55
|
+
this._handlers = handlers;
|
|
56
|
+
};
|
|
57
|
+
HTMLMaskElement.prototype._onKeydown = function (e) {
|
|
58
|
+
var isUndo = (e.key === 'z' || e.key === 'Z') && (e.metaKey || e.ctrlKey) && !e.shiftKey;
|
|
59
|
+
var isRedo = ((e.key === 'y' || e.key === 'Y') && (e.metaKey || e.ctrlKey)) ||
|
|
60
|
+
((e.key === 'z' || e.key === 'Z') && e.shiftKey && (e.metaKey || e.ctrlKey));
|
|
61
|
+
if (this._handlers.redo && isRedo) {
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
return this._handlers.redo(e);
|
|
64
|
+
}
|
|
65
|
+
if (this._handlers.undo && isUndo) {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
return this._handlers.undo(e);
|
|
68
|
+
}
|
|
69
|
+
if (!e.isComposing) {
|
|
70
|
+
this._handlers.selectionChange(e);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
HTMLMaskElement.prototype._onBeforeinput = function (e) {
|
|
74
|
+
if (e.inputType === 'historyUndo' && this._handlers.undo) {
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
return this._handlers.undo(e);
|
|
77
|
+
}
|
|
78
|
+
if (e.inputType === 'historyRedo' && this._handlers.redo) {
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
return this._handlers.redo(e);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
HTMLMaskElement.prototype._onCompositionEnd = function (e) {
|
|
84
|
+
this._handlers.input(e);
|
|
85
|
+
};
|
|
86
|
+
HTMLMaskElement.prototype._onInput = function (e) {
|
|
87
|
+
if (!e.isComposing) {
|
|
88
|
+
this._handlers.input(e);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
/** Unbinds HTMLElement events to mask internal events */
|
|
92
|
+
HTMLMaskElement.prototype.unbindEvents = function () {
|
|
93
|
+
this.input.removeEventListener('keydown', this._onKeydown);
|
|
94
|
+
this.input.removeEventListener('input', this._onInput);
|
|
95
|
+
this.input.removeEventListener('beforeinput', this._onBeforeinput);
|
|
96
|
+
this.input.removeEventListener('compositionend', this._onCompositionEnd);
|
|
97
|
+
this.input.removeEventListener('drop', this._handlers.drop);
|
|
98
|
+
this.input.removeEventListener('click', this._handlers.click);
|
|
99
|
+
this.input.removeEventListener('focus', this._handlers.focus);
|
|
100
|
+
this.input.removeEventListener('blur', this._handlers.commit);
|
|
101
|
+
this._handlers = {};
|
|
102
|
+
};
|
|
103
|
+
return HTMLMaskElement;
|
|
104
|
+
}(MaskElement));
|
|
105
|
+
export { HTMLMaskElement };
|
|
106
|
+
//# sourceMappingURL=html-mask-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-mask-element.js","sourceRoot":"","sources":["html-mask-element.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAsB,MAAM,mBAAmB,CAAC;AAEpE,oDAAoD;AACpD;IAA8C,mCAAW;IAMvD,yBAAY,KAAkB;QA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,iBAAkC,CAAC,CAAC;QAC1F,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC5D,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC9D,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC9D,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9D,IAAI,CAAC,SAAS,GAAG,EAAmB,CAAC;IACvC,CAAC;IACH,sBAAC;AAAD,CAAC,AA5FD,CAA8C,WAAW,GA4FxD","sourcesContent":["import { MaskElement, type EventHandlers } from './mask-element.js';\n\n/** Bridge between HTMLElement and {@link Masked} */\nexport abstract class HTMLMaskElement extends MaskElement {\n /** HTMLElement to use mask on */\n input!: HTMLElement;\n _handlers!: EventHandlers;\n abstract value: string;\n\n constructor(input: HTMLElement) {\n super();\n this.input = input;\n this._onKeydown = this._onKeydown.bind(this);\n this._onInput = this._onInput.bind(this);\n this._onBeforeinput = this._onBeforeinput.bind(this);\n this._onCompositionEnd = this._onCompositionEnd.bind(this);\n }\n\n get rootElement(): HTMLDocument {\n return (this.input.getRootNode?.() ?? document) as HTMLDocument;\n }\n\n /** Is element in focus */\n get isActive(): boolean {\n return this.input === this.rootElement.activeElement;\n }\n\n /** Binds HTMLElement events to mask internal events */\n override bindEvents(handlers: EventHandlers): void {\n this.input.addEventListener('keydown', this._onKeydown as EventListener);\n this.input.addEventListener('input', this._onInput as EventListener);\n this.input.addEventListener('beforeinput', this._onBeforeinput as EventListener);\n this.input.addEventListener('compositionend', this._onCompositionEnd as EventListener);\n this.input.addEventListener('drop', handlers.drop);\n this.input.addEventListener('click', handlers.click);\n this.input.addEventListener('focus', handlers.focus);\n this.input.addEventListener('blur', handlers.commit);\n this._handlers = handlers;\n }\n\n _onKeydown(e: KeyboardEvent): void {\n const isUndo = (e.key === 'z' || e.key === 'Z') && (e.metaKey || e.ctrlKey) && !e.shiftKey;\n const isRedo =\n ((e.key === 'y' || e.key === 'Y') && (e.metaKey || e.ctrlKey)) ||\n ((e.key === 'z' || e.key === 'Z') && e.shiftKey && (e.metaKey || e.ctrlKey));\n\n if (this._handlers.redo && isRedo) {\n e.preventDefault();\n return this._handlers.redo(e);\n }\n\n if (this._handlers.undo && isUndo) {\n e.preventDefault();\n return this._handlers.undo(e);\n }\n\n if (!e.isComposing) {\n this._handlers.selectionChange(e);\n }\n }\n\n _onBeforeinput(e: InputEvent): void {\n if (e.inputType === 'historyUndo' && this._handlers.undo) {\n e.preventDefault();\n return this._handlers.undo(e);\n }\n\n if (e.inputType === 'historyRedo' && this._handlers.redo) {\n e.preventDefault();\n return this._handlers.redo(e);\n }\n }\n\n _onCompositionEnd(e: CompositionEvent): void {\n this._handlers.input(e);\n }\n\n _onInput(e: InputEvent): void {\n if (!e.isComposing) {\n this._handlers.input(e);\n }\n }\n\n /** Unbinds HTMLElement events to mask internal events */\n override unbindEvents(): void {\n this.input.removeEventListener('keydown', this._onKeydown as EventListener);\n this.input.removeEventListener('input', this._onInput as EventListener);\n this.input.removeEventListener('beforeinput', this._onBeforeinput as EventListener);\n this.input.removeEventListener('compositionend', this._onCompositionEnd as EventListener);\n this.input.removeEventListener('drop', this._handlers.drop);\n this.input.removeEventListener('click', this._handlers.click);\n this.input.removeEventListener('focus', this._handlers.focus);\n this.input.removeEventListener('blur', this._handlers.commit);\n this._handlers = {} as EventHandlers;\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Selection } from '../core/utils.js';
|
|
2
|
+
export interface InputHistoryState {
|
|
3
|
+
unmaskedValue: string;
|
|
4
|
+
selection: Selection;
|
|
5
|
+
}
|
|
6
|
+
export declare class InputHistory {
|
|
7
|
+
static MAX_LENGTH: number;
|
|
8
|
+
states: InputHistoryState[];
|
|
9
|
+
currentIndex: number;
|
|
10
|
+
get currentState(): InputHistoryState | undefined;
|
|
11
|
+
get isEmpty(): boolean;
|
|
12
|
+
push(state: InputHistoryState): void;
|
|
13
|
+
go(steps: number): InputHistoryState | undefined;
|
|
14
|
+
undo(): InputHistoryState | undefined;
|
|
15
|
+
redo(): InputHistoryState | undefined;
|
|
16
|
+
clear(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var InputHistory = /** @class */ (function () {
|
|
2
|
+
function InputHistory() {
|
|
3
|
+
this.states = [];
|
|
4
|
+
this.currentIndex = 0;
|
|
5
|
+
}
|
|
6
|
+
Object.defineProperty(InputHistory.prototype, "currentState", {
|
|
7
|
+
get: function () {
|
|
8
|
+
return this.states[this.currentIndex];
|
|
9
|
+
},
|
|
10
|
+
enumerable: false,
|
|
11
|
+
configurable: true
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(InputHistory.prototype, "isEmpty", {
|
|
14
|
+
get: function () {
|
|
15
|
+
return this.states.length === 0;
|
|
16
|
+
},
|
|
17
|
+
enumerable: false,
|
|
18
|
+
configurable: true
|
|
19
|
+
});
|
|
20
|
+
InputHistory.prototype.push = function (state) {
|
|
21
|
+
// if current index points before the last element then remove the future
|
|
22
|
+
if (this.currentIndex < this.states.length - 1) {
|
|
23
|
+
this.states.length = this.currentIndex + 1;
|
|
24
|
+
}
|
|
25
|
+
this.states.push(state);
|
|
26
|
+
if (this.states.length > InputHistory.MAX_LENGTH) {
|
|
27
|
+
this.states.shift();
|
|
28
|
+
}
|
|
29
|
+
this.currentIndex = this.states.length - 1;
|
|
30
|
+
};
|
|
31
|
+
InputHistory.prototype.go = function (steps) {
|
|
32
|
+
this.currentIndex = Math.min(Math.max(this.currentIndex + steps, 0), this.states.length - 1);
|
|
33
|
+
return this.currentState;
|
|
34
|
+
};
|
|
35
|
+
InputHistory.prototype.undo = function () {
|
|
36
|
+
return this.go(-1);
|
|
37
|
+
};
|
|
38
|
+
InputHistory.prototype.redo = function () {
|
|
39
|
+
return this.go(+1);
|
|
40
|
+
};
|
|
41
|
+
InputHistory.prototype.clear = function () {
|
|
42
|
+
this.states.length = 0;
|
|
43
|
+
this.currentIndex = 0;
|
|
44
|
+
};
|
|
45
|
+
InputHistory.MAX_LENGTH = 100;
|
|
46
|
+
return InputHistory;
|
|
47
|
+
}());
|
|
48
|
+
export { InputHistory };
|
|
49
|
+
//# sourceMappingURL=input-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-history.js","sourceRoot":"","sources":["input-history.ts"],"names":[],"mappings":"AAOA;IAAA;QAEE,WAAM,GAAwB,EAAE,CAAC;QACjC,iBAAY,GAAG,CAAC,CAAC;IAuCnB,CAAC;IArCC,sBAAI,sCAAY;aAAhB;YACE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACxC,CAAC;;;OAAA;IAED,sBAAI,iCAAO;aAAX;YACE,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;QAClC,CAAC;;;OAAA;IAED,2BAAI,GAAJ,UAAK,KAAwB;QAC3B,yEAAyE;QACzE,IAAI,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/C,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,YAAY,CAAC,UAAU,EAAE,CAAC;YACjD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC;QACD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7C,CAAC;IAED,yBAAE,GAAF,UAAG,KAAa;QACd,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,GAAG,KAAK,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC7F,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,2BAAI,GAAJ;QACE,OAAO,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;IAED,2BAAI,GAAJ;QACE,OAAO,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;IAED,4BAAK,GAAL;QACE,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;IACxB,CAAC;IAxCM,uBAAU,GAAG,GAAG,AAAN,CAAO;IAyC1B,mBAAC;CAAA,AA1CD,IA0CC;SA1CY,YAAY","sourcesContent":["import { type Selection } from '../core/utils.js';\n\nexport interface InputHistoryState {\n unmaskedValue: string;\n selection: Selection;\n}\n\nexport class InputHistory {\n static MAX_LENGTH = 100;\n states: InputHistoryState[] = [];\n currentIndex = 0;\n\n get currentState(): InputHistoryState | undefined {\n return this.states[this.currentIndex];\n }\n\n get isEmpty(): boolean {\n return this.states.length === 0;\n }\n\n push(state: InputHistoryState): void {\n // if current index points before the last element then remove the future\n if (this.currentIndex < this.states.length - 1) {\n this.states.length = this.currentIndex + 1;\n }\n this.states.push(state);\n if (this.states.length > InputHistory.MAX_LENGTH) {\n this.states.shift();\n }\n this.currentIndex = this.states.length - 1;\n }\n\n go(steps: number): InputHistoryState | undefined {\n this.currentIndex = Math.min(Math.max(this.currentIndex + steps, 0), this.states.length - 1);\n return this.currentState;\n }\n\n undo(): InputHistoryState | undefined {\n return this.go(-1);\n }\n\n redo(): InputHistoryState | undefined {\n return this.go(+1);\n }\n\n clear(): void {\n this.states.length = 0;\n this.currentIndex = 0;\n }\n}\n"]}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { type Selection } from '../core/utils.js';
|
|
2
|
+
import { type UpdateOpts, type FactoryArg, type FactoryReturnMasked } from '../masked/factory.js';
|
|
3
|
+
import { type InputElement } from './html-input-mask-element.js';
|
|
4
|
+
import { InputHistory, type InputHistoryState } from './input-history.js';
|
|
5
|
+
import { MaskElement } from './mask-element.js';
|
|
6
|
+
export type InputMaskElement = MaskElement | InputElement | HTMLElement;
|
|
7
|
+
export type InputMaskEventListener = (e?: InputEvent) => void;
|
|
8
|
+
/** Listens to element events and controls changes between element and {@link Masked} */
|
|
9
|
+
export declare class InputMask<Opts extends FactoryArg = Record<string, unknown>> {
|
|
10
|
+
/**
|
|
11
|
+
View element. Set to null after destroy() to release the reference.
|
|
12
|
+
*/
|
|
13
|
+
el: MaskElement | null;
|
|
14
|
+
/** Internal {@link Masked} model */
|
|
15
|
+
masked: FactoryReturnMasked<Opts>;
|
|
16
|
+
_listeners: Record<string, InputMaskEventListener[]>;
|
|
17
|
+
_value: string;
|
|
18
|
+
_changingCursorPos: number;
|
|
19
|
+
_unmaskedValue: string;
|
|
20
|
+
_rawInputValue: string;
|
|
21
|
+
_selection: Selection;
|
|
22
|
+
_cursorChanging?: ReturnType<typeof setTimeout>;
|
|
23
|
+
_historyChanging?: boolean;
|
|
24
|
+
_inputEvent?: InputEvent;
|
|
25
|
+
history: InputHistory;
|
|
26
|
+
constructor(el: InputMaskElement, opts: Opts);
|
|
27
|
+
maskEquals(mask: unknown): boolean;
|
|
28
|
+
/** Masked */
|
|
29
|
+
get mask(): FactoryReturnMasked<Opts>['mask'];
|
|
30
|
+
set mask(mask: unknown);
|
|
31
|
+
/** Raw value */
|
|
32
|
+
get value(): string;
|
|
33
|
+
set value(str: string);
|
|
34
|
+
/** Unmasked value */
|
|
35
|
+
get unmaskedValue(): string;
|
|
36
|
+
set unmaskedValue(str: string);
|
|
37
|
+
/** Raw input value */
|
|
38
|
+
get rawInputValue(): string;
|
|
39
|
+
set rawInputValue(str: string);
|
|
40
|
+
/** Typed unmasked value */
|
|
41
|
+
get typedValue(): FactoryReturnMasked<Opts>['typedValue'];
|
|
42
|
+
set typedValue(val: FactoryReturnMasked<Opts>['typedValue']);
|
|
43
|
+
/** Display value */
|
|
44
|
+
get displayValue(): string;
|
|
45
|
+
/** Starts listening to element events */
|
|
46
|
+
_bindEvents(): void;
|
|
47
|
+
/** Stops listening to element events */
|
|
48
|
+
_unbindEvents(): void;
|
|
49
|
+
/** Fires custom event */
|
|
50
|
+
_fireEvent(ev: string, e?: InputEvent): void;
|
|
51
|
+
/** Current selection start */
|
|
52
|
+
get selectionStart(): number;
|
|
53
|
+
/** Current cursor position */
|
|
54
|
+
get cursorPos(): number;
|
|
55
|
+
set cursorPos(pos: number);
|
|
56
|
+
/** Stores current selection */
|
|
57
|
+
_saveSelection(): void;
|
|
58
|
+
/** Syncronizes model value from view */
|
|
59
|
+
updateValue(): void;
|
|
60
|
+
/** Syncronizes view from model value, fires change events */
|
|
61
|
+
updateControl(cursorPos?: number | 'auto'): void;
|
|
62
|
+
/** Updates options with deep equal check, recreates {@link Masked} model if mask type changes */
|
|
63
|
+
updateOptions(opts: UpdateOpts<Opts>): void;
|
|
64
|
+
/** Updates cursor */
|
|
65
|
+
updateCursor(cursorPos: number): void;
|
|
66
|
+
/** Delays cursor update to support mobile browsers */
|
|
67
|
+
_delayUpdateCursor(cursorPos: number): void;
|
|
68
|
+
/** Fires custom events */
|
|
69
|
+
_fireChangeEvents(): void;
|
|
70
|
+
/** Aborts delayed cursor update */
|
|
71
|
+
_abortUpdateCursor(): void;
|
|
72
|
+
/** Aligns cursor to nearest available position */
|
|
73
|
+
alignCursor(): void;
|
|
74
|
+
/** Aligns cursor only if selection is empty */
|
|
75
|
+
alignCursorFriendly(): void;
|
|
76
|
+
/** Adds listener on custom event */
|
|
77
|
+
on(ev: string, handler: InputMaskEventListener): this;
|
|
78
|
+
/** Removes custom event listener */
|
|
79
|
+
off(ev: string, handler: InputMaskEventListener): this;
|
|
80
|
+
/** Handles view input event */
|
|
81
|
+
_onInput(e: InputEvent): void;
|
|
82
|
+
/** Handles view change event and commits model value */
|
|
83
|
+
_onChange(): void;
|
|
84
|
+
/** Handles view drop event, prevents by default */
|
|
85
|
+
_onDrop(ev: Event): void;
|
|
86
|
+
/** Restore last selection on focus */
|
|
87
|
+
_onFocus(): void;
|
|
88
|
+
/** Restore last selection on focus */
|
|
89
|
+
_onClick(): void;
|
|
90
|
+
_onUndo(): void;
|
|
91
|
+
_onRedo(): void;
|
|
92
|
+
_applyHistoryState(state: InputHistoryState | undefined): void;
|
|
93
|
+
/** Unbind view events and removes element reference */
|
|
94
|
+
destroy(): void;
|
|
95
|
+
}
|