@elliemae/ds-form 3.0.0-alpha.0 → 3.0.0-alpha.1
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/dist/cjs/CheckboxGroup/DSCheckboxGroup.js +29 -15
- package/dist/cjs/CheckboxGroup/DSCheckboxGroup.js.map +1 -1
- package/dist/cjs/ComboBoxFreeSolo/ComboBoxFreeSolo.js +65 -22
- package/dist/cjs/ComboBoxFreeSolo/ComboBoxFreeSolo.js.map +2 -2
- package/dist/cjs/ComboBoxFreeSolo/components/MultiValueRemove.js +19 -5
- package/dist/cjs/ComboBoxFreeSolo/components/MultiValueRemove.js.map +1 -1
- package/dist/cjs/ComboBoxFreeSolo/components/SingleValue.js +15 -3
- package/dist/cjs/ComboBoxFreeSolo/components/SingleValue.js.map +1 -1
- package/dist/cjs/ComboBoxFreeSolo/components/SingleValueRemove.js +20 -7
- package/dist/cjs/ComboBoxFreeSolo/components/SingleValueRemove.js.map +1 -1
- package/dist/cjs/DateInput/DSDateInput.js +46 -14
- package/dist/cjs/DateInput/DSDateInput.js.map +1 -1
- package/dist/cjs/DateInput/components/DateInputImpl.js +17 -4
- package/dist/cjs/DateInput/components/DateInputImpl.js.map +1 -1
- package/dist/cjs/DateInput/components/DateInputs.js +23 -9
- package/dist/cjs/DateInput/components/DateInputs.js.map +1 -1
- package/dist/cjs/DateInputV2/components/DateInputs.js +23 -9
- package/dist/cjs/DateInputV2/components/DateInputs.js.map +1 -1
- package/dist/cjs/ExpandableInput/ExpandableInputImpl.js +19 -3
- package/dist/cjs/ExpandableInput/ExpandableInputImpl.js.map +1 -1
- package/dist/cjs/FloatingLabelInput/FloatingLabelInputImpl.js +17 -4
- package/dist/cjs/FloatingLabelInput/FloatingLabelInputImpl.js.map +1 -1
- package/dist/cjs/FormItem/DSFormItemLayout.js +118 -56
- package/dist/cjs/FormItem/DSFormItemLayout.js.map +1 -1
- package/dist/cjs/FormItem/ValidationFieldWrapper.js +19 -3
- package/dist/cjs/FormItem/ValidationFieldWrapper.js.map +1 -1
- package/dist/cjs/InputGroup/AddonWrapper.js +17 -4
- package/dist/cjs/InputGroup/AddonWrapper.js.map +1 -1
- package/dist/cjs/InputMask/DSInputMask.js +51 -19
- package/dist/cjs/InputMask/DSInputMask.js.map +1 -1
- package/dist/cjs/InputMask/DSInputMaskDeprecated.js +62 -11
- package/dist/cjs/InputMask/DSInputMaskDeprecated.js.map +1 -1
- package/dist/cjs/InputMask/MaskTypes.js +17 -3
- package/dist/cjs/InputMask/MaskTypes.js.map +1 -1
- package/dist/cjs/InputMask/mask_types/DateInputMask.js +97 -37
- package/dist/cjs/InputMask/mask_types/DateInputMask.js.map +1 -1
- package/dist/cjs/InputMask/mask_types/DateTimeInputMask.js +97 -37
- package/dist/cjs/InputMask/mask_types/DateTimeInputMask.js.map +1 -1
- package/dist/cjs/InputMask/mask_types/DictionaryInputMask.js +103 -40
- package/dist/cjs/InputMask/mask_types/DictionaryInputMask.js.map +1 -1
- package/dist/cjs/InputMask/mask_types/NumberInputMask.js +121 -49
- package/dist/cjs/InputMask/mask_types/NumberInputMask.js.map +1 -1
- package/dist/cjs/InputMask/mask_types/PhoneInputMask.js +97 -37
- package/dist/cjs/InputMask/mask_types/PhoneInputMask.js.map +1 -1
- package/dist/cjs/InputMask/mask_types/PhoneInternationalInputMask.js +97 -37
- package/dist/cjs/InputMask/mask_types/PhoneInternationalInputMask.js.map +1 -1
- package/dist/cjs/InputMask/mask_types/SsnInputMask.js +97 -37
- package/dist/cjs/InputMask/mask_types/SsnInputMask.js.map +1 -1
- package/dist/cjs/InputMask/mask_types/UsZipCodeInputMask.js +97 -37
- package/dist/cjs/InputMask/mask_types/UsZipCodeInputMask.js.map +1 -1
- package/dist/cjs/InputMask/mask_types/ZipCodeSearchInputMask.js +97 -37
- package/dist/cjs/InputMask/mask_types/ZipCodeSearchInputMask.js.map +1 -1
- package/dist/cjs/InputMask/mask_types/index.js +119 -79
- package/dist/cjs/InputMask/mask_types/index.js.map +1 -1
- package/dist/cjs/InputProtected/DSInputProtected.js +51 -14
- package/dist/cjs/InputProtected/DSInputProtected.js.map +1 -1
- package/dist/cjs/LargeInputText/DSLargeInputText.js +19 -3
- package/dist/cjs/LargeInputText/DSLargeInputText.js.map +1 -1
- package/dist/cjs/Radio/DSRadio.js +65 -23
- package/dist/cjs/Radio/DSRadio.js.map +1 -1
- package/dist/cjs/RadioGroup/DSRadioGroup.js +29 -15
- package/dist/cjs/RadioGroup/DSRadioGroup.js.map +1 -1
- package/dist/cjs/TimeInput/DSTimeInput.js +40 -8
- package/dist/cjs/TimeInput/DSTimeInput.js.map +1 -1
- package/dist/cjs/TimeInput/TimeInputImpl.js +17 -4
- package/dist/cjs/TimeInput/TimeInputImpl.js.map +1 -1
- package/dist/cjs/TimeInput/TimeInputs.js +25 -12
- package/dist/cjs/TimeInput/TimeInputs.js.map +1 -1
- package/dist/cjs/Toggle/DSToggle.js +66 -25
- package/dist/cjs/Toggle/DSToggle.js.map +1 -1
- package/dist/cjs/Toggle/DSToggleImpl.js +22 -7
- package/dist/cjs/Toggle/DSToggleImpl.js.map +1 -1
- package/dist/cjs/Toggle/DSToggleRender.js +24 -10
- package/dist/cjs/Toggle/DSToggleRender.js.map +1 -1
- package/dist/esm/CheckboxGroup/DSCheckboxGroup.js +31 -15
- package/dist/esm/CheckboxGroup/DSCheckboxGroup.js.map +1 -1
- package/dist/esm/ComboBoxFreeSolo/ComboBoxFreeSolo.js +67 -22
- package/dist/esm/ComboBoxFreeSolo/ComboBoxFreeSolo.js.map +2 -2
- package/dist/esm/ComboBoxFreeSolo/components/MultiValueRemove.js +21 -5
- package/dist/esm/ComboBoxFreeSolo/components/MultiValueRemove.js.map +1 -1
- package/dist/esm/ComboBoxFreeSolo/components/SingleValue.js +17 -3
- package/dist/esm/ComboBoxFreeSolo/components/SingleValue.js.map +1 -1
- package/dist/esm/ComboBoxFreeSolo/components/SingleValueRemove.js +22 -7
- package/dist/esm/ComboBoxFreeSolo/components/SingleValueRemove.js.map +1 -1
- package/dist/esm/DateInput/DSDateInput.js +48 -14
- package/dist/esm/DateInput/DSDateInput.js.map +1 -1
- package/dist/esm/DateInput/components/DateInputImpl.js +19 -4
- package/dist/esm/DateInput/components/DateInputImpl.js.map +1 -1
- package/dist/esm/DateInput/components/DateInputs.js +25 -9
- package/dist/esm/DateInput/components/DateInputs.js.map +1 -1
- package/dist/esm/DateInputV2/components/DateInputs.js +25 -9
- package/dist/esm/DateInputV2/components/DateInputs.js.map +1 -1
- package/dist/esm/ExpandableInput/ExpandableInputImpl.js +21 -3
- package/dist/esm/ExpandableInput/ExpandableInputImpl.js.map +1 -1
- package/dist/esm/FloatingLabelInput/FloatingLabelInputImpl.js +19 -4
- package/dist/esm/FloatingLabelInput/FloatingLabelInputImpl.js.map +1 -1
- package/dist/esm/FormItem/DSFormItemLayout.js +120 -56
- package/dist/esm/FormItem/DSFormItemLayout.js.map +1 -1
- package/dist/esm/FormItem/ValidationFieldWrapper.js +21 -3
- package/dist/esm/FormItem/ValidationFieldWrapper.js.map +1 -1
- package/dist/esm/InputGroup/AddonWrapper.js +19 -4
- package/dist/esm/InputGroup/AddonWrapper.js.map +1 -1
- package/dist/esm/InputMask/DSInputMask.js +53 -19
- package/dist/esm/InputMask/DSInputMask.js.map +1 -1
- package/dist/esm/InputMask/DSInputMaskDeprecated.js +64 -11
- package/dist/esm/InputMask/DSInputMaskDeprecated.js.map +1 -1
- package/dist/esm/InputMask/MaskTypes.js +19 -3
- package/dist/esm/InputMask/MaskTypes.js.map +1 -1
- package/dist/esm/InputMask/mask_types/DateInputMask.js +99 -37
- package/dist/esm/InputMask/mask_types/DateInputMask.js.map +1 -1
- package/dist/esm/InputMask/mask_types/DateTimeInputMask.js +99 -37
- package/dist/esm/InputMask/mask_types/DateTimeInputMask.js.map +1 -1
- package/dist/esm/InputMask/mask_types/DictionaryInputMask.js +105 -40
- package/dist/esm/InputMask/mask_types/DictionaryInputMask.js.map +1 -1
- package/dist/esm/InputMask/mask_types/NumberInputMask.js +123 -49
- package/dist/esm/InputMask/mask_types/NumberInputMask.js.map +1 -1
- package/dist/esm/InputMask/mask_types/PhoneInputMask.js +99 -37
- package/dist/esm/InputMask/mask_types/PhoneInputMask.js.map +1 -1
- package/dist/esm/InputMask/mask_types/PhoneInternationalInputMask.js +99 -37
- package/dist/esm/InputMask/mask_types/PhoneInternationalInputMask.js.map +1 -1
- package/dist/esm/InputMask/mask_types/SsnInputMask.js +99 -37
- package/dist/esm/InputMask/mask_types/SsnInputMask.js.map +1 -1
- package/dist/esm/InputMask/mask_types/UsZipCodeInputMask.js +99 -37
- package/dist/esm/InputMask/mask_types/UsZipCodeInputMask.js.map +1 -1
- package/dist/esm/InputMask/mask_types/ZipCodeSearchInputMask.js +99 -37
- package/dist/esm/InputMask/mask_types/ZipCodeSearchInputMask.js.map +1 -1
- package/dist/esm/InputMask/mask_types/index.js +121 -79
- package/dist/esm/InputMask/mask_types/index.js.map +1 -1
- package/dist/esm/InputProtected/DSInputProtected.js +53 -14
- package/dist/esm/InputProtected/DSInputProtected.js.map +1 -1
- package/dist/esm/LargeInputText/DSLargeInputText.js +21 -3
- package/dist/esm/LargeInputText/DSLargeInputText.js.map +1 -1
- package/dist/esm/Radio/DSRadio.js +67 -23
- package/dist/esm/Radio/DSRadio.js.map +1 -1
- package/dist/esm/RadioGroup/DSRadioGroup.js +31 -15
- package/dist/esm/RadioGroup/DSRadioGroup.js.map +1 -1
- package/dist/esm/TimeInput/DSTimeInput.js +42 -8
- package/dist/esm/TimeInput/DSTimeInput.js.map +1 -1
- package/dist/esm/TimeInput/TimeInputImpl.js +19 -4
- package/dist/esm/TimeInput/TimeInputImpl.js.map +1 -1
- package/dist/esm/TimeInput/TimeInputs.js +27 -12
- package/dist/esm/TimeInput/TimeInputs.js.map +1 -1
- package/dist/esm/Toggle/DSToggle.js +68 -25
- package/dist/esm/Toggle/DSToggle.js.map +1 -1
- package/dist/esm/Toggle/DSToggleImpl.js +24 -7
- package/dist/esm/Toggle/DSToggleImpl.js.map +1 -1
- package/dist/esm/Toggle/DSToggleRender.js +26 -10
- package/dist/esm/Toggle/DSToggleRender.js.map +1 -1
- package/package.json +13 -12
- package/dist/types/Checkbox/DSCheckbox.d.ts +0 -0
- package/dist/types/Checkbox/defaultProps.d.ts +0 -0
- package/dist/types/Checkbox/elements/CheckMark.d.ts +0 -0
- package/dist/types/Checkbox/index.d.ts +0 -1
- package/dist/types/Checkbox/props.d.ts +0 -0
- package/dist/types/Checkbox/tests/DSCheckbox.events.test.d.ts +0 -0
- package/dist/types/CheckboxGroup/DSCheckboxGroup.d.ts +0 -72
- package/dist/types/CheckboxGroup/defaultProps.d.ts +0 -14
- package/dist/types/CheckboxGroup/index.d.ts +0 -1
- package/dist/types/CheckboxGroup/props.d.ts +0 -57
- package/dist/types/CheckboxGroup/tests/DSCheckboxGroup.events.test.d.ts +0 -1
- package/dist/types/ComboBox/DSComboBox.d.ts +0 -1
- package/dist/types/ComboBox/index.d.ts +0 -1
- package/dist/types/ComboBox/v1/DSComboBox.d.ts +0 -0
- package/dist/types/ComboBox/v1/components/AllOption.d.ts +0 -0
- package/dist/types/ComboBox/v1/components/ClearIndicator.d.ts +0 -0
- package/dist/types/ComboBox/v1/components/Control.d.ts +0 -0
- package/dist/types/ComboBox/v1/components/CustomOption.d.ts +0 -0
- package/dist/types/ComboBox/v1/components/CustomOptionMulti.d.ts +0 -0
- package/dist/types/ComboBox/v1/components/DropdownIndicator.d.ts +0 -0
- package/dist/types/ComboBox/v1/components/MenuList.d.ts +0 -0
- package/dist/types/ComboBox/v1/components/MultiSelectHeader.d.ts +0 -0
- package/dist/types/ComboBox/v1/components/MultiValueLabel.d.ts +0 -0
- package/dist/types/ComboBox/v1/components/MultiValueRemove.d.ts +0 -0
- package/dist/types/ComboBox/v1/components/SelectMenu.d.ts +0 -0
- package/dist/types/ComboBox/v1/components/SingleValueLabel.d.ts +0 -0
- package/dist/types/ComboBox/v1/components/ValueContainer.d.ts +0 -0
- package/dist/types/ComboBox/v1/components/calculateWidth.d.ts +0 -0
- package/dist/types/ComboBox/v1/components/getoptions.d.ts +0 -0
- package/dist/types/ComboBox/v1/index.d.ts +0 -1
- package/dist/types/ComboBox/v1/withSelectStringValueConverter.d.ts +0 -0
- package/dist/types/ComboBox/v2/Combobox.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/AllOption.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/ClearIndicator.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/Content.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/Control.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/CustomOption.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/CustomOptionMulti.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/DropdownIndicator.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/GroupHeading.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/IndicatorSeparator.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/LoadingIndicator.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/MenuList.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/MultiSelectHeader.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/MultiValueLabel.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/MultiValueRemove.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/SelectMenu.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/SingleValueLabel.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/ValueContainer.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/calculateWidth.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/getoptions.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/tests/ClearIndicator.test.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/useMenuListHeight.d.ts +0 -0
- package/dist/types/ComboBox/v2/components/utils.d.ts +0 -0
- package/dist/types/ComboBox/v2/context.d.ts +0 -0
- package/dist/types/ComboBox/v2/index.d.ts +0 -0
- package/dist/types/ComboBox/v2/mockOptions.d.ts +0 -0
- package/dist/types/ComboBox/v2/tests/Combobox.test.d.ts +0 -0
- package/dist/types/ComboBox/v2/withSelectStringValueConverter.d.ts +0 -0
- package/dist/types/ComboBox/v3/ComboBox.d.ts +0 -0
- package/dist/types/ComboBox/v3/ComboBoxCTX.d.ts +0 -0
- package/dist/types/ComboBox/v3/ComboboxDataTestids.d.ts +0 -0
- package/dist/types/ComboBox/v3/config/constants.d.ts +0 -0
- package/dist/types/ComboBox/v3/config/useComboBox.d.ts +0 -0
- package/dist/types/ComboBox/v3/config/useGetPropsWithDefault.d.ts +0 -0
- package/dist/types/ComboBox/v3/index.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/a11y-messages/MultiAllyMessages.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/a11y-messages/SingleAllyMessages.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/a11y-messages/index.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/a11y-messages/styled.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/container/Container.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/container/index.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/container/styled.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/controls/Controls.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/controls/index.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/controls/styled.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/controls-input/ControlsInput.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/controls-input/styled.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/controls-input/useControlsInput.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/dropdown-indicator/DropdownIndicator.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/dropdown-indicator/index.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/dropdown-indicator/styled.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/empty-state/index.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/empty-state/styled.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/header-list/HeaderList.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/header-list/index.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/header-list/styled.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/header-list/useHeaderListHandlers.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/menu-list/MenuList.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/menu-list/index.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/menu-list/styled.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/menu-list/useItemRenderer.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/menu-list/useMenuList.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/multi-selected-values-container/MultiSelectedValuesContainer.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/multi-selected-values-container/index.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/multi-selected-values-container/styled.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/multi-selected-values-container/useGroupPills.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/single-selected-value-container/SingleSelectedValueContainer.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/single-selected-value-container/index.d.ts +0 -0
- package/dist/types/ComboBox/v3/parts/single-selected-value-container/styled.d.ts +0 -0
- package/dist/types/ComboBox/v3/propTypes.d.ts +0 -0
- package/dist/types/ComboBox/v3/tests/combobox-general.test.d.ts +0 -0
- package/dist/types/ComboBox/v3/tests/combobox-multi-select.test.d.ts +0 -0
- package/dist/types/ComboBox/v3/tests/combobox-single-select.test.d.ts +0 -0
- package/dist/types/ComboBox/v3/tests/combobox-special-keys.test.d.ts +0 -0
- package/dist/types/ComboBox/v3/tests/utils.d.ts +0 -0
- package/dist/types/ComboBox/v3/utils/hooks/useKeyboardNavigation.d.ts +0 -0
- package/dist/types/ComboBox/v3/utils/hooks/useOnElementResize.d.ts +0 -0
- package/dist/types/ComboBox/v3/utils/listHelper.d.ts +0 -0
- package/dist/types/ComboBoxFreeSolo/ComboBoxFreeSolo.d.ts +0 -78
- package/dist/types/ComboBoxFreeSolo/components/MultiValueLabel.d.ts +0 -6
- package/dist/types/ComboBoxFreeSolo/components/MultiValueRemove.d.ts +0 -6
- package/dist/types/ComboBoxFreeSolo/components/SingleValue.d.ts +0 -3
- package/dist/types/ComboBoxFreeSolo/components/SingleValueRemove.d.ts +0 -6
- package/dist/types/ComboBoxFreeSolo/index.d.ts +0 -1
- package/dist/types/DateInput/DSDateInput.d.ts +0 -143
- package/dist/types/DateInput/components/DateInputImpl.d.ts +0 -41
- package/dist/types/DateInput/components/DateInputs.d.ts +0 -41
- package/dist/types/DateInput/components/utils.d.ts +0 -40
- package/dist/types/DateInput/defaultProps.d.ts +0 -18
- package/dist/types/DateInput/index.d.ts +0 -1
- package/dist/types/DateInput/props.d.ts +0 -173
- package/dist/types/DateInput/tests/DSDateInput.events.test.d.ts +0 -1
- package/dist/types/DateInputV2/components/DSDateInput.d.ts +0 -97
- package/dist/types/DateInputV2/components/DateInputs.d.ts +0 -33
- package/dist/types/DateInputV2/components/helpers.d.ts +0 -1
- package/dist/types/DateInputV2/components/props.d.ts +0 -104
- package/dist/types/DateInputV2/components/propsTypes.d.ts +0 -21
- package/dist/types/DateInputV2/components/styled.d.ts +0 -5
- package/dist/types/DateInputV2/components/utils.d.ts +0 -42
- package/dist/types/DateInputV2/index.d.ts +0 -2
- package/dist/types/DateInputV2/tests/DateInput.test.d.ts +0 -1
- package/dist/types/ExpandableInput/DSExpandableInput.d.ts +0 -16
- package/dist/types/ExpandableInput/ExpandableInputImpl.d.ts +0 -7
- package/dist/types/ExpandableInput/index.d.ts +0 -1
- package/dist/types/FloatingLabelInput/DSFloatingLabelInput.d.ts +0 -44
- package/dist/types/FloatingLabelInput/FloatingLabelInputImpl.d.ts +0 -27
- package/dist/types/FloatingLabelInput/getSvgPath.d.ts +0 -10
- package/dist/types/FloatingLabelInput/index.d.ts +0 -1
- package/dist/types/FormItem/DSFormItemLayout.d.ts +0 -335
- package/dist/types/FormItem/Error/DSError.d.ts +0 -31
- package/dist/types/FormItem/Feedback.d.ts +0 -7
- package/dist/types/FormItem/Label/DSLabel.d.ts +0 -24
- package/dist/types/FormItem/Suffix/Suffix.d.ts +0 -4
- package/dist/types/FormItem/ValidationFieldWrapper.d.ts +0 -19
- package/dist/types/FormItem/defaultProps.d.ts +0 -52
- package/dist/types/FormItem/index.d.ts +0 -2
- package/dist/types/FormItem/props.d.ts +0 -270
- package/dist/types/FormItem/tests/DSFormItem.events.test.d.ts +0 -1
- package/dist/types/FormItem/variants.d.ts +0 -8
- package/dist/types/Input/DSInput.d.ts +0 -0
- package/dist/types/Input/InputAddonWrapper.d.ts +0 -0
- package/dist/types/Input/InputImpl.d.ts +0 -0
- package/dist/types/Input/index.d.ts +0 -1
- package/dist/types/Input/tests/Input.test.d.ts +0 -0
- package/dist/types/InputGroup/AddonWrapper.d.ts +0 -8
- package/dist/types/InputGroup/DSInputGroup.d.ts +0 -72
- package/dist/types/InputGroup/defaultProps.d.ts +0 -8
- package/dist/types/InputGroup/index.d.ts +0 -1
- package/dist/types/InputGroup/props.d.ts +0 -60
- package/dist/types/InputGroup/tests/DSInputGroup.events.test.d.ts +0 -1
- package/dist/types/InputMask/DSInputMask.d.ts +0 -218
- package/dist/types/InputMask/DSInputMaskDeprecated.d.ts +0 -18
- package/dist/types/InputMask/InputMaskContext.d.ts +0 -18
- package/dist/types/InputMask/MaskPipes.d.ts +0 -18
- package/dist/types/InputMask/MaskTypes.d.ts +0 -15
- package/dist/types/InputMask/addons/AutoCorrectedDatePipe.d.ts +0 -8
- package/dist/types/InputMask/defaultProps.d.ts +0 -28
- package/dist/types/InputMask/index.d.ts +0 -1
- package/dist/types/InputMask/mask_types/DateInputMask.d.ts +0 -75
- package/dist/types/InputMask/mask_types/DateTimeInputMask.d.ts +0 -75
- package/dist/types/InputMask/mask_types/DictionaryInputMask.d.ts +0 -81
- package/dist/types/InputMask/mask_types/NumberInputMask.d.ts +0 -99
- package/dist/types/InputMask/mask_types/PhoneInputMask.d.ts +0 -75
- package/dist/types/InputMask/mask_types/PhoneInternationalInputMask.d.ts +0 -75
- package/dist/types/InputMask/mask_types/SsnInputMask.d.ts +0 -75
- package/dist/types/InputMask/mask_types/UsZipCodeInputMask.d.ts +0 -75
- package/dist/types/InputMask/mask_types/ZipCodeSearchInputMask.d.ts +0 -75
- package/dist/types/InputMask/mask_types/index.d.ts +0 -42
- package/dist/types/InputMask/props.d.ts +0 -254
- package/dist/types/InputMask/tests/DSInputMask.test.d.ts +0 -1
- package/dist/types/InputMask/tests/NumberInputMask.test.d.ts +0 -1
- package/dist/types/InputMask/tests/events/DateInputMask.events.test.d.ts +0 -1
- package/dist/types/InputMask/tests/events/DateTimeInputMask.events.test.d.ts +0 -1
- package/dist/types/InputMask/tests/events/NumberInputMask.events.test.d.ts +0 -1
- package/dist/types/InputMask/tests/events/PercentInputMask.events.test.d.ts +0 -1
- package/dist/types/InputMask/tests/events/PhoneInputMask.events.test.d.ts +0 -1
- package/dist/types/InputMask/tests/events/PhoneInternationalInputMask.events.test.d.ts +0 -1
- package/dist/types/InputMask/tests/events/SsnInputMask.events.test.d.ts +0 -1
- package/dist/types/InputMask/tests/events/UsZipCodeInputMask.events.test.d.ts +0 -1
- package/dist/types/InputMask/tests/events/ZipCodeSearchInputMask.events.test.d.ts +0 -1
- package/dist/types/InputMask/types/index.d.ts +0 -5
- package/dist/types/InputMask/utils/setCaretPosition.d.ts +0 -3
- package/dist/types/InputProtected/DSInputProtected.d.ts +0 -70
- package/dist/types/InputProtected/defaultProps.d.ts +0 -4
- package/dist/types/InputProtected/index.d.ts +0 -2
- package/dist/types/InputProtected/options.d.ts +0 -8
- package/dist/types/InputProtected/props.d.ts +0 -49
- package/dist/types/InputProtected/tests/DSInputProtected.events.test.d.ts +0 -1
- package/dist/types/InputProtected/tests/DSInputProtected.test.d.ts +0 -1
- package/dist/types/LargeInputText/DSLargeInputText.d.ts +0 -233
- package/dist/types/LargeInputText/defaultProps.d.ts +0 -31
- package/dist/types/LargeInputText/index.d.ts +0 -1
- package/dist/types/LargeInputText/props.d.ts +0 -231
- package/dist/types/LargeInputText/tests/DSLargeInputText.events.test.d.ts +0 -1
- package/dist/types/LargeInputText/tests/DSLargeInputText.test.d.ts +0 -1
- package/dist/types/MenuItem/components/MenuItem/index.d.ts +0 -0
- package/dist/types/MenuItem/components/MenuItem/styled.d.ts +0 -0
- package/dist/types/MenuItem/components/MultiMenuItem/MultiMenuItem.d.ts +0 -0
- package/dist/types/MenuItem/components/MultiMenuItem/styled.d.ts +0 -0
- package/dist/types/MenuItem/components/Section/index.d.ts +0 -0
- package/dist/types/MenuItem/components/Section/props.d.ts +0 -0
- package/dist/types/MenuItem/components/Section/styled.d.ts +0 -0
- package/dist/types/MenuItem/components/Separator/index.d.ts +0 -0
- package/dist/types/MenuItem/components/Separator/styled.d.ts +0 -0
- package/dist/types/MenuItem/components/SingleMenuItem/SingleMenuItem.d.ts +0 -0
- package/dist/types/MenuItem/components/SubmenuItem/index.d.ts +0 -0
- package/dist/types/MenuItem/components/SubmenuItem/styled.d.ts +0 -0
- package/dist/types/MenuItem/components/index.d.ts +0 -0
- package/dist/types/MenuItem/components/styled.d.ts +0 -0
- package/dist/types/MenuItem/index.d.ts +0 -0
- package/dist/types/MenuItem/props.d.ts +0 -0
- package/dist/types/Radio/Circle.d.ts +0 -8
- package/dist/types/Radio/DSRadio.d.ts +0 -157
- package/dist/types/Radio/index.d.ts +0 -1
- package/dist/types/RadioGroup/DSRadioGroup.d.ts +0 -72
- package/dist/types/RadioGroup/defaultProps.d.ts +0 -12
- package/dist/types/RadioGroup/index.d.ts +0 -1
- package/dist/types/RadioGroup/props.d.ts +0 -56
- package/dist/types/RadioGroup/tests/DSRadioGroup.events.test.d.ts +0 -1
- package/dist/types/RequiredMark/RequiredMark.d.ts +0 -7
- package/dist/types/RequiredMark/index.d.ts +0 -1
- package/dist/types/SearchBox/DSSearchBox.d.ts +0 -0
- package/dist/types/SearchBox/NavSearchBox.d.ts +0 -0
- package/dist/types/SearchBox/SButton.d.ts +0 -0
- package/dist/types/SearchBox/SearchBoxToggle.d.ts +0 -0
- package/dist/types/SearchBox/defaultProps.d.ts +0 -0
- package/dist/types/SearchBox/index.d.ts +0 -1
- package/dist/types/SearchBox/props.d.ts +0 -0
- package/dist/types/SearchBox/styled.d.ts +0 -0
- package/dist/types/SearchBox/tests/DSNavSearchBox.events.test.d.ts +0 -0
- package/dist/types/SearchBox/tests/DSSearchBox.events.test.d.ts +0 -0
- package/dist/types/SearchBox/tests/DSSearchBox.test.d.ts +0 -0
- package/dist/types/SearchBox/useSearch.d.ts +0 -0
- package/dist/types/SearchBox/withSearchable.d.ts +0 -0
- package/dist/types/TextBox/DSTextBox.d.ts +0 -0
- package/dist/types/TextBox/index.d.ts +0 -1
- package/dist/types/TextBox/tests/DSTextBox.test.d.ts +0 -0
- package/dist/types/TimeInput/DSTimeInput.d.ts +0 -122
- package/dist/types/TimeInput/TimeInputImpl.d.ts +0 -56
- package/dist/types/TimeInput/TimeInputs.d.ts +0 -18
- package/dist/types/TimeInput/index.d.ts +0 -1
- package/dist/types/TimeInput/utils.d.ts +0 -39
- package/dist/types/Toggle/DSToggle.d.ts +0 -134
- package/dist/types/Toggle/DSToggleImpl.d.ts +0 -57
- package/dist/types/Toggle/DSToggleRender.d.ts +0 -33
- package/dist/types/Toggle/index.d.ts +0 -1
- package/dist/types/Toggle/props.d.ts +0 -47
- package/dist/types/Toggle/toggleHelper.d.ts +0 -24
- package/dist/types/index.d.ts +0 -21
|
@@ -1,10 +1,39 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
7
24
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
8
37
|
var __export = (target, all) => {
|
|
9
38
|
for (var name in all)
|
|
10
39
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -124,52 +153,96 @@ const conformValue = (prevRawValue, prevCursorPos, lastkeycode, {
|
|
|
124
153
|
maskedPos: Math.min(maskedPos, nextMaskedValue.length - suffix.length)
|
|
125
154
|
};
|
|
126
155
|
};
|
|
127
|
-
const NumberInputMask = ({
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
156
|
+
const NumberInputMask = (_a) => {
|
|
157
|
+
var _b = _a, {
|
|
158
|
+
focus,
|
|
159
|
+
setFocus,
|
|
160
|
+
setRawMask,
|
|
161
|
+
cursorPosition,
|
|
162
|
+
setCursorPosition,
|
|
163
|
+
lastkey,
|
|
164
|
+
setLastkey,
|
|
165
|
+
setRawValue,
|
|
166
|
+
allowDecimal,
|
|
167
|
+
allowLeadingZeroes,
|
|
168
|
+
allowNegative,
|
|
169
|
+
autoFocus,
|
|
170
|
+
className,
|
|
171
|
+
clearable = false,
|
|
172
|
+
decimalLimit,
|
|
173
|
+
decimalSymbol,
|
|
174
|
+
disabled,
|
|
175
|
+
fluidWidth,
|
|
176
|
+
hasError,
|
|
177
|
+
includeThousandsSeparator,
|
|
178
|
+
innerRef,
|
|
179
|
+
integerLimit,
|
|
180
|
+
leftComponent,
|
|
181
|
+
maxLength,
|
|
182
|
+
minLength,
|
|
183
|
+
name,
|
|
184
|
+
onBlur,
|
|
185
|
+
onChange,
|
|
186
|
+
onClick,
|
|
187
|
+
onFocus,
|
|
188
|
+
onKeyDown,
|
|
189
|
+
onKeyUp,
|
|
190
|
+
onPaste,
|
|
191
|
+
placeholder,
|
|
192
|
+
prefix,
|
|
193
|
+
readOnly,
|
|
194
|
+
requireDecimal,
|
|
195
|
+
rightComponent,
|
|
196
|
+
style,
|
|
197
|
+
suffix,
|
|
198
|
+
thousandsSeparatorSymbol,
|
|
199
|
+
type,
|
|
200
|
+
value
|
|
201
|
+
} = _b, rest = __objRest(_b, [
|
|
202
|
+
"focus",
|
|
203
|
+
"setFocus",
|
|
204
|
+
"setRawMask",
|
|
205
|
+
"cursorPosition",
|
|
206
|
+
"setCursorPosition",
|
|
207
|
+
"lastkey",
|
|
208
|
+
"setLastkey",
|
|
209
|
+
"setRawValue",
|
|
210
|
+
"allowDecimal",
|
|
211
|
+
"allowLeadingZeroes",
|
|
212
|
+
"allowNegative",
|
|
213
|
+
"autoFocus",
|
|
214
|
+
"className",
|
|
215
|
+
"clearable",
|
|
216
|
+
"decimalLimit",
|
|
217
|
+
"decimalSymbol",
|
|
218
|
+
"disabled",
|
|
219
|
+
"fluidWidth",
|
|
220
|
+
"hasError",
|
|
221
|
+
"includeThousandsSeparator",
|
|
222
|
+
"innerRef",
|
|
223
|
+
"integerLimit",
|
|
224
|
+
"leftComponent",
|
|
225
|
+
"maxLength",
|
|
226
|
+
"minLength",
|
|
227
|
+
"name",
|
|
228
|
+
"onBlur",
|
|
229
|
+
"onChange",
|
|
230
|
+
"onClick",
|
|
231
|
+
"onFocus",
|
|
232
|
+
"onKeyDown",
|
|
233
|
+
"onKeyUp",
|
|
234
|
+
"onPaste",
|
|
235
|
+
"placeholder",
|
|
236
|
+
"prefix",
|
|
237
|
+
"readOnly",
|
|
238
|
+
"requireDecimal",
|
|
239
|
+
"rightComponent",
|
|
240
|
+
"style",
|
|
241
|
+
"suffix",
|
|
242
|
+
"thousandsSeparatorSymbol",
|
|
243
|
+
"type",
|
|
244
|
+
"value"
|
|
245
|
+
]);
|
|
173
246
|
const inputRef = (0, import_react.useRef)();
|
|
174
247
|
const [maskedValue, setMaskedValue] = (0, import_react.useState)(value);
|
|
175
248
|
const conform = (0, import_react.useCallback)(({
|
|
@@ -243,8 +316,7 @@ const NumberInputMask = ({
|
|
|
243
316
|
});
|
|
244
317
|
}
|
|
245
318
|
}, [maskedValue, requireDecimal, suffix, decimalLimit, onBlur]);
|
|
246
|
-
return /* @__PURE__ */ import_react.default.createElement(import_TextBox.DSTextBox, {
|
|
247
|
-
...rest,
|
|
319
|
+
return /* @__PURE__ */ import_react.default.createElement(import_TextBox.DSTextBox, __spreadProps(__spreadValues({}, rest), {
|
|
248
320
|
className,
|
|
249
321
|
clearable,
|
|
250
322
|
disabled,
|
|
@@ -273,7 +345,7 @@ const NumberInputMask = ({
|
|
|
273
345
|
style,
|
|
274
346
|
type,
|
|
275
347
|
value: maskedValue
|
|
276
|
-
});
|
|
348
|
+
}));
|
|
277
349
|
};
|
|
278
350
|
NumberInputMask.propTypes = {
|
|
279
351
|
focus: import_react_desc.PropTypes.bool,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/InputMask/mask_types/NumberInputMask.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable max-params */\n/* eslint-disable max-statements */\n/* eslint-disable max-lines */\n/* eslint-disable complexity */\n\nimport React, { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { PropTypes } from 'react-desc';\nimport { DSTextBox } from '../../TextBox';\nimport { setCaretPosition } from '../utils/setCaretPosition';\n\n// http://stackoverflow.com/a/10899795/604296\nconst addThousandsSeparator = (n, thousandsSeparatorSymbol) =>\n n.replace(/\\B(?=(\\d{3})+(?!\\d))/g, thousandsSeparatorSymbol);\n\nconst conformValue = (\n prevRawValue,\n prevCursorPos,\n lastkeycode,\n {\n prefix,\n suffix,\n includeThousandsSeparator,\n thousandsSeparatorSymbol,\n allowDecimal,\n decimalSymbol,\n decimalLimit,\n requireDecimal,\n allowNegative,\n allowLeadingZeroes,\n integerLimit,\n shouldCompleteDecimals,\n },\n) => {\n const prefixIndex = prevRawValue.indexOf(prefix);\n const suffixIndex = prevRawValue.lastIndexOf(suffix);\n const negativeIndex = prevRawValue.indexOf('-');\n\n const cursorPos =\n prevCursorPos - (prefixIndex === -1 ? 0 : prefixIndex + prefix.length);\n\n const rawValue = prevRawValue.substring(\n prefixIndex === -1 ? 0 : prefixIndex + prefix.length,\n suffixIndex === -1 ? prevRawValue.length : suffixIndex,\n );\n\n const filteredRawValue = rawValue\n .split('')\n .filter(\n (char) =>\n (char >= '0' && char <= '9') || char === decimalSymbol || char === '-',\n );\n\n let isNegative =\n allowNegative &&\n negativeIndex !== -1 &&\n (prefixIndex === -1 || negativeIndex < prefixIndex);\n\n let integer = '';\n let decimal = '';\n let foundDecimalSymbol = false;\n\n const integerFits = () =>\n integerLimit === null || integer.length < integerLimit;\n const decimalFits = () =>\n decimalLimit === null || decimal.length < decimalLimit;\n\n filteredRawValue.forEach((char) => {\n if (allowDecimal && !foundDecimalSymbol && char === decimalSymbol) {\n foundDecimalSymbol = true;\n } else if (\n allowNegative &&\n !integer.length &&\n !foundDecimalSymbol &&\n char === '-'\n ) {\n isNegative = true;\n } else if (char >= '0' && char <= '9') {\n if (!foundDecimalSymbol && integerFits()) {\n integer += char;\n } else if (foundDecimalSymbol && decimalFits()) {\n decimal += char;\n }\n }\n });\n\n if (requireDecimal) foundDecimalSymbol = true;\n if (!requireDecimal && !decimal?.length && lastkeycode === 8) {\n foundDecimalSymbol = false;\n }\n if (!integer && !decimal) foundDecimalSymbol = false;\n\n if (foundDecimalSymbol && !integer && decimal) {\n integer = '0';\n }\n\n if (!allowLeadingZeroes) {\n while (integer.length > 1 && integer[0] === '0')\n integer = integer.substring(1);\n }\n\n let nextMaskedValue = includeThousandsSeparator\n ? addThousandsSeparator(integer, thousandsSeparatorSymbol)\n : integer;\n nextMaskedValue += foundDecimalSymbol ? decimalSymbol : '';\n\n if (shouldCompleteDecimals)\n while (decimal.length !== decimalLimit) decimal += '0';\n\n nextMaskedValue += decimal;\n\n let maskedPos = 0;\n for (let i = 0; i < cursorPos; i += 1) {\n if (nextMaskedValue[maskedPos] === thousandsSeparatorSymbol) maskedPos += 1;\n if (nextMaskedValue[maskedPos] === rawValue[i]) maskedPos += 1;\n }\n if (nextMaskedValue.length || isNegative) {\n nextMaskedValue = prefix + nextMaskedValue;\n maskedPos += prefix.length;\n\n if (isNegative) {\n if (lastkeycode !== 8 || nextMaskedValue !== prefix)\n nextMaskedValue = `-${nextMaskedValue}`;\n maskedPos += 1;\n }\n\n nextMaskedValue += suffix;\n }\n\n if (lastkeycode !== 8 && maskedPos < nextMaskedValue.length) {\n if (\n nextMaskedValue[maskedPos] === decimalSymbol &&\n integer.length === integerLimit\n ) {\n maskedPos += 1;\n } else if (nextMaskedValue[maskedPos] === thousandsSeparatorSymbol) {\n maskedPos += 1;\n }\n }\n\n return {\n nextMaskedValue,\n maskedPos: Math.min(maskedPos, nextMaskedValue.length - suffix.length),\n };\n};\n\nconst NumberInputMask = ({\n focus,\n setFocus,\n setRawMask,\n cursorPosition,\n setCursorPosition,\n lastkey,\n setLastkey,\n setRawValue,\n allowDecimal,\n allowLeadingZeroes,\n allowNegative,\n autoFocus,\n className,\n clearable = false,\n decimalLimit,\n decimalSymbol,\n disabled,\n fluidWidth,\n hasError,\n includeThousandsSeparator,\n innerRef,\n integerLimit,\n leftComponent,\n maxLength,\n minLength,\n name,\n onBlur,\n onChange,\n onClick,\n onFocus,\n onKeyDown,\n onKeyUp,\n onPaste,\n placeholder,\n prefix,\n readOnly,\n requireDecimal,\n rightComponent,\n style,\n suffix,\n thousandsSeparatorSymbol,\n type,\n value,\n ...rest\n}) => {\n const inputRef = useRef();\n const [maskedValue, setMaskedValue] = useState(value);\n\n const conform = useCallback(\n ({\n rawValue,\n cursorPos,\n lastkeycode,\n shouldUpdateCursorPos = true,\n shouldCompleteDecimals = false,\n }) => {\n const { nextMaskedValue, maskedPos } = conformValue(\n rawValue,\n cursorPos,\n lastkeycode,\n {\n prefix,\n suffix,\n includeThousandsSeparator,\n thousandsSeparatorSymbol,\n allowDecimal,\n decimalSymbol,\n decimalLimit,\n requireDecimal,\n allowNegative,\n allowLeadingZeroes,\n integerLimit,\n shouldCompleteDecimals,\n },\n );\n const event = {\n target: {\n value: nextMaskedValue,\n originalValue: rawValue,\n },\n };\n if (onChange && nextMaskedValue !== maskedValue) onChange(event);\n\n setMaskedValue(nextMaskedValue);\n setRawValue(nextMaskedValue);\n\n if (shouldUpdateCursorPos) setCursorPosition({ current: maskedPos });\n },\n [maskedValue, onChange],\n );\n\n const handleOnChange = useCallback(\n (e) => {\n const { value: rawValue, selectionEnd } = e.target;\n setRawMask(rawValue);\n setRawValue(rawValue);\n setCursorPosition({ current: selectionEnd });\n setFocus(true);\n },\n [setRawMask, setRawValue, setCursorPosition, setFocus, lastkey.code],\n );\n\n useLayoutEffect(() => {\n if (focus) setCaretPosition(inputRef.current, cursorPosition.current);\n }, [focus, cursorPosition]);\n\n useLayoutEffect(() => {\n // if the value changes, then re-conform the mask\n conform({\n rawValue: value,\n cursorPos: cursorPosition.current,\n lastkeycode: lastkey.code,\n shouldUpdateCursorPos: focus,\n });\n }, [focus, value, cursorPosition.current]);\n\n const handleKeyDown = useCallback(\n (e) => {\n e.stopPropagation();\n setLastkey({ key: e.key, code: e.keyCode });\n onKeyDown(e);\n },\n [onKeyDown],\n );\n\n const handleBlur = useCallback(\n (e) => {\n setFocus(false);\n onBlur(e);\n if (requireDecimal && maskedValue !== '') {\n conform({\n rawValue: maskedValue,\n cursorPos: 0,\n lastkey: 0,\n shouldUpdateCursorPos: 0,\n shouldCompleteDecimals: true,\n });\n }\n },\n [maskedValue, requireDecimal, suffix, decimalLimit, onBlur],\n );\n\n return (\n <DSTextBox\n {...rest}\n className={className}\n clearable={clearable}\n disabled={disabled}\n fluidWidth={fluidWidth}\n hasError={hasError}\n innerRef={(ref) => {\n inputRef.current = ref;\n if (innerRef) innerRef(ref);\n }}\n isActive={focus}\n leftComponent={leftComponent}\n maxLength={maxLength}\n minLength={minLength}\n name={name}\n onBlur={handleBlur}\n onChange={handleOnChange}\n onClick={onClick}\n onFocus={onFocus}\n onKeyDown={handleKeyDown}\n onKeyUp={onKeyUp}\n onPaste={onPaste}\n placeholder={placeholder}\n readOnly={readOnly}\n rightComponent={rightComponent}\n style={style}\n type={type}\n value={maskedValue}\n />\n );\n};\n\nNumberInputMask.propTypes = {\n focus: PropTypes.bool,\n setFocus: PropTypes.func,\n setRawMask: PropTypes.func,\n cursorPosition: PropTypes.shape({ current: PropTypes.number }),\n setCursorPosition: PropTypes.func,\n lastkey: PropTypes.shape({ code: PropTypes.number, key: PropTypes.string }),\n setLastkey: PropTypes.func,\n setRawValue: PropTypes.func,\n allowDecimal: PropTypes.bool,\n allowLeadingZeroes: PropTypes.bool,\n allowNegative: PropTypes.bool,\n autoFocus: PropTypes.bool,\n className: PropTypes.string,\n clearable: PropTypes.bool,\n decimalLimit: PropTypes.number,\n decimalSymbol: PropTypes.string,\n disabled: PropTypes.bool,\n fluidWidth: PropTypes.bool,\n hasError: PropTypes.bool,\n includeThousandsSeparator: PropTypes.bool,\n innerRef: PropTypes.any,\n integerLimit: PropTypes.number,\n leftComponent: PropTypes.element,\n mask: PropTypes.any,\n maxLength: PropTypes.number,\n minLength: PropTypes.number,\n name: PropTypes.string,\n onBlur: PropTypes.func,\n onChange: PropTypes.func,\n onClick: PropTypes.func,\n onFocus: PropTypes.func,\n onKeyDown: PropTypes.func,\n onKeyUp: PropTypes.func,\n onPaste: PropTypes.func,\n placeholder: PropTypes.string,\n placeholderChar: PropTypes.string,\n prefix: PropTypes.string,\n readOnly: PropTypes.bool,\n requireDecimal: PropTypes.bool,\n rightComponent: PropTypes.element,\n style: PropTypes.object,\n suffix: PropTypes.string,\n thousandsSeparatorSymbol: PropTypes.string,\n type: PropTypes.string,\n value: PropTypes.string,\n};\n\nexport { NumberInputMask };\nexport default NumberInputMask;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADKvB,mBAAsE;AACtE,wBAA0B;AAC1B,qBAA0B;AAC1B,8BAAiC;AAGjC,MAAM,wBAAwB,CAAC,GAAG,6BAChC,EAAE,QAAQ,yBAAyB;AAErC,MAAM,eAAe,CACnB,cACA,eACA,aACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,MAEC;AACH,QAAM,cAAc,aAAa,QAAQ;AACzC,QAAM,cAAc,aAAa,YAAY;AAC7C,QAAM,gBAAgB,aAAa,QAAQ;AAE3C,QAAM,YACJ,gBAAiB,iBAAgB,KAAK,IAAI,cAAc,OAAO;AAEjE,QAAM,WAAW,aAAa,UAC5B,gBAAgB,KAAK,IAAI,cAAc,OAAO,QAC9C,gBAAgB,KAAK,aAAa,SAAS;AAG7C,QAAM,mBAAmB,SACtB,MAAM,IACN,OACC,CAAC,SACE,QAAQ,OAAO,QAAQ,OAAQ,SAAS,iBAAiB,SAAS;AAGzE,MAAI,aACF,iBACA,kBAAkB,MACjB,iBAAgB,MAAM,gBAAgB;AAEzC,MAAI,UAAU;AACd,MAAI,UAAU;AACd,MAAI,qBAAqB;AAEzB,QAAM,cAAc,MAClB,iBAAiB,QAAQ,QAAQ,SAAS;AAC5C,QAAM,cAAc,MAClB,iBAAiB,QAAQ,QAAQ,SAAS;AAE5C,mBAAiB,QAAQ,CAAC,SAAS;AACj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AAU;AAAA,EAChB,WAAW,4BAAU;AAAA,EACrB,WAAW,4BAAU;AAAA,EACrB,MAAM,4BAAU;AAAA,EAChB,QAAQ,4BAAU;AAAA,EAClB,UAAU,4BAAU;AAAA,EACpB,SAAS,4BAAU;AAAA,EACnB,SAAS,4BAAU;AAAA,EACnB,WAAW,4BAAU;AAAA,EACrB,SAAS,4BAAU;AAAA,EACnB,SAAS,4BAAU;AAAA,EACnB,aAAa,4BAAU;AAAA,EACvB,iBAAiB,4BAAU;AAAA,EAC3B,QAAQ,4BAAU;AAAA,EAClB,UAAU,4BAAU;AAAA,EACpB,gBAAgB,4BAAU;AAAA,EAC1B,gBAAgB,4BAAU;AAAA,EAC1B,OAAO,4BAAU;AAAA,EACjB,QAAQ,4BAAU;AAAA,EAClB,0BAA0B,4BAAU;AAAA,EACpC,MAAM,4BAAU;AAAA,EAChB,OAAO,4BAAU;AAAA;AAInB,IAAO,0BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,10 +1,39 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
7
24
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
8
37
|
var __export = (target, all) => {
|
|
9
38
|
for (var name in all)
|
|
10
39
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -70,40 +99,72 @@ const conformValue = (rawValue, cursorPos, lastkeycode) => {
|
|
|
70
99
|
}
|
|
71
100
|
return { nextMaskedValue: nextMaskedValue.join(""), maskedPos };
|
|
72
101
|
};
|
|
73
|
-
const PhoneInputMask = ({
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
102
|
+
const PhoneInputMask = (_a) => {
|
|
103
|
+
var _b = _a, {
|
|
104
|
+
focus,
|
|
105
|
+
setFocus,
|
|
106
|
+
setRawMask,
|
|
107
|
+
cursorPosition,
|
|
108
|
+
setCursorPosition,
|
|
109
|
+
lastkey,
|
|
110
|
+
setLastkey,
|
|
111
|
+
setRawValue,
|
|
112
|
+
style,
|
|
113
|
+
disabled,
|
|
114
|
+
className,
|
|
115
|
+
name,
|
|
116
|
+
maxLength,
|
|
117
|
+
minLength,
|
|
118
|
+
fluidWidth,
|
|
119
|
+
placeholder,
|
|
120
|
+
onKeyDown,
|
|
121
|
+
onClick,
|
|
122
|
+
onChange,
|
|
123
|
+
onFocus,
|
|
124
|
+
onBlur,
|
|
125
|
+
onPaste,
|
|
126
|
+
onKeyUp,
|
|
127
|
+
hasError,
|
|
128
|
+
readOnly,
|
|
129
|
+
type,
|
|
130
|
+
innerRef,
|
|
131
|
+
clearable = false,
|
|
132
|
+
leftComponent,
|
|
133
|
+
rightComponent,
|
|
134
|
+
value
|
|
135
|
+
} = _b, rest = __objRest(_b, [
|
|
136
|
+
"focus",
|
|
137
|
+
"setFocus",
|
|
138
|
+
"setRawMask",
|
|
139
|
+
"cursorPosition",
|
|
140
|
+
"setCursorPosition",
|
|
141
|
+
"lastkey",
|
|
142
|
+
"setLastkey",
|
|
143
|
+
"setRawValue",
|
|
144
|
+
"style",
|
|
145
|
+
"disabled",
|
|
146
|
+
"className",
|
|
147
|
+
"name",
|
|
148
|
+
"maxLength",
|
|
149
|
+
"minLength",
|
|
150
|
+
"fluidWidth",
|
|
151
|
+
"placeholder",
|
|
152
|
+
"onKeyDown",
|
|
153
|
+
"onClick",
|
|
154
|
+
"onChange",
|
|
155
|
+
"onFocus",
|
|
156
|
+
"onBlur",
|
|
157
|
+
"onPaste",
|
|
158
|
+
"onKeyUp",
|
|
159
|
+
"hasError",
|
|
160
|
+
"readOnly",
|
|
161
|
+
"type",
|
|
162
|
+
"innerRef",
|
|
163
|
+
"clearable",
|
|
164
|
+
"leftComponent",
|
|
165
|
+
"rightComponent",
|
|
166
|
+
"value"
|
|
167
|
+
]);
|
|
107
168
|
const inputRef = (0, import_react.useRef)();
|
|
108
169
|
const [maskedValue, setMaskedValue] = (0, import_react.useState)(value);
|
|
109
170
|
const conform = (0, import_react.useCallback)(({ rawValue, cursorPos, lastkeycode, shouldUpdateCursorPos = true }) => {
|
|
@@ -149,8 +210,7 @@ const PhoneInputMask = ({
|
|
|
149
210
|
setFocus(false);
|
|
150
211
|
onBlur(e);
|
|
151
212
|
}, [onBlur]);
|
|
152
|
-
return /* @__PURE__ */ import_react.default.createElement(import_TextBox.DSTextBox, {
|
|
153
|
-
...rest,
|
|
213
|
+
return /* @__PURE__ */ import_react.default.createElement(import_TextBox.DSTextBox, __spreadProps(__spreadValues({}, rest), {
|
|
154
214
|
className,
|
|
155
215
|
clearable,
|
|
156
216
|
disabled,
|
|
@@ -179,7 +239,7 @@ const PhoneInputMask = ({
|
|
|
179
239
|
style,
|
|
180
240
|
type,
|
|
181
241
|
value: maskedValue
|
|
182
|
-
});
|
|
242
|
+
}));
|
|
183
243
|
};
|
|
184
244
|
PhoneInputMask.propTypes = {
|
|
185
245
|
focus: import_react_desc.PropTypes.bool,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/InputMask/mask_types/PhoneInputMask.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport React, { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { PropTypes } from 'react-desc';\nimport { DSTextBox } from '../../TextBox';\nimport { TCharsToAdd } from '../types';\nimport { setCaretPosition } from '../utils/setCaretPosition';\n\nconst conformValue = (rawValue, cursorPos, lastkeycode) => {\n let nextMaskedValue = rawValue\n .split('')\n .filter((char) => char >= '0' && char <= '9');\n\n while (nextMaskedValue.length && nextMaskedValue[0] === '0')\n nextMaskedValue.splice(0, 1);\n\n nextMaskedValue = nextMaskedValue.slice(0, 10);\n\n let maskedPos = 0;\n for (let i = 0; i < cursorPos; i += 1) {\n if (nextMaskedValue[maskedPos] === rawValue[i]) maskedPos += 1;\n }\n\n // list of [string to add, position to add]\nconst charactersToAdd: TCharsToAdd = [\n ['(', 0],\n [') ', 4],\n ['-', 9],\n ];\n\n charactersToAdd.forEach(([chars, pos]) => {\n if (nextMaskedValue.length > pos) {\n nextMaskedValue.splice(pos, 0, ...chars);\n if (maskedPos >= pos) maskedPos += chars.length;\n }\n });\n\n if (lastkeycode !== 8 && maskedPos < nextMaskedValue.length) {\n charactersToAdd.forEach(([chars, pos]) => {\n if (maskedPos === pos) maskedPos += chars.length;\n });\n } else if (lastkeycode === 8 && maskedPos) {\n charactersToAdd.forEach(([chars, pos]) => {\n if (maskedPos === pos + 1) maskedPos -= chars.length;\n });\n }\n return { nextMaskedValue: nextMaskedValue.join(''), maskedPos };\n};\n\nconst PhoneInputMask = ({\n focus,\n setFocus,\n setRawMask,\n cursorPosition,\n setCursorPosition,\n lastkey,\n setLastkey,\n setRawValue,\n style,\n disabled,\n className,\n name,\n maxLength,\n minLength,\n fluidWidth,\n placeholder,\n onKeyDown,\n onClick,\n onChange,\n onFocus,\n onBlur,\n onPaste,\n onKeyUp,\n hasError,\n readOnly,\n type,\n innerRef,\n clearable = false,\n leftComponent,\n rightComponent,\n value,\n ...rest\n}) => {\n const inputRef = useRef();\n const [maskedValue, setMaskedValue] = useState(value);\n\n const conform = useCallback(\n ({ rawValue, cursorPos, lastkeycode, shouldUpdateCursorPos = true }) => {\n const { nextMaskedValue, maskedPos } = conformValue(\n rawValue,\n cursorPos,\n lastkeycode,\n );\n const event = {\n target: {\n value: nextMaskedValue,\n originalValue: rawValue,\n },\n };\n if (onChange && nextMaskedValue !== maskedValue) onChange(event);\n\n setMaskedValue(nextMaskedValue);\n setRawValue(nextMaskedValue);\n\n if (shouldUpdateCursorPos) setCursorPosition({ current: maskedPos });\n },\n [maskedValue, onChange],\n );\n\n const handleOnChange = useCallback(\n (e) => {\n const { value: rawValue, selectionEnd } = e.target;\n setRawMask(rawValue);\n setRawValue(rawValue);\n setCursorPosition({ current: selectionEnd });\n setFocus(true);\n },\n [setRawMask, setRawValue, setCursorPosition, setFocus, lastkey.code],\n );\n\n useLayoutEffect(() => {\n if (focus) setCaretPosition(inputRef.current, cursorPosition.current);\n }, [focus, cursorPosition]);\n\n useLayoutEffect(() => {\n // if the value changes, then re-conform the mask\n conform({\n rawValue: value,\n cursorPos: cursorPosition.current,\n lastkeycode: lastkey.code,\n shouldUpdateCursorPos: focus,\n });\n }, [focus, value, cursorPosition.current]);\n\n const handleKeyDown = useCallback(\n (e) => {\n e.stopPropagation();\n setLastkey({ key: e.key, code: e.keyCode });\n onKeyDown(e);\n },\n [onKeyDown],\n );\n\n const handleBlur = useCallback(\n (e) => {\n setFocus(false);\n onBlur(e);\n },\n [onBlur],\n );\n\n return (\n <DSTextBox\n {...rest}\n className={className}\n clearable={clearable}\n disabled={disabled}\n fluidWidth={fluidWidth}\n hasError={hasError}\n innerRef={(ref) => {\n inputRef.current = ref;\n if (innerRef) innerRef(ref);\n }}\n isActive={focus}\n leftComponent={leftComponent}\n maxLength={maxLength}\n minLength={minLength}\n name={name}\n onBlur={handleBlur}\n onChange={handleOnChange}\n onClick={onClick}\n onFocus={onFocus}\n onKeyDown={handleKeyDown}\n onKeyUp={onKeyUp}\n onPaste={onPaste}\n placeholder={placeholder}\n readOnly={readOnly}\n rightComponent={rightComponent}\n style={style}\n type={type}\n value={maskedValue}\n />\n );\n};\n\nPhoneInputMask.propTypes = {\n focus: PropTypes.bool,\n setFocus: PropTypes.func,\n setRawMask: PropTypes.func,\n cursorPosition: PropTypes.shape({ current: PropTypes.number }),\n setCursorPosition: PropTypes.func,\n lastkey: PropTypes.shape({ code: PropTypes.number, key: PropTypes.string }),\n setLastkey: PropTypes.func,\n setRawValue: PropTypes.func,\n style: PropTypes.object,\n disabled: PropTypes.bool,\n className: PropTypes.string,\n name: PropTypes.string,\n maxLength: PropTypes.number,\n minLength: PropTypes.number,\n fluidWidth: PropTypes.bool,\n placeholder: PropTypes.string,\n value: PropTypes.string,\n onChange: PropTypes.func,\n onKeyDown: PropTypes.func,\n leftComponent: PropTypes.element,\n rightComponent: PropTypes.element,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n onPaste: PropTypes.func,\n onKeyUp: PropTypes.func,\n hasError: PropTypes.bool,\n readOnly: PropTypes.bool,\n onClick: PropTypes.func,\n clearable: PropTypes.bool,\n type: PropTypes.string,\n innerRef: PropTypes.any,\n mask: PropTypes.any,\n placeholderChar: PropTypes.string,\n};\n\nexport { PhoneInputMask };\nexport default PhoneInputMask;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAsE;AACtE,wBAA0B;AAC1B,qBAA0B;AAE1B,8BAAiC;AAEjC,MAAM,eAAe,CAAC,UAAU,WAAW,gBAAgB;AACzD,MAAI,kBAAkB,SACnB,MAAM,IACN,OAAO,CAAC,SAAS,QAAQ,OAAO,QAAQ;AAE3C,SAAO,gBAAgB,UAAU,gBAAgB,OAAO;AACtD,oBAAgB,OAAO,GAAG;AAE5B,oBAAkB,gBAAgB,MAAM,GAAG;AAE3C,MAAI,YAAY;AAChB,WAAS,IAAI,GAAG,IAAI,WAAW,KAAK,GAAG;AACrC,QAAI,gBAAgB,eAAe,SAAS;AAAI,mBAAa;AAAA;AAIjE,QAAM,kBAA+B;AAAA,IACjC,CAAC,KAAK;AAAA,IACN,CAAC,MAAM;AAAA,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;AAI7B,IAAO,yBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,10 +1,39 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
7
24
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
8
37
|
var __export = (target, all) => {
|
|
9
38
|
for (var name in all)
|
|
10
39
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -70,40 +99,72 @@ const conformValue = (rawValue, cursorPos, lastkeycode) => {
|
|
|
70
99
|
}
|
|
71
100
|
return { nextMaskedValue: nextMaskedValue.join(""), maskedPos };
|
|
72
101
|
};
|
|
73
|
-
const PhoneInternationalInputMask = ({
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
102
|
+
const PhoneInternationalInputMask = (_a) => {
|
|
103
|
+
var _b = _a, {
|
|
104
|
+
focus,
|
|
105
|
+
setFocus,
|
|
106
|
+
setRawMask,
|
|
107
|
+
cursorPosition,
|
|
108
|
+
setCursorPosition,
|
|
109
|
+
lastkey,
|
|
110
|
+
setLastkey,
|
|
111
|
+
setRawValue,
|
|
112
|
+
style,
|
|
113
|
+
disabled,
|
|
114
|
+
className,
|
|
115
|
+
name,
|
|
116
|
+
maxLength,
|
|
117
|
+
minLength,
|
|
118
|
+
fluidWidth,
|
|
119
|
+
placeholder,
|
|
120
|
+
onKeyDown,
|
|
121
|
+
onClick,
|
|
122
|
+
onChange,
|
|
123
|
+
onFocus,
|
|
124
|
+
onBlur,
|
|
125
|
+
onPaste,
|
|
126
|
+
onKeyUp,
|
|
127
|
+
hasError,
|
|
128
|
+
readOnly,
|
|
129
|
+
type,
|
|
130
|
+
innerRef,
|
|
131
|
+
clearable = false,
|
|
132
|
+
leftComponent,
|
|
133
|
+
rightComponent,
|
|
134
|
+
value
|
|
135
|
+
} = _b, rest = __objRest(_b, [
|
|
136
|
+
"focus",
|
|
137
|
+
"setFocus",
|
|
138
|
+
"setRawMask",
|
|
139
|
+
"cursorPosition",
|
|
140
|
+
"setCursorPosition",
|
|
141
|
+
"lastkey",
|
|
142
|
+
"setLastkey",
|
|
143
|
+
"setRawValue",
|
|
144
|
+
"style",
|
|
145
|
+
"disabled",
|
|
146
|
+
"className",
|
|
147
|
+
"name",
|
|
148
|
+
"maxLength",
|
|
149
|
+
"minLength",
|
|
150
|
+
"fluidWidth",
|
|
151
|
+
"placeholder",
|
|
152
|
+
"onKeyDown",
|
|
153
|
+
"onClick",
|
|
154
|
+
"onChange",
|
|
155
|
+
"onFocus",
|
|
156
|
+
"onBlur",
|
|
157
|
+
"onPaste",
|
|
158
|
+
"onKeyUp",
|
|
159
|
+
"hasError",
|
|
160
|
+
"readOnly",
|
|
161
|
+
"type",
|
|
162
|
+
"innerRef",
|
|
163
|
+
"clearable",
|
|
164
|
+
"leftComponent",
|
|
165
|
+
"rightComponent",
|
|
166
|
+
"value"
|
|
167
|
+
]);
|
|
107
168
|
const inputRef = (0, import_react.useRef)();
|
|
108
169
|
const [maskedValue, setMaskedValue] = (0, import_react.useState)(value);
|
|
109
170
|
const conform = (0, import_react.useCallback)(({ rawValue, cursorPos, lastkeycode, shouldUpdateCursorPos = true }) => {
|
|
@@ -149,8 +210,7 @@ const PhoneInternationalInputMask = ({
|
|
|
149
210
|
setFocus(false);
|
|
150
211
|
onBlur(e);
|
|
151
212
|
}, [onBlur]);
|
|
152
|
-
return /* @__PURE__ */ import_react.default.createElement(import_TextBox.DSTextBox, {
|
|
153
|
-
...rest,
|
|
213
|
+
return /* @__PURE__ */ import_react.default.createElement(import_TextBox.DSTextBox, __spreadProps(__spreadValues({}, rest), {
|
|
154
214
|
className,
|
|
155
215
|
clearable,
|
|
156
216
|
disabled,
|
|
@@ -179,7 +239,7 @@ const PhoneInternationalInputMask = ({
|
|
|
179
239
|
style,
|
|
180
240
|
type,
|
|
181
241
|
value: maskedValue
|
|
182
|
-
});
|
|
242
|
+
}));
|
|
183
243
|
};
|
|
184
244
|
PhoneInternationalInputMask.propTypes = {
|
|
185
245
|
focus: import_react_desc.PropTypes.bool,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/InputMask/mask_types/PhoneInternationalInputMask.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport React, { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { PropTypes } from 'react-desc';\nimport { DSTextBox } from '../../TextBox';\nimport { TCharsToAdd } from '../types';\nimport { setCaretPosition } from '../utils/setCaretPosition';\n\nconst conformValue = (rawValue, cursorPos, lastkeycode) => {\n let nextMaskedValue = rawValue\n .split('+1')\n .slice(-1)[0]\n .split('')\n .filter((char) => char >= '0' && char <= '9');\n\n while (nextMaskedValue.length && nextMaskedValue[0] === '0')\n nextMaskedValue.splice(0, 1);\n\n nextMaskedValue = nextMaskedValue.slice(0, 10);\n\n let maskedPos = 0;\n for (let i = 0; i < cursorPos; i += 1) {\n if (nextMaskedValue[maskedPos] === rawValue[i]) maskedPos += 1;\n }\n\n // list of [string to add, position to add]\nconst charactersToAdd: TCharsToAdd = [\n ['+1 (', 0],\n [') ', 7],\n ['-', 12],\n ];\n\n charactersToAdd.forEach(([chars, pos]) => {\n if (nextMaskedValue.length > pos) {\n nextMaskedValue.splice(pos, 0, ...chars);\n if (maskedPos >= pos) maskedPos += chars.length;\n }\n });\n\n if (lastkeycode !== 8 && maskedPos < nextMaskedValue.length) {\n charactersToAdd.forEach(([chars, pos]) => {\n if (maskedPos === pos) maskedPos += chars.length;\n });\n } else if (lastkeycode === 8 && maskedPos) {\n charactersToAdd.forEach(([chars, pos]) => {\n if (maskedPos === pos + 1) maskedPos -= chars.length;\n });\n }\n return { nextMaskedValue: nextMaskedValue.join(''), maskedPos };\n};\n\nconst PhoneInternationalInputMask = ({\n focus,\n setFocus,\n setRawMask,\n cursorPosition,\n setCursorPosition,\n lastkey,\n setLastkey,\n setRawValue,\n style,\n disabled,\n className,\n name,\n maxLength,\n minLength,\n fluidWidth,\n placeholder,\n onKeyDown,\n onClick,\n onChange,\n onFocus,\n onBlur,\n onPaste,\n onKeyUp,\n hasError,\n readOnly,\n type,\n innerRef,\n clearable = false,\n leftComponent,\n rightComponent,\n value,\n ...rest\n}) => {\n const inputRef = useRef();\n const [maskedValue, setMaskedValue] = useState(value);\n\n const conform = useCallback(\n ({ rawValue, cursorPos, lastkeycode, shouldUpdateCursorPos = true }) => {\n const { nextMaskedValue, maskedPos } = conformValue(\n rawValue,\n cursorPos,\n lastkeycode,\n );\n const event = {\n target: {\n value: nextMaskedValue,\n originalValue: rawValue,\n },\n };\n if (onChange && nextMaskedValue !== maskedValue) onChange(event);\n\n setMaskedValue(nextMaskedValue);\n setRawValue(nextMaskedValue);\n\n if (shouldUpdateCursorPos) setCursorPosition({ current: maskedPos });\n },\n [maskedValue, onChange],\n );\n\n const handleOnChange = useCallback(\n (e) => {\n const { value: rawValue, selectionEnd } = e.target;\n setRawMask(rawValue);\n setRawValue(rawValue);\n setCursorPosition({ current: selectionEnd });\n setFocus(true);\n },\n [setRawMask, setRawValue, setCursorPosition, setFocus, lastkey.code],\n );\n\n useLayoutEffect(() => {\n if (focus) setCaretPosition(inputRef.current, cursorPosition.current);\n }, [focus, cursorPosition]);\n\n useLayoutEffect(() => {\n // if the value changes, then re-conform the mask\n conform({\n rawValue: value,\n cursorPos: cursorPosition.current,\n lastkeycode: lastkey.code,\n shouldUpdateCursorPos: focus,\n });\n }, [focus, value, cursorPosition.current]);\n\n const handleKeyDown = useCallback(\n (e) => {\n e.stopPropagation();\n setLastkey({ key: e.key, code: e.keyCode });\n onKeyDown(e);\n },\n [onKeyDown],\n );\n\n const handleBlur = useCallback(\n (e) => {\n setFocus(false);\n onBlur(e);\n },\n [onBlur],\n );\n\n return (\n <DSTextBox\n {...rest}\n className={className}\n clearable={clearable}\n disabled={disabled}\n fluidWidth={fluidWidth}\n hasError={hasError}\n innerRef={(ref) => {\n inputRef.current = ref;\n if (innerRef) innerRef(ref);\n }}\n isActive={focus}\n leftComponent={leftComponent}\n maxLength={maxLength}\n minLength={minLength}\n name={name}\n onBlur={handleBlur}\n onChange={handleOnChange}\n onClick={onClick}\n onFocus={onFocus}\n onKeyDown={handleKeyDown}\n onKeyUp={onKeyUp}\n onPaste={onPaste}\n placeholder={placeholder}\n readOnly={readOnly}\n rightComponent={rightComponent}\n style={style}\n type={type}\n value={maskedValue}\n />\n );\n};\n\nPhoneInternationalInputMask.propTypes = {\n focus: PropTypes.bool,\n setFocus: PropTypes.func,\n setRawMask: PropTypes.func,\n cursorPosition: PropTypes.shape({ current: PropTypes.number }),\n setCursorPosition: PropTypes.func,\n lastkey: PropTypes.shape({ code: PropTypes.number, key: PropTypes.string }),\n setLastkey: PropTypes.func,\n setRawValue: PropTypes.func,\n style: PropTypes.object,\n disabled: PropTypes.bool,\n className: PropTypes.string,\n name: PropTypes.string,\n maxLength: PropTypes.number,\n minLength: PropTypes.number,\n fluidWidth: PropTypes.bool,\n placeholder: PropTypes.string,\n value: PropTypes.string,\n onChange: PropTypes.func,\n onKeyDown: PropTypes.func,\n leftComponent: PropTypes.element,\n rightComponent: PropTypes.element,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n onPaste: PropTypes.func,\n onKeyUp: PropTypes.func,\n hasError: PropTypes.bool,\n readOnly: PropTypes.bool,\n onClick: PropTypes.func,\n clearable: PropTypes.bool,\n type: PropTypes.string,\n innerRef: PropTypes.any,\n mask: PropTypes.any,\n placeholderChar: PropTypes.string,\n};\n\nexport { PhoneInternationalInputMask };\nexport default PhoneInternationalInputMask;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAsE;AACtE,wBAA0B;AAC1B,qBAA0B;AAE1B,8BAAiC;AAEjC,MAAM,eAAe,CAAC,UAAU,WAAW,gBAAgB;AACzD,MAAI,kBAAkB,SACnB,MAAM,MACN,MAAM,IAAI,GACV,MAAM,IACN,OAAO,CAAC,SAAS,QAAQ,OAAO,QAAQ;AAE3C,SAAO,gBAAgB,UAAU,gBAAgB,OAAO;AACtD,oBAAgB,OAAO,GAAG;AAE5B,oBAAkB,gBAAgB,MAAM,GAAG;AAE3C,MAAI,YAAY;AAChB,WAAS,IAAI,GAAG,IAAI,WAAW,KAAK,GAAG;AACrC,QAAI,gBAAgB,eAAe,SAAS;AAAI,mBAAa;AAAA;AAIjE,QAAM,kBAA+B;AAAA,IACjC,CAAC,QAAQ;AAAA,IACT,CAAC,MAAM;AAAA,IACP,CAAC,KAAK;AAAA;AAGR,kBAAgB,QAAQ,CAAC,CAAC,OAAO,SAAS;AACxC,QAAI,gBAAgB,SAAS,KAAK;AAChC,sBAAgB,OAAO,KAAK,GAAG,GAAG;AAClC,UAAI,aAAa;AAAK,qBAAa,MAAM;AAAA;AAAA;AAI7C,MAAI,gBAAgB,KAAK,YAAY,gBAAgB,QAAQ;AAC3D,oBAAgB,QAAQ,CAAC,CAAC,OAAO,SAAS;AACxC,UAAI,cAAc;AAAK,qBAAa,MAAM;AAAA;AAAA,aAEnC,gBAAgB,KAAK,WAAW;AACzC,oBAAgB,QAAQ,CAAC,CAAC,OAAO,SAAS;AACxC,UAAI,cAAc,MAAM;AAAG,qBAAa,MAAM;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