@invoicebox/ui 0.1.0-alpha.291 → 0.1.0-alpha.294
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/components/common/Arrow/palette.js +1 -1
- package/dist/components/common/Calendar/palette.js +1 -1
- package/dist/components/common/Drawer/palette.js +1 -1
- package/dist/components/common/Dropdown/palette.js +1 -1
- package/dist/components/common/EntityAutocompleteOptionsDrawer/index.js +6 -2
- package/dist/components/common/EntityAutocompleteOptionsDrawer/palette.js +1 -1
- package/dist/components/common/PointsLoader/palette.js +1 -1
- package/dist/components/common/Scrollbar/index.js +12 -32
- package/dist/components/common/Scrollbar/styles.d.ts +7 -0
- package/dist/components/common/Scrollbar/styles.js +30 -0
- package/dist/components/common/Toast/styles.js +1 -1
- package/dist/components/form/Autocomplete/components/Autocomplete/index.d.ts +1 -0
- package/dist/components/form/Autocomplete/components/Autocomplete/index.js +89 -7
- package/dist/components/form/Autocomplete/components/Autocomplete/styles.d.ts +1 -0
- package/dist/components/form/Autocomplete/components/Autocomplete/styles.js +8 -4
- package/dist/components/form/Autocomplete/components/AutocompleteDefaultOption/palette.js +1 -1
- package/dist/components/form/Autocomplete/components/OrganizationAutocompleteItem/palette.js +1 -1
- package/dist/components/form/CodeInput/palette.js +1 -1
- package/dist/components/form/CountrySelect/palette.js +1 -1
- package/dist/components/form/DateTimeInput/components/TimePicker/palette.js +1 -1
- package/dist/components/form/DateTimeInput/palette.js +1 -1
- package/dist/components/form/PureInput/palette.js +1 -1
- package/dist/components/form/Select/palette.js +1 -1
- package/dist/components/form/TextInput/index.d.ts +2 -2
- package/dist/components/form/TextInput/index.js +4 -2
- package/dist/components/form/Toggle/palette.js +1 -1
- package/dist/components/form/common/DrawerHeader/palette.js +1 -1
- package/dist/esm/breakpoints/index.js +7 -0
- package/dist/esm/components/_helpers/StoryBorderWrapper/index.js +5 -0
- package/dist/esm/components/_helpers/selectOptions.js +37 -0
- package/dist/esm/components/common/AppCardLink/components/ApkRu.js +99 -0
- package/dist/esm/components/common/AppCardLink/components/AppGalleryRu.js +91 -0
- package/dist/esm/components/common/AppCardLink/components/GooglePlayRu.js +177 -0
- package/dist/esm/components/common/AppCardLink/components/RuStoreRu.js +94 -0
- package/dist/esm/components/common/AppCardLink/constants.js +1 -0
- package/dist/esm/components/common/AppCardLink/index.js +24 -0
- package/dist/esm/components/common/AppCardLink/index.stories.js +14 -0
- package/dist/esm/components/common/AppCardLink/styles.js +5 -0
- package/dist/esm/components/common/Arrow/components/StyledSvg/index.js +18 -0
- package/dist/esm/components/common/Arrow/components/StyledSvg/index.stories.js +20 -0
- package/dist/esm/components/common/Arrow/components/Svg/index.js +19 -0
- package/dist/esm/components/common/Arrow/components/Svg/index.stories.js +15 -0
- package/dist/esm/components/common/Arrow/index.js +22 -0
- package/dist/esm/components/common/Arrow/index.stories.js +15 -0
- package/dist/esm/components/common/Arrow/palette.js +7 -0
- package/dist/esm/components/common/BgCard/index.js +13 -0
- package/dist/esm/components/common/BgCard/index.stories.js +14 -0
- package/dist/esm/components/common/BgCard/palette.js +5 -0
- package/dist/esm/components/common/BgCard/styles.js +12 -0
- package/dist/esm/components/common/Calendar/docs.stories.js +14 -0
- package/dist/esm/components/common/Calendar/index.js +44 -0
- package/dist/esm/components/common/Calendar/index.stories.js +69 -0
- package/dist/esm/components/common/Calendar/palette.js +12 -0
- package/dist/esm/components/common/Calendar/styles.js +34 -0
- package/dist/esm/components/common/Chip/index.js +17 -0
- package/dist/esm/components/common/Chip/index.stories.js +14 -0
- package/dist/esm/components/common/Chip/styles.js +18 -0
- package/dist/esm/components/common/Divider/index.js +13 -0
- package/dist/esm/components/common/Divider/index.stories.js +8 -0
- package/dist/esm/components/common/Divider/palette.js +5 -0
- package/dist/esm/components/common/Divider/styles.js +11 -0
- package/dist/esm/components/common/Drawer/index.js +65 -0
- package/dist/esm/components/common/Drawer/index.stories.js +77 -0
- package/dist/esm/components/common/Drawer/palette.js +14 -0
- package/dist/esm/components/common/Drawer/styles.js +45 -0
- package/dist/esm/components/common/Dropdown/index.js +113 -0
- package/dist/esm/components/common/Dropdown/index.stories.js +53 -0
- package/dist/esm/components/common/Dropdown/palette.js +7 -0
- package/dist/esm/components/common/Dropdown/styles.js +44 -0
- package/dist/esm/components/common/EntityAutocompleteOptionsDrawer/index.js +59 -0
- package/dist/esm/components/common/EntityAutocompleteOptionsDrawer/index.stories.js +92 -0
- package/dist/esm/components/common/EntityAutocompleteOptionsDrawer/palette.js +6 -0
- package/dist/esm/components/common/EntityAutocompleteOptionsDrawer/styles.js +29 -0
- package/dist/esm/components/common/Flag/components/ArmFlag/index.js +23 -0
- package/dist/esm/components/common/Flag/components/ArmFlag/index.stories.js +8 -0
- package/dist/esm/components/common/Flag/components/AzeFlag/index.js +33 -0
- package/dist/esm/components/common/Flag/components/AzeFlag/index.stories.js +8 -0
- package/dist/esm/components/common/Flag/components/BlrFlag/index.js +28 -0
- package/dist/esm/components/common/Flag/components/BlrFlag/index.stories.js +8 -0
- package/dist/esm/components/common/Flag/components/ChnFlag/index.js +25 -0
- package/dist/esm/components/common/Flag/components/ChnFlag/index.stories.js +8 -0
- package/dist/esm/components/common/Flag/components/EngFlag/index.js +47 -0
- package/dist/esm/components/common/Flag/components/EngFlag/index.stories.js +8 -0
- package/dist/esm/components/common/Flag/components/EspFlag/index.js +79 -0
- package/dist/esm/components/common/Flag/components/EspFlag/index.stories.js +8 -0
- package/dist/esm/components/common/Flag/components/KazFlag/index.js +28 -0
- package/dist/esm/components/common/Flag/components/KazFlag/index.stories.js +8 -0
- package/dist/esm/components/common/Flag/components/KgzFlag/index.js +25 -0
- package/dist/esm/components/common/Flag/components/KgzFlag/index.stories.js +8 -0
- package/dist/esm/components/common/Flag/components/MdaFlag/index.js +45 -0
- package/dist/esm/components/common/Flag/components/MdaFlag/index.stories.js +8 -0
- package/dist/esm/components/common/Flag/components/RusFlag/index.js +25 -0
- package/dist/esm/components/common/Flag/components/RusFlag/index.stories.js +8 -0
- package/dist/esm/components/common/Flag/components/TjkFlag/index.js +30 -0
- package/dist/esm/components/common/Flag/components/TjkFlag/index.stories.js +8 -0
- package/dist/esm/components/common/Flag/components/UnknownFlag/index.js +19 -0
- package/dist/esm/components/common/Flag/components/UnknownFlag/index.stories.js +8 -0
- package/dist/esm/components/common/Flag/components/UzbFlag/index.js +36 -0
- package/dist/esm/components/common/Flag/components/UzbFlag/index.stories.js +8 -0
- package/dist/esm/components/common/Flag/index.js +39 -0
- package/dist/esm/components/common/Flag/index.stories.js +16 -0
- package/dist/esm/components/common/Flag/styles.js +10 -0
- package/dist/esm/components/common/InvoiceboxLogo/components/LogoDarkRu.js +44 -0
- package/dist/esm/components/common/InvoiceboxLogo/index.js +8 -0
- package/dist/esm/components/common/InvoiceboxLogo/index.stories.js +12 -0
- package/dist/esm/components/common/InvoiceboxSpinner/index.js +29 -0
- package/dist/esm/components/common/InvoiceboxSpinner/index.stories.js +12 -0
- package/dist/esm/components/common/InvoiceboxSpinner/palette.js +6 -0
- package/dist/esm/components/common/InvoiceboxSpinner/styles.js +10 -0
- package/dist/esm/components/common/PointsLoader/index.js +16 -0
- package/dist/esm/components/common/PointsLoader/index.stories.js +10 -0
- package/dist/esm/components/common/PointsLoader/palette.js +7 -0
- package/dist/esm/components/common/PointsLoader/styles.js +21 -0
- package/dist/esm/components/common/QRCode/index.js +26 -0
- package/dist/esm/components/common/QRCode/index.stories.js +13 -0
- package/dist/esm/components/common/ReadOnlyLabelValueField/index.js +24 -0
- package/dist/esm/components/common/ReadOnlyLabelValueField/index.stories.js +14 -0
- package/dist/esm/components/common/ReadOnlyLabelValueField/palette.js +5 -0
- package/dist/esm/components/common/ReadOnlyLabelValueField/styles.js +15 -0
- package/dist/esm/components/common/Scrollbar/index.js +22 -0
- package/dist/esm/components/common/Scrollbar/index.stories.js +43 -0
- package/dist/esm/components/common/Scrollbar/palette.js +5 -0
- package/dist/esm/components/common/Scrollbar/styles.js +21 -0
- package/dist/esm/components/common/SecondaryButton/index.js +44 -0
- package/dist/esm/components/common/SecondaryButton/index.stories.js +33 -0
- package/dist/esm/components/common/SecondaryButton/palette.js +8 -0
- package/dist/esm/components/common/SecondaryButton/styles.js +43 -0
- package/dist/esm/components/common/Skeleton/index.js +18 -0
- package/dist/esm/components/common/Skeleton/index.stories.js +24 -0
- package/dist/esm/components/common/Skeleton/palette.js +6 -0
- package/dist/esm/components/common/Skeleton/styles.js +28 -0
- package/dist/esm/components/common/Toast/docs.stories.js +14 -0
- package/dist/esm/components/common/Toast/index.js +29 -0
- package/dist/esm/components/common/Toast/index.stories.js +22 -0
- package/dist/esm/components/common/Toast/palette.js +7 -0
- package/dist/esm/components/common/Toast/styles.js +17 -0
- package/dist/esm/components/common/Typography/docs.stories.js +14 -0
- package/dist/esm/components/common/Typography/index.js +30 -0
- package/dist/esm/components/common/Typography/index.stories.js +29 -0
- package/dist/esm/components/common/Typography/styles.js +9 -0
- package/dist/esm/components/common/Typography/typography.js +25 -0
- package/dist/esm/components/common/WarningIcon/components/Icon.js +15 -0
- package/dist/esm/components/common/WarningIcon/index.js +13 -0
- package/dist/esm/components/common/WarningIcon/index.stories.js +8 -0
- package/dist/esm/components/common/WarningIcon/palette.js +5 -0
- package/dist/esm/components/common/WarningIcon/styles.js +15 -0
- package/dist/esm/components/common/_helpers/selectOptions.js +39 -0
- package/dist/esm/components/form/Autocomplete/components/Autocomplete/index.js +264 -0
- package/dist/esm/components/form/Autocomplete/components/Autocomplete/index.stories.js +55 -0
- package/dist/esm/components/form/Autocomplete/components/Autocomplete/styles.js +42 -0
- package/dist/esm/components/form/Autocomplete/components/AutocompleteDefaultOption/index.js +21 -0
- package/dist/esm/components/form/Autocomplete/components/AutocompleteDefaultOption/index.stories.js +17 -0
- package/dist/esm/components/form/Autocomplete/components/AutocompleteDefaultOption/palette.js +6 -0
- package/dist/esm/components/form/Autocomplete/components/OrganizationAutocompleteItem/index.js +40 -0
- package/dist/esm/components/form/Autocomplete/components/OrganizationAutocompleteItem/index.stories.js +20 -0
- package/dist/esm/components/form/Autocomplete/components/OrganizationAutocompleteItem/palette.js +9 -0
- package/dist/esm/components/form/Autocomplete/components/OrganizationAutocompleteItem/styles.js +58 -0
- package/dist/esm/components/form/Autocomplete/index.js +3 -0
- package/dist/esm/components/form/CodeInput/index.js +93 -0
- package/dist/esm/components/form/CodeInput/index.stories.js +43 -0
- package/dist/esm/components/form/CodeInput/palette.js +7 -0
- package/dist/esm/components/form/CodeInput/styles.js +24 -0
- package/dist/esm/components/form/CountrySelect/components/CountryItem/index.js +32 -0
- package/dist/esm/components/form/CountrySelect/components/CountryItem/index.stories.js +29 -0
- package/dist/esm/components/form/CountrySelect/components/CountryItem/stlyes.js +24 -0
- package/dist/esm/components/form/CountrySelect/index.js +113 -0
- package/dist/esm/components/form/CountrySelect/index.stories.js +51 -0
- package/dist/esm/components/form/CountrySelect/logic.js +18 -0
- package/dist/esm/components/form/CountrySelect/palette.js +10 -0
- package/dist/esm/components/form/CountrySelect/stlyes.js +20 -0
- package/dist/esm/components/form/CurrencyInput/CoreCurrencyInput/index.js +95 -0
- package/dist/esm/components/form/CurrencyInput/CoreCurrencyInput/index.stories.js +33 -0
- package/dist/esm/components/form/CurrencyInput/CoreCurrencyInput/styles.js +8 -0
- package/dist/esm/components/form/CurrencyInput/CurrencyInputNumber/index.js +16 -0
- package/dist/esm/components/form/CurrencyInput/CurrencyInputNumber/index.stories.js +46 -0
- package/dist/esm/components/form/CurrencyInput/CurrencyInputString/index.js +16 -0
- package/dist/esm/components/form/CurrencyInput/CurrencyInputString/index.stories.js +32 -0
- package/dist/esm/components/form/CurrencyInput/README.md +24 -0
- package/dist/esm/components/form/DateInput/components/CalendarIcon/index.js +24 -0
- package/dist/esm/components/form/DateInput/components/CalendarIcon/index.stories.js +8 -0
- package/dist/esm/components/form/DateInput/components/MobileDrawerDateCalendar/index.js +27 -0
- package/dist/esm/components/form/DateInput/components/MobileDrawerDateCalendar/index.stories.js +65 -0
- package/dist/esm/components/form/DateInput/components/MobileDrawerDateCalendar/styles.js +5 -0
- package/dist/esm/components/form/DateInput/docs.stories.js +14 -0
- package/dist/esm/components/form/DateInput/index.js +171 -0
- package/dist/esm/components/form/DateInput/index.stories.js +48 -0
- package/dist/esm/components/form/DateInput/logic.js +89 -0
- package/dist/esm/components/form/DateInput/palette.js +5 -0
- package/dist/esm/components/form/DateInput/styles.js +21 -0
- package/dist/esm/components/form/DateTimeInput/components/MobileDrawerDateTimeCalendar/index.js +66 -0
- package/dist/esm/components/form/DateTimeInput/components/MobileDrawerDateTimeCalendar/index.stories.js +63 -0
- package/dist/esm/components/form/DateTimeInput/components/MobileDrawerDateTimeCalendar/styles.js +9 -0
- package/dist/esm/components/form/DateTimeInput/components/MobileNumbersColumn/index.js +193 -0
- package/dist/esm/components/form/DateTimeInput/components/MobileNumbersColumn/styles.js +18 -0
- package/dist/esm/components/form/DateTimeInput/components/TimePicker/index.js +132 -0
- package/dist/esm/components/form/DateTimeInput/components/TimePicker/index.stories.js +32 -0
- package/dist/esm/components/form/DateTimeInput/components/TimePicker/palette.js +11 -0
- package/dist/esm/components/form/DateTimeInput/components/TimePicker/styles.js +54 -0
- package/dist/esm/components/form/DateTimeInput/hooks/useStringValue.js +22 -0
- package/dist/esm/components/form/DateTimeInput/hooks/useTimePickerHeight.js +31 -0
- package/dist/esm/components/form/DateTimeInput/index.js +232 -0
- package/dist/esm/components/form/DateTimeInput/index.stories.js +52 -0
- package/dist/esm/components/form/DateTimeInput/palette.js +11 -0
- package/dist/esm/components/form/DateTimeInput/styles.js +51 -0
- package/dist/esm/components/form/InputLabel/index.js +33 -0
- package/dist/esm/components/form/InputLabel/index.stories.js +26 -0
- package/dist/esm/components/form/InputLabel/palette.js +9 -0
- package/dist/esm/components/form/InputLabel/styles.js +42 -0
- package/dist/esm/components/form/ModernPlaceholder/index.js +25 -0
- package/dist/esm/components/form/ModernPlaceholder/styles.js +28 -0
- package/dist/esm/components/form/PhoneInput/constants.js +69 -0
- package/dist/esm/components/form/PhoneInput/externalPhoneLogic.js +32 -0
- package/dist/esm/components/form/PhoneInput/hooks/useValidateInitialValue.js +33 -0
- package/dist/esm/components/form/PhoneInput/index.js +236 -0
- package/dist/esm/components/form/PhoneInput/index.stories.js +107 -0
- package/dist/esm/components/form/PhoneInput/phoneInputLogic.js +153 -0
- package/dist/esm/components/form/PhoneInput/styles.js +13 -0
- package/dist/esm/components/form/PhoneInput/types.js +3 -0
- package/dist/esm/components/form/PositiveIntegerInput/hooks/useFilters.js +15 -0
- package/dist/esm/components/form/PositiveIntegerInput/hooks/useIncrement.js +16 -0
- package/dist/esm/components/form/PositiveIntegerInput/hooks/useIncrementDisabledFlags.js +18 -0
- package/dist/esm/components/form/PositiveIntegerInput/hooks/useNormalizers.js +16 -0
- package/dist/esm/components/form/PositiveIntegerInput/index.js +128 -0
- package/dist/esm/components/form/PositiveIntegerInput/index.stories.js +40 -0
- package/dist/esm/components/form/PositiveIntegerInput/styles.js +16 -0
- package/dist/esm/components/form/PureInput/index.js +62 -0
- package/dist/esm/components/form/PureInput/index.stories.js +18 -0
- package/dist/esm/components/form/PureInput/palette.js +12 -0
- package/dist/esm/components/form/PureInput/styles.js +44 -0
- package/dist/esm/components/form/ResetButton/CrossIcon/index.js +16 -0
- package/dist/esm/components/form/ResetButton/CrossIcon/index.stories.js +8 -0
- package/dist/esm/components/form/ResetButton/index.js +13 -0
- package/dist/esm/components/form/ResetButton/index.stories.js +14 -0
- package/dist/esm/components/form/ResetButton/palette.js +5 -0
- package/dist/esm/components/form/ResetButton/styles.js +8 -0
- package/dist/esm/components/form/SearchInput/components/SearchIcon/index.js +17 -0
- package/dist/esm/components/form/SearchInput/components/SearchIcon/index.stories.js +8 -0
- package/dist/esm/components/form/SearchInput/index.js +93 -0
- package/dist/esm/components/form/SearchInput/index.stories.js +33 -0
- package/dist/esm/components/form/SearchInput/palette.js +5 -0
- package/dist/esm/components/form/SearchInput/styles.js +14 -0
- package/dist/esm/components/form/Select/components/Input/index.js +72 -0
- package/dist/esm/components/form/Select/components/Input/index.stories.js +21 -0
- package/dist/esm/components/form/Select/components/Input/styles.js +12 -0
- package/dist/esm/components/form/Select/components/Loader/index.js +16 -0
- package/dist/esm/components/form/Select/components/Loader/styles.js +13 -0
- package/dist/esm/components/form/Select/hooks/useOptionGroups.js +27 -0
- package/dist/esm/components/form/Select/index.js +243 -0
- package/dist/esm/components/form/Select/index.stories.js +241 -0
- package/dist/esm/components/form/Select/palette.js +7 -0
- package/dist/esm/components/form/Select/styles.js +60 -0
- package/dist/esm/components/form/TagsInput/assets/CrossIcon.js +23 -0
- package/dist/esm/components/form/TagsInput/index.js +161 -0
- package/dist/esm/components/form/TagsInput/index.stories.js +34 -0
- package/dist/esm/components/form/TagsInput/palette.js +6 -0
- package/dist/esm/components/form/TagsInput/styles.js +37 -0
- package/dist/esm/components/form/TextInput/index.js +113 -0
- package/dist/esm/components/form/TextInput/index.stories.js +42 -0
- package/dist/esm/components/form/TextInput/styles.js +9 -0
- package/dist/esm/components/form/Toggle/index.js +40 -0
- package/dist/esm/components/form/Toggle/index.stories.js +33 -0
- package/dist/esm/components/form/Toggle/palette.js +11 -0
- package/dist/esm/components/form/Toggle/styles.js +74 -0
- package/dist/esm/components/form/common/DrawerHeader/components/Cross24Icon/index.js +16 -0
- package/dist/esm/components/form/common/DrawerHeader/components/Cross24Icon/index.stories.js +8 -0
- package/dist/esm/components/form/common/DrawerHeader/index.js +28 -0
- package/dist/esm/components/form/common/DrawerHeader/index.stories.js +18 -0
- package/dist/esm/components/form/common/DrawerHeader/palette.js +8 -0
- package/dist/esm/components/form/common/DrawerHeader/styles.js +27 -0
- package/dist/esm/components/form/constants.js +40 -0
- package/dist/esm/hooks/useInputFocus/index.js +31 -0
- package/dist/esm/hooks/useInputFocus/index.stories.js +24 -0
- package/dist/esm/hooks/useLoadingSubmit/index.js +31 -0
- package/dist/esm/hooks/useLoadingSubmit/index.stories.js +28 -0
- package/dist/esm/hooks/useMedia/index.js +44 -0
- package/dist/esm/hooks/useMedia/index.stories.js +18 -0
- package/dist/esm/hooks/useModal/index.js +26 -0
- package/dist/esm/hooks/useModal/index.stories.js +35 -0
- package/dist/esm/hooks/useOutsideClick/index.js +16 -0
- package/dist/esm/hooks/useOutsideClick/index.stories.js +22 -0
- package/dist/esm/hooks/useUnupdatableHandler/index.js +11 -0
- package/dist/esm/hooks/useUnupdatableHandler/index.stories.js +42 -0
- package/dist/esm/index.js +53 -0
- package/dist/esm/palette/colors.stories.js +36 -0
- package/dist/esm/palette/constants.js +12 -0
- package/dist/esm/palette/context.js +64 -0
- package/dist/esm/palette/index.js +3 -0
- package/dist/esm/palette/index.stories.js +78 -0
- package/dist/esm/palette/provider.js +87 -0
- package/dist/esm/palette/types.js +1 -0
- package/dist/esm/palette/useComponentPalette.js +16 -0
- package/dist/esm/palette/usePalette.js +5 -0
- package/dist/esm/utils/hexToRgba.js +15 -0
- package/dist/esm/utils/transformColorByHsl.js +12 -0
- package/dist/esm/validate/index.js +175 -0
- package/dist/esm/validate/types.js +1 -0
- package/dist/esm/validate/utils/vatNumberValidateHelpers.js +129 -0
- package/dist/esm/validate/utils/websiteValidate.test.js +45 -0
- package/dist/hooks/useMedia/index.js +34 -13
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -20
- package/dist/utils/hexToRgba.d.ts +1 -0
- package/dist/utils/hexToRgba.js +21 -0
- package/package.json +6 -9
- package/dist/components/common/InvoiceboxLoader/assets/loader.json +0 -1
- package/dist/components/common/InvoiceboxLoader/index.d.ts +0 -5
- package/dist/components/common/InvoiceboxLoader/index.js +0 -879
- package/dist/components/common/InvoiceboxLoader/index.stories.d.ts +0 -5
- package/dist/components/common/InvoiceboxLoader/index.stories.js +0 -18
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export var MASK_DIGIT_ITEM = '9';
|
|
2
|
+
export var getAllCountriesPhoneRules = function getAllCountriesPhoneRules(isSupportCityRusPhoneNumber) {
|
|
3
|
+
return {
|
|
4
|
+
BLR: {
|
|
5
|
+
placeholder: '+375 XX XXX-XX-XX',
|
|
6
|
+
mask: '+999 99 999-99-99',
|
|
7
|
+
startSubsequence: '375',
|
|
8
|
+
regexp: /^(\+?375)?(24|25|29|33|44)\d{7}$/,
|
|
9
|
+
flag: 'BLR'
|
|
10
|
+
},
|
|
11
|
+
AZE: {
|
|
12
|
+
placeholder: '+994 (XX) XXX-XXXX',
|
|
13
|
+
mask: '+999 (99) 999-9999',
|
|
14
|
+
startSubsequence: '994',
|
|
15
|
+
regexp: /^\+?994\d{9}$/,
|
|
16
|
+
flag: 'AZE'
|
|
17
|
+
},
|
|
18
|
+
ARM: {
|
|
19
|
+
placeholder: '+374 (XX) XXX-XXX',
|
|
20
|
+
mask: '+999 (99) 999-999',
|
|
21
|
+
startSubsequence: '374',
|
|
22
|
+
regexp: /\+?374\d{8}/,
|
|
23
|
+
flag: 'ARM'
|
|
24
|
+
},
|
|
25
|
+
KAZ: {
|
|
26
|
+
placeholder: '+7 (XXX) XXX-XX-XX',
|
|
27
|
+
mask: '+9 (999) 999-99-99',
|
|
28
|
+
startSubsequence: '77',
|
|
29
|
+
regexp: /^77\d{9}$/,
|
|
30
|
+
flag: 'KAZ'
|
|
31
|
+
},
|
|
32
|
+
RUS: {
|
|
33
|
+
placeholder: '+7 (XXX) XXX-XX-XX',
|
|
34
|
+
mask: '+9 (999) 999-99-99',
|
|
35
|
+
startSubsequence: '7',
|
|
36
|
+
regexp: isSupportCityRusPhoneNumber ? /^7\d{10}$/ : /^\+?7(9\d{9})$/,
|
|
37
|
+
flag: 'RUS'
|
|
38
|
+
},
|
|
39
|
+
KGZ: {
|
|
40
|
+
placeholder: '+996 XXX-XX-XX-XX',
|
|
41
|
+
mask: '+999 999-99-99-99',
|
|
42
|
+
startSubsequence: '996',
|
|
43
|
+
regexp: /\+?996\d{9}/,
|
|
44
|
+
flag: 'KGZ'
|
|
45
|
+
},
|
|
46
|
+
TJK: {
|
|
47
|
+
placeholder: '+992-XX-XXX-XXXX',
|
|
48
|
+
mask: '+999-99-999-9999',
|
|
49
|
+
startSubsequence: '992',
|
|
50
|
+
regexp: /^\+?992\d{9}$/,
|
|
51
|
+
flag: 'TJK'
|
|
52
|
+
},
|
|
53
|
+
UZB: {
|
|
54
|
+
placeholder: '+998 XX XXXXXXX',
|
|
55
|
+
mask: '+999 99 9999999',
|
|
56
|
+
startSubsequence: '998',
|
|
57
|
+
regexp: /\+?998\d{9}/,
|
|
58
|
+
flag: 'UZB'
|
|
59
|
+
},
|
|
60
|
+
// для всех непредусмотренных стран
|
|
61
|
+
UNKNOWN: {
|
|
62
|
+
placeholder: '',
|
|
63
|
+
mask: '+999999999999999999',
|
|
64
|
+
startSubsequence: '',
|
|
65
|
+
regexp: /^\d{7,}$/,
|
|
66
|
+
flag: 'UNKNOWN'
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
3
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
4
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { PhoneInputLogic } from './phoneInputLogic';
|
|
8
|
+
var ExternalPhoneLogic = /*#__PURE__*/function () {
|
|
9
|
+
function ExternalPhoneLogic() {
|
|
10
|
+
_classCallCheck(this, ExternalPhoneLogic);
|
|
11
|
+
}
|
|
12
|
+
return _createClass(ExternalPhoneLogic, [{
|
|
13
|
+
key: "getIsValidPhone",
|
|
14
|
+
value: function getIsValidPhone(value, countries, isSupportCityRusPhoneNumber) {
|
|
15
|
+
var phoneInputLogic = new PhoneInputLogic(isSupportCityRusPhoneNumber || false);
|
|
16
|
+
var notFormattedValue = phoneInputLogic.getOnlyNumbersFromString(value);
|
|
17
|
+
var supportedCountries = phoneInputLogic.getSupportedCountriesByCountryNames(countries);
|
|
18
|
+
var currentCountriesPhoneRules = phoneInputLogic.getCountriesPhoneRulesByCountryNames(supportedCountries);
|
|
19
|
+
var country = Object.entries(currentCountriesPhoneRules).find(function (item) {
|
|
20
|
+
return phoneInputLogic.getIsHaveStartSequenceInString(notFormattedValue, item[1].startSubsequence);
|
|
21
|
+
});
|
|
22
|
+
return phoneInputLogic.getIsValidPhoneInputByCountry(notFormattedValue, country ? country[1] : phoneInputLogic.getRusCountry());
|
|
23
|
+
}
|
|
24
|
+
}, {
|
|
25
|
+
key: "getIsValidRusPhone",
|
|
26
|
+
value: function getIsValidRusPhone(phone, isSupportCityRusPhoneNumber) {
|
|
27
|
+
var phoneInputLogic = new PhoneInputLogic(isSupportCityRusPhoneNumber || false);
|
|
28
|
+
return phoneInputLogic.getIsValidPhoneInputByCountry(phone || '', phoneInputLogic.getRusCountry());
|
|
29
|
+
}
|
|
30
|
+
}]);
|
|
31
|
+
}();
|
|
32
|
+
export var phoneLogic = new ExternalPhoneLogic();
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
+
import { useEffect, useState } from 'react';
|
|
8
|
+
import { RUS_COUNTRY_CODE } from '../types';
|
|
9
|
+
export var useValidateInitialValue = function useValidateInitialValue(phoneInputLogic, initialValue, currentCountriesPhoneRules, onValid, onUnValid) {
|
|
10
|
+
var _useState = useState(false),
|
|
11
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
12
|
+
isInitialValidateDone = _useState2[0],
|
|
13
|
+
setIsInitialValidateDone = _useState2[1];
|
|
14
|
+
useEffect(function () {
|
|
15
|
+
if (isInitialValidateDone) return;
|
|
16
|
+
if (initialValue) {
|
|
17
|
+
var notFormattedValue = phoneInputLogic.getOnlyNumbersFromString(initialValue);
|
|
18
|
+
var currentCountry = Object.entries(currentCountriesPhoneRules).find(function (item) {
|
|
19
|
+
return phoneInputLogic.getIsHaveStartSequenceInString(notFormattedValue, item[1].startSubsequence);
|
|
20
|
+
});
|
|
21
|
+
var countryCode = currentCountry ? currentCountry[0] : RUS_COUNTRY_CODE;
|
|
22
|
+
var isValidInputValue = phoneInputLogic.getIsValidPhoneInputByCountry(notFormattedValue, currentCountry ? currentCountry[1] : phoneInputLogic.getRusCountry());
|
|
23
|
+
if (isValidInputValue) {
|
|
24
|
+
onValid(notFormattedValue, countryCode);
|
|
25
|
+
} else {
|
|
26
|
+
onUnValid(countryCode);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
setIsInitialValidateDone(true);
|
|
30
|
+
|
|
31
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32
|
+
}, [isInitialValidateDone]);
|
|
33
|
+
};
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
5
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
6
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
8
|
+
import React, { useCallback, useMemo, useState, useRef } from 'react';
|
|
9
|
+
import InputMask from '@mona-health/react-input-mask';
|
|
10
|
+
import * as S from './styles';
|
|
11
|
+
import { PhoneInputLogic } from './phoneInputLogic';
|
|
12
|
+
import { useValidateInitialValue } from './hooks/useValidateInitialValue';
|
|
13
|
+
import { RUS_COUNTRY_CODE } from './types';
|
|
14
|
+
import { useInputFocus } from '../../../hooks/useInputFocus';
|
|
15
|
+
import { InputLabel } from '../InputLabel';
|
|
16
|
+
import { PureInput } from '../PureInput';
|
|
17
|
+
import { CountrySelect } from '../CountrySelect';
|
|
18
|
+
import { useMobile } from '../../../hooks/useMedia';
|
|
19
|
+
import { MODERN_STYLE_SIZE_PARAMS_MAP, SIZE_PARAMS_MAP } from '../constants';
|
|
20
|
+
import { ModernPlaceholder } from '../ModernPlaceholder';
|
|
21
|
+
export var PhoneInput = function PhoneInput(_ref) {
|
|
22
|
+
var onBlur = _ref.onBlur,
|
|
23
|
+
name = _ref.name,
|
|
24
|
+
onFocus = _ref.onFocus,
|
|
25
|
+
countrySelectProps = _ref.countrySelectProps,
|
|
26
|
+
value = _ref.value,
|
|
27
|
+
onChange = _ref.onChange,
|
|
28
|
+
hasError = _ref.hasError,
|
|
29
|
+
label = _ref.label,
|
|
30
|
+
disabled = _ref.disabled,
|
|
31
|
+
id = _ref.id,
|
|
32
|
+
countries = _ref.countries,
|
|
33
|
+
onCountryChange = _ref.onCountryChange,
|
|
34
|
+
pureInputProps = _ref.pureInputProps,
|
|
35
|
+
_ref$size = _ref.size,
|
|
36
|
+
size = _ref$size === void 0 ? 'M' : _ref$size,
|
|
37
|
+
autoFocus = _ref.autoFocus,
|
|
38
|
+
_ref$isSupportCityRus = _ref.isSupportCityRusPhoneNumber,
|
|
39
|
+
isSupportCityRusPhoneNumber = _ref$isSupportCityRus === void 0 ? false : _ref$isSupportCityRus,
|
|
40
|
+
_ref$isInnerErrorHigh = _ref.isInnerErrorHighlight,
|
|
41
|
+
isInnerErrorHighlight = _ref$isInnerErrorHigh === void 0 ? true : _ref$isInnerErrorHigh,
|
|
42
|
+
_ref$required = _ref.required,
|
|
43
|
+
required = _ref$required === void 0 ? false : _ref$required,
|
|
44
|
+
_ref$useModernStyles = _ref.useModernStyles,
|
|
45
|
+
useModernStyles = _ref$useModernStyles === void 0 ? false : _ref$useModernStyles;
|
|
46
|
+
var inputRef = useRef();
|
|
47
|
+
var isMobile = useMobile();
|
|
48
|
+
var phoneInputLogic = useMemo(function () {
|
|
49
|
+
return new PhoneInputLogic(isSupportCityRusPhoneNumber);
|
|
50
|
+
}, [isSupportCityRusPhoneNumber]);
|
|
51
|
+
var countrySelectOptions = useMemo(function () {
|
|
52
|
+
return phoneInputLogic.getCountriesSelectOptions(countries);
|
|
53
|
+
}, [countries, phoneInputLogic]);
|
|
54
|
+
var isHaveSelectCountries = useMemo(function () {
|
|
55
|
+
return phoneInputLogic.getIsHaveCountriesSelectOptions(countrySelectOptions);
|
|
56
|
+
}, [countrySelectOptions, phoneInputLogic]);
|
|
57
|
+
var currentCountriesPhoneRules = useMemo(function () {
|
|
58
|
+
return phoneInputLogic.getCountriesPhoneRulesBySelectOptions(countrySelectOptions);
|
|
59
|
+
}, [countrySelectOptions, phoneInputLogic]);
|
|
60
|
+
var _useInputFocus = useInputFocus({
|
|
61
|
+
onFocus: onFocus,
|
|
62
|
+
onBlur: onBlur
|
|
63
|
+
}),
|
|
64
|
+
inFocus = _useInputFocus.inFocus,
|
|
65
|
+
focusHandler = _useInputFocus.handleFocus,
|
|
66
|
+
blurHandler = _useInputFocus.handleBlur;
|
|
67
|
+
var _useState = useState(false),
|
|
68
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
69
|
+
isHaveInputError = _useState2[0],
|
|
70
|
+
setIsHaveInputError = _useState2[1];
|
|
71
|
+
var _useState3 = useState(true),
|
|
72
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
73
|
+
isFirstBlur = _useState4[0],
|
|
74
|
+
setIsFirstBlur = _useState4[1];
|
|
75
|
+
var _useState5 = useState(value),
|
|
76
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
77
|
+
inputValue = _useState6[0],
|
|
78
|
+
setInputValue = _useState6[1];
|
|
79
|
+
var _useState7 = useState(RUS_COUNTRY_CODE),
|
|
80
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
81
|
+
country = _useState8[0],
|
|
82
|
+
setCountry = _useState8[1];
|
|
83
|
+
var handleChangeCountry = useCallback(function (countryCode) {
|
|
84
|
+
setCountry(countryCode);
|
|
85
|
+
if (onCountryChange) {
|
|
86
|
+
onCountryChange(countryCode);
|
|
87
|
+
}
|
|
88
|
+
}, [onCountryChange]);
|
|
89
|
+
var handleInitialValid = useCallback(function (currentInputValue, countryCode) {
|
|
90
|
+
onChange(currentInputValue);
|
|
91
|
+
setIsHaveInputError(false);
|
|
92
|
+
setCountry(countryCode);
|
|
93
|
+
}, [onChange]);
|
|
94
|
+
var handleInitialUnValid = useCallback(function (countryCode) {
|
|
95
|
+
onChange('');
|
|
96
|
+
setIsHaveInputError(true);
|
|
97
|
+
setCountry(countryCode);
|
|
98
|
+
}, [onChange]);
|
|
99
|
+
useValidateInitialValue(phoneInputLogic, value, currentCountriesPhoneRules, handleInitialValid, handleInitialUnValid);
|
|
100
|
+
var getNewCountryByInputValue = useCallback(function (currentValue) {
|
|
101
|
+
var currentCountry = currentCountriesPhoneRules[country];
|
|
102
|
+
var newCountry = Object.entries(currentCountriesPhoneRules).find(function (item) {
|
|
103
|
+
return phoneInputLogic.getIsHaveStartSequenceInString(currentValue, item[1].startSubsequence);
|
|
104
|
+
});
|
|
105
|
+
var isNeedChangeCountry = phoneInputLogic.getIsNeedChangeCountry(currentValue, currentCountry, newCountry);
|
|
106
|
+
var isNeedAndCanChangeCountry = isNeedChangeCountry && !!newCountry;
|
|
107
|
+
if (isNeedAndCanChangeCountry) {
|
|
108
|
+
handleChangeCountry(newCountry[0]);
|
|
109
|
+
}
|
|
110
|
+
return isNeedAndCanChangeCountry ? newCountry[1] : currentCountry;
|
|
111
|
+
}, [country, currentCountriesPhoneRules, handleChangeCountry, phoneInputLogic]);
|
|
112
|
+
var getIsValidValue = useCallback(function (currentValue) {
|
|
113
|
+
var currentCountry = getNewCountryByInputValue(currentValue);
|
|
114
|
+
return phoneInputLogic.getIsValidPhoneInputByCountry(currentValue, currentCountry);
|
|
115
|
+
}, [getNewCountryByInputValue, phoneInputLogic]);
|
|
116
|
+
var handleInputValueChange = useCallback(function (currentInputValue, event) {
|
|
117
|
+
var notFormattedValue = phoneInputLogic.getOnlyNumbersFromString(currentInputValue);
|
|
118
|
+
var moveCaret = event ? phoneInputLogic.moveCaretByValue(event) : undefined;
|
|
119
|
+
var intermediateValue = country === RUS_COUNTRY_CODE ? phoneInputLogic.formatRusPhoneToUnifiedView(notFormattedValue, moveCaret) : notFormattedValue;
|
|
120
|
+
var isValidInputValue = getIsValidValue(intermediateValue);
|
|
121
|
+
setIsHaveInputError(!isValidInputValue);
|
|
122
|
+
onChange(isValidInputValue ? intermediateValue : '');
|
|
123
|
+
setInputValue(intermediateValue);
|
|
124
|
+
}, [country, getIsValidValue, onChange, phoneInputLogic]);
|
|
125
|
+
var handleChange = useCallback(function (event) {
|
|
126
|
+
handleInputValueChange(event.target.value, event);
|
|
127
|
+
}, [handleInputValueChange]);
|
|
128
|
+
var handleBlur = useCallback(function (event) {
|
|
129
|
+
blurHandler(event);
|
|
130
|
+
if (isFirstBlur) {
|
|
131
|
+
setIsFirstBlur(false);
|
|
132
|
+
}
|
|
133
|
+
}, [isFirstBlur, blurHandler]);
|
|
134
|
+
var handleCountryChange = useCallback(function (countryValue) {
|
|
135
|
+
handleChangeCountry(countryValue);
|
|
136
|
+
var currentCountry = currentCountriesPhoneRules[countryValue];
|
|
137
|
+
var isValidInputValue = phoneInputLogic.getIsValidPhoneInputByCountry(inputValue, currentCountry);
|
|
138
|
+
setIsFirstBlur(false);
|
|
139
|
+
setIsHaveInputError(!isValidInputValue);
|
|
140
|
+
onChange(isValidInputValue ? inputValue : '');
|
|
141
|
+
setTimeout(function () {
|
|
142
|
+
var _inputRef$current;
|
|
143
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
144
|
+
}, 0);
|
|
145
|
+
}, [currentCountriesPhoneRules, handleChangeCountry, inputValue, onChange, phoneInputLogic]);
|
|
146
|
+
var handlePaste = useCallback(function (event) {
|
|
147
|
+
event.preventDefault();
|
|
148
|
+
var pasteText = event.clipboardData.getData('Text').trim();
|
|
149
|
+
handleInputValueChange(pasteText, event);
|
|
150
|
+
}, [handleInputValueChange]);
|
|
151
|
+
var hasPureInputError = useMemo(function () {
|
|
152
|
+
if (hasError) return true;
|
|
153
|
+
if (isFirstBlur) return false;
|
|
154
|
+
if (isInnerErrorHighlight) return isHaveInputError;
|
|
155
|
+
return false;
|
|
156
|
+
}, [hasError, isFirstBlur, isHaveInputError, isInnerErrorHighlight]);
|
|
157
|
+
var inputLabel = useMemo(function () {
|
|
158
|
+
if (useModernStyles) {
|
|
159
|
+
if (inputValue || inFocus) {
|
|
160
|
+
return label;
|
|
161
|
+
} else {
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
return label;
|
|
166
|
+
}
|
|
167
|
+
}, [useModernStyles, inputValue, inFocus, label]);
|
|
168
|
+
var paddingOptions = useMemo(function () {
|
|
169
|
+
if ((inputValue || inFocus) && useModernStyles && inputLabel) {
|
|
170
|
+
return MODERN_STYLE_SIZE_PARAMS_MAP[size];
|
|
171
|
+
} else {
|
|
172
|
+
return SIZE_PARAMS_MAP[size];
|
|
173
|
+
}
|
|
174
|
+
}, [inputValue, useModernStyles, size, inFocus, inputLabel]);
|
|
175
|
+
var inputPlaceholder = useMemo(function () {
|
|
176
|
+
if (useModernStyles) {
|
|
177
|
+
return undefined;
|
|
178
|
+
} else {
|
|
179
|
+
return currentCountriesPhoneRules[country].placeholder;
|
|
180
|
+
}
|
|
181
|
+
}, [country, currentCountriesPhoneRules, useModernStyles]);
|
|
182
|
+
var modernPlaceholderText = label || currentCountriesPhoneRules[country].placeholder;
|
|
183
|
+
var isModernPlaceholderVisible = useMemo(function () {
|
|
184
|
+
return !inFocus && !inputValue;
|
|
185
|
+
}, [inFocus, inputValue]);
|
|
186
|
+
return /*#__PURE__*/React.createElement(InputLabel, {
|
|
187
|
+
inFocus: inFocus,
|
|
188
|
+
label: inputLabel,
|
|
189
|
+
disabled: disabled,
|
|
190
|
+
required: required,
|
|
191
|
+
useModernStyles: useModernStyles,
|
|
192
|
+
size: size,
|
|
193
|
+
left: useModernStyles ? 65 : undefined
|
|
194
|
+
}, /*#__PURE__*/React.createElement(S.InputLabelContent, null, useModernStyles && /*#__PURE__*/React.createElement(ModernPlaceholder, {
|
|
195
|
+
visible: isModernPlaceholderVisible,
|
|
196
|
+
paddingLeft: isHaveSelectCountries ? 75 : 18,
|
|
197
|
+
paddingTop: SIZE_PARAMS_MAP[size].paddingTop,
|
|
198
|
+
size: size,
|
|
199
|
+
required: required
|
|
200
|
+
}, modernPlaceholderText), !!(countrySelectOptions !== null && countrySelectOptions !== void 0 && countrySelectOptions.length) && /*#__PURE__*/React.createElement(S.InputLabelFloatWrapper, null, /*#__PURE__*/React.createElement(S.CountrySelectWrapper, null, /*#__PURE__*/React.createElement(CountrySelect, {
|
|
201
|
+
minWidth: isMobile ? '100%' : '350px',
|
|
202
|
+
options: countrySelectOptions,
|
|
203
|
+
onChange: handleCountryChange,
|
|
204
|
+
value: country,
|
|
205
|
+
placeholder: (countrySelectProps === null || countrySelectProps === void 0 ? void 0 : countrySelectProps.placeholder) || '',
|
|
206
|
+
positionVertical: 16,
|
|
207
|
+
positionRight: "0",
|
|
208
|
+
positionLeft: "-20px",
|
|
209
|
+
disabled: disabled,
|
|
210
|
+
selectedLabel: (countrySelectProps === null || countrySelectProps === void 0 ? void 0 : countrySelectProps.selectedLabel) || ''
|
|
211
|
+
}))), /*#__PURE__*/React.createElement(InputMask, {
|
|
212
|
+
value: inputValue,
|
|
213
|
+
onFocus: focusHandler,
|
|
214
|
+
onBlur: handleBlur,
|
|
215
|
+
onChange: handleChange,
|
|
216
|
+
mask: currentCountriesPhoneRules[country].mask,
|
|
217
|
+
maskPlaceholder: null,
|
|
218
|
+
disabled: disabled,
|
|
219
|
+
onPaste: handlePaste,
|
|
220
|
+
placeholder: inputPlaceholder,
|
|
221
|
+
ref: inputRef
|
|
222
|
+
}, /*#__PURE__*/React.createElement(PureInput, _extends({
|
|
223
|
+
id: id,
|
|
224
|
+
hasError: hasPureInputError,
|
|
225
|
+
inFocus: inFocus,
|
|
226
|
+
name: name,
|
|
227
|
+
paddingLeft: isHaveSelectCountries ? 75 : 18
|
|
228
|
+
// for disable autocomplete
|
|
229
|
+
,
|
|
230
|
+
autoComplete: 'new-password',
|
|
231
|
+
inputMode: "numeric",
|
|
232
|
+
autoFocus: autoFocus
|
|
233
|
+
}, paddingOptions, {
|
|
234
|
+
useModernStyles: useModernStyles
|
|
235
|
+
}, pureInputProps)))));
|
|
236
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
8
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
9
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
12
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
13
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
14
|
+
import React, { useState } from 'react';
|
|
15
|
+
import { PhoneInput } from '.';
|
|
16
|
+
var meta = {
|
|
17
|
+
title: 'form/PhoneInput',
|
|
18
|
+
component: PhoneInput,
|
|
19
|
+
tags: ['autodocs'],
|
|
20
|
+
argTypes: {
|
|
21
|
+
onBlur: {
|
|
22
|
+
action: 'onBlur'
|
|
23
|
+
},
|
|
24
|
+
onFocus: {
|
|
25
|
+
action: 'onFocus'
|
|
26
|
+
},
|
|
27
|
+
onCountryChange: {
|
|
28
|
+
action: 'onCountryChange'
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export default meta;
|
|
33
|
+
var Component = function Component(props) {
|
|
34
|
+
var _useState = useState('37411800000'),
|
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
+
value = _useState2[0],
|
|
37
|
+
setValue = _useState2[1];
|
|
38
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, "\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435: ", /*#__PURE__*/React.createElement("span", null, value)), /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
style: {
|
|
40
|
+
width: 400
|
|
41
|
+
}
|
|
42
|
+
}, /*#__PURE__*/React.createElement(PhoneInput, _extends({}, props, {
|
|
43
|
+
value: value,
|
|
44
|
+
onChange: setValue
|
|
45
|
+
}))));
|
|
46
|
+
};
|
|
47
|
+
var commonProps = {
|
|
48
|
+
disabled: false,
|
|
49
|
+
label: 'Телефон',
|
|
50
|
+
size: 'L',
|
|
51
|
+
isSupportCityRusPhoneNumber: false
|
|
52
|
+
};
|
|
53
|
+
export var MultiCountry = {
|
|
54
|
+
args: _objectSpread(_objectSpread({}, commonProps), {}, {
|
|
55
|
+
countries: [{
|
|
56
|
+
label: 'Россия',
|
|
57
|
+
value: 'RUS'
|
|
58
|
+
}, {
|
|
59
|
+
label: 'Армения',
|
|
60
|
+
value: 'ARM'
|
|
61
|
+
}, {
|
|
62
|
+
label: 'Белорусь',
|
|
63
|
+
value: 'BLR'
|
|
64
|
+
}, {
|
|
65
|
+
label: 'Казахстан',
|
|
66
|
+
value: 'KAZ'
|
|
67
|
+
}, {
|
|
68
|
+
label: 'Кыргызстан',
|
|
69
|
+
value: 'KGZ'
|
|
70
|
+
}, {
|
|
71
|
+
label: 'Азербайджан',
|
|
72
|
+
value: 'AZE'
|
|
73
|
+
}, {
|
|
74
|
+
label: 'Такджикистан',
|
|
75
|
+
value: 'TJK'
|
|
76
|
+
}, {
|
|
77
|
+
label: 'Узбекистан',
|
|
78
|
+
value: 'UZB'
|
|
79
|
+
}]
|
|
80
|
+
}),
|
|
81
|
+
render: Component
|
|
82
|
+
};
|
|
83
|
+
export var MultiCountryWithUnknown = {
|
|
84
|
+
args: _objectSpread(_objectSpread({}, commonProps), {}, {
|
|
85
|
+
countries: [{
|
|
86
|
+
label: 'Россия',
|
|
87
|
+
value: 'RUS'
|
|
88
|
+
}, {
|
|
89
|
+
label: 'Казахстан',
|
|
90
|
+
value: 'KAZ'
|
|
91
|
+
}, {
|
|
92
|
+
label: 'Армения',
|
|
93
|
+
value: 'ARM'
|
|
94
|
+
}, {
|
|
95
|
+
label: 'Белорусь',
|
|
96
|
+
value: 'BLR'
|
|
97
|
+
}, {
|
|
98
|
+
label: 'Другая',
|
|
99
|
+
value: 'UNKNOWN'
|
|
100
|
+
}]
|
|
101
|
+
}),
|
|
102
|
+
render: Component
|
|
103
|
+
};
|
|
104
|
+
export var DefaultRusCountry = {
|
|
105
|
+
args: commonProps,
|
|
106
|
+
render: Component
|
|
107
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
5
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
6
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
7
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
import { UNKNOWN_COUNTRY_CODE } from './types';
|
|
11
|
+
import { getAllCountriesPhoneRules, MASK_DIGIT_ITEM } from './constants';
|
|
12
|
+
export var PhoneInputLogic = /*#__PURE__*/function () {
|
|
13
|
+
function PhoneInputLogic(isSupportCityRusPhoneNumber) {
|
|
14
|
+
_classCallCheck(this, PhoneInputLogic);
|
|
15
|
+
_defineProperty(this, "isSupportCityRusPhoneNumber", void 0);
|
|
16
|
+
_defineProperty(this, "allCountriesPhoneRules", void 0);
|
|
17
|
+
this.isSupportCityRusPhoneNumber = isSupportCityRusPhoneNumber;
|
|
18
|
+
this.allCountriesPhoneRules = getAllCountriesPhoneRules(isSupportCityRusPhoneNumber);
|
|
19
|
+
}
|
|
20
|
+
return _createClass(PhoneInputLogic, [{
|
|
21
|
+
key: "getRusCountry",
|
|
22
|
+
value: function getRusCountry() {
|
|
23
|
+
return this.allCountriesPhoneRules.RUS;
|
|
24
|
+
}
|
|
25
|
+
}, {
|
|
26
|
+
key: "getCaretPositionByRusValue",
|
|
27
|
+
value: function getCaretPositionByRusValue(value) {
|
|
28
|
+
var mask = this.getRusCountry().mask.split('');
|
|
29
|
+
var counter = 0;
|
|
30
|
+
var position = 0;
|
|
31
|
+
mask.forEach(function (maskItem, index) {
|
|
32
|
+
if (maskItem === MASK_DIGIT_ITEM) {
|
|
33
|
+
counter += 1;
|
|
34
|
+
if (counter === value.length) {
|
|
35
|
+
position = index + 1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return position;
|
|
40
|
+
}
|
|
41
|
+
}, {
|
|
42
|
+
key: "getIsValidPhoneInputByCountry",
|
|
43
|
+
value: function getIsValidPhoneInputByCountry(value, country) {
|
|
44
|
+
return !!value.match(country.regexp);
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "getSupportedCountriesByCountryNames",
|
|
48
|
+
value: function getSupportedCountriesByCountryNames(countries) {
|
|
49
|
+
var _this = this;
|
|
50
|
+
return countries === null || countries === void 0 ? void 0 : countries.filter(function (country) {
|
|
51
|
+
return _this.allCountriesPhoneRules[country];
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
55
|
+
key: "getCountriesSelectOptions",
|
|
56
|
+
value: function getCountriesSelectOptions(countries) {
|
|
57
|
+
var _this2 = this;
|
|
58
|
+
var supportedCountries = countries === null || countries === void 0 ? void 0 : countries.filter(function (country) {
|
|
59
|
+
return _this2.allCountriesPhoneRules[country.value];
|
|
60
|
+
});
|
|
61
|
+
return supportedCountries === null || supportedCountries === void 0 ? void 0 : supportedCountries.map(function (country) {
|
|
62
|
+
var countryRules = _this2.allCountriesPhoneRules[country.value];
|
|
63
|
+
return _objectSpread(_objectSpread({}, country), {}, {
|
|
64
|
+
description: countryRules.startSubsequence ? "+".concat(countryRules.startSubsequence) : '',
|
|
65
|
+
flag: countryRules.flag
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}, {
|
|
70
|
+
key: "getIsHaveCountriesSelectOptions",
|
|
71
|
+
value: function getIsHaveCountriesSelectOptions(countrySelectOptions) {
|
|
72
|
+
return !!(countrySelectOptions !== null && countrySelectOptions !== void 0 && countrySelectOptions.length);
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
key: "getCountriesPhoneRulesBySelectOptions",
|
|
76
|
+
value: function getCountriesPhoneRulesBySelectOptions(countrySelectOptions) {
|
|
77
|
+
return this.getIsHaveCountriesSelectOptions(countrySelectOptions) ? Object.fromEntries(Object.entries(this.allCountriesPhoneRules).filter(function (ruleItem) {
|
|
78
|
+
return countrySelectOptions === null || countrySelectOptions === void 0 ? void 0 : countrySelectOptions.find(function (countrySelectOption) {
|
|
79
|
+
return countrySelectOption.value === ruleItem[0];
|
|
80
|
+
});
|
|
81
|
+
})) : {
|
|
82
|
+
RUS: this.getRusCountry()
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: "getCountriesPhoneRulesByCountryNames",
|
|
87
|
+
value: function getCountriesPhoneRulesByCountryNames(countrySelectOptions) {
|
|
88
|
+
return this.getIsHaveCountriesSelectOptions(countrySelectOptions) ? Object.fromEntries(Object.entries(this.allCountriesPhoneRules).filter(function (ruleItem) {
|
|
89
|
+
return countrySelectOptions === null || countrySelectOptions === void 0 ? void 0 : countrySelectOptions.find(function (countrySelectOption) {
|
|
90
|
+
return countrySelectOption === ruleItem[0];
|
|
91
|
+
});
|
|
92
|
+
})) : {
|
|
93
|
+
RUS: this.getRusCountry()
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
key: "getIsHaveStartSequenceInString",
|
|
98
|
+
value: function getIsHaveStartSequenceInString(value, subsequence) {
|
|
99
|
+
return value.startsWith(subsequence);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// '8' => '+7', '9' => '+79'
|
|
103
|
+
}, {
|
|
104
|
+
key: "formatRusPhoneToUnifiedView",
|
|
105
|
+
value: function formatRusPhoneToUnifiedView(value, moveCaret) {
|
|
106
|
+
var result = value;
|
|
107
|
+
if (value[0] === '8') {
|
|
108
|
+
result = "7".concat(value.slice(1));
|
|
109
|
+
if (moveCaret) {
|
|
110
|
+
// когда пользователь вводит номер с "9", мы подставляем в инпут "79", но каретка не переносится после "9" - также при вставке, нужно это делать вручную
|
|
111
|
+
moveCaret(this.getCaretPositionByRusValue(result));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (value.length === 10 && value[0] !== '7' && (value[0] !== '8' || this.isSupportCityRusPhoneNumber && value[0] === '8')) {
|
|
115
|
+
result = "7".concat(value);
|
|
116
|
+
if (moveCaret) {
|
|
117
|
+
moveCaret(this.getCaretPositionByRusValue(result));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (value[0] === '9') {
|
|
121
|
+
result = "79".concat(value.slice(1));
|
|
122
|
+
if (moveCaret) {
|
|
123
|
+
moveCaret(this.getCaretPositionByRusValue(result));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return result;
|
|
127
|
+
}
|
|
128
|
+
}, {
|
|
129
|
+
key: "getOnlyNumbersFromString",
|
|
130
|
+
value: function getOnlyNumbersFromString(value) {
|
|
131
|
+
var _value$match;
|
|
132
|
+
return ((_value$match = value.match(/\d/g)) === null || _value$match === void 0 ? void 0 : _value$match.join('')) || '';
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// хак для того чтобы сдвигать каретку в случае если при вводе "9" надо заменить на "79", каретка не двигается сама и остаётся между "7" и "9" без этой функции
|
|
136
|
+
}, {
|
|
137
|
+
key: "moveCaretByValue",
|
|
138
|
+
value: function moveCaretByValue(event) {
|
|
139
|
+
return function (positionCaret) {
|
|
140
|
+
setTimeout(function () {
|
|
141
|
+
if ('setSelectionRange' in event.target) {
|
|
142
|
+
event.target.setSelectionRange(positionCaret, positionCaret);
|
|
143
|
+
}
|
|
144
|
+
}, 0);
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
}, {
|
|
148
|
+
key: "getIsNeedChangeCountry",
|
|
149
|
+
value: function getIsNeedChangeCountry(inputValue, currentCountry, newCountry) {
|
|
150
|
+
return newCountry && currentCountry.startSubsequence !== newCountry[1].startSubsequence && inputValue && (newCountry[0] === UNKNOWN_COUNTRY_CODE ? !this.getIsHaveStartSequenceInString(inputValue, currentCountry.startSubsequence) : true);
|
|
151
|
+
}
|
|
152
|
+
}]);
|
|
153
|
+
}();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
export var CountrySelectWrapper = styled.div.withConfig({
|
|
3
|
+
displayName: "styles__CountrySelectWrapper",
|
|
4
|
+
componentId: "sc-pqm10s-0"
|
|
5
|
+
})(["padding-left:16px;width:100%;"]);
|
|
6
|
+
export var InputLabelContent = styled.div.withConfig({
|
|
7
|
+
displayName: "styles__InputLabelContent",
|
|
8
|
+
componentId: "sc-pqm10s-1"
|
|
9
|
+
})(["position:relative;"]);
|
|
10
|
+
export var InputLabelFloatWrapper = styled.div.withConfig({
|
|
11
|
+
displayName: "styles__InputLabelFloatWrapper",
|
|
12
|
+
componentId: "sc-pqm10s-2"
|
|
13
|
+
})(["position:absolute;height:100%;width:100%;pointer-events:none;display:flex;align-items:center;"]);
|