@alfalab/core-components-intl-phone-input 6.4.0 → 6.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/{component-7d88f33a.d.ts → component-fbf58e08.d.ts} +0 -0
  3. package/dist/{component-7d88f33a.js → component-fbf58e08.js} +1 -1
  4. package/dist/component.d.ts +9 -0
  5. package/dist/component.js +133 -64
  6. package/dist/components/flag-icon/component.js +1 -1
  7. package/dist/components/flag-icon/index.css +261 -261
  8. package/dist/components/index.js +1 -1
  9. package/dist/components/select/component.js +2 -2
  10. package/dist/components/select/index.css +6 -6
  11. package/dist/components/select/index.js +1 -1
  12. package/dist/components/select-field/component.js +1 -1
  13. package/dist/components/select-field/index.css +8 -8
  14. package/dist/components/select-field/index.d.ts +1 -1
  15. package/dist/components/select-field/index.js +1 -1
  16. package/dist/cssm/component.d.ts +9 -0
  17. package/dist/cssm/component.js +131 -62
  18. package/dist/cssm/index.js +1 -1
  19. package/dist/cssm/{libphonenumber-js.min-d3a9d490.d.ts → libphonenumber-js.min-903db150.d.ts} +0 -0
  20. package/dist/cssm/libphonenumber-js.min-903db150.js +2227 -0
  21. package/dist/cssm/useCaretAvoidCountryCode.js +24 -20
  22. package/dist/cssm/utils/calculateCaretPos.d.ts +7 -0
  23. package/dist/cssm/utils/calculateCaretPos.js +27 -0
  24. package/dist/esm/{component-32da0c87.d.ts → component-25b3eb47.d.ts} +0 -0
  25. package/dist/esm/{component-32da0c87.js → component-25b3eb47.js} +1 -1
  26. package/dist/esm/component.d.ts +9 -0
  27. package/dist/esm/component.js +134 -65
  28. package/dist/esm/components/flag-icon/component.js +1 -1
  29. package/dist/esm/components/flag-icon/index.css +261 -261
  30. package/dist/esm/components/index.js +1 -1
  31. package/dist/esm/components/select/component.js +2 -2
  32. package/dist/esm/components/select/index.css +6 -6
  33. package/dist/esm/components/select/index.js +1 -1
  34. package/dist/esm/components/select-field/component.js +1 -1
  35. package/dist/esm/components/select-field/index.css +8 -8
  36. package/dist/esm/components/select-field/index.d.ts +1 -1
  37. package/dist/esm/components/select-field/index.js +1 -1
  38. package/dist/esm/index.css +3 -3
  39. package/dist/esm/index.js +2 -2
  40. package/dist/esm/{libphonenumber-js.min-c49027d7.d.ts → libphonenumber-js.min-24f2609b.d.ts} +0 -0
  41. package/dist/esm/libphonenumber-js.min-24f2609b.js +2225 -0
  42. package/dist/esm/useCaretAvoidCountryCode.js +25 -21
  43. package/dist/esm/utils/calculateCaretPos.d.ts +7 -0
  44. package/dist/esm/utils/calculateCaretPos.js +23 -0
  45. package/dist/index.css +3 -3
  46. package/dist/index.js +2 -2
  47. package/dist/{libphonenumber-js.min-13d3dc00.d.ts → libphonenumber-js.min-6d8f77f6.d.ts} +0 -0
  48. package/dist/libphonenumber-js.min-6d8f77f6.js +2227 -0
  49. package/dist/modern/component.d.ts +9 -0
  50. package/dist/modern/component.js +131 -61
  51. package/dist/modern/components/flag-icon/component.js +1 -1
  52. package/dist/modern/components/flag-icon/index.css +261 -261
  53. package/dist/modern/components/select/component.js +1 -1
  54. package/dist/modern/components/select/index.css +6 -6
  55. package/dist/modern/components/select-field/component.js +1 -1
  56. package/dist/modern/components/select-field/index.css +8 -8
  57. package/dist/modern/index.css +3 -3
  58. package/dist/modern/index.js +1 -1
  59. package/dist/modern/{libphonenumber-js.min-c49027d7.d.ts → libphonenumber-js.min-24f2609b.d.ts} +0 -0
  60. package/dist/modern/libphonenumber-js.min-24f2609b.js +2225 -0
  61. package/dist/modern/useCaretAvoidCountryCode.js +25 -21
  62. package/dist/modern/utils/calculateCaretPos.d.ts +7 -0
  63. package/dist/modern/utils/calculateCaretPos.js +23 -0
  64. package/dist/useCaretAvoidCountryCode.js +24 -20
  65. package/dist/utils/calculateCaretPos.d.ts +7 -0
  66. package/dist/utils/calculateCaretPos.js +27 -0
  67. package/package.json +6 -6
  68. package/dist/cssm/libphonenumber-js.min-d3a9d490.js +0 -1569
  69. package/dist/cssm/usePreventCaretReset.d.ts +0 -8
  70. package/dist/cssm/usePreventCaretReset.js +0 -36
  71. package/dist/esm/libphonenumber-js.min-c49027d7.js +0 -1567
  72. package/dist/esm/usePreventCaretReset.d.ts +0 -8
  73. package/dist/esm/usePreventCaretReset.js +0 -32
  74. package/dist/libphonenumber-js.min-13d3dc00.js +0 -1569
  75. package/dist/modern/libphonenumber-js.min-c49027d7.js +0 -1567
  76. package/dist/modern/usePreventCaretReset.d.ts +0 -8
  77. package/dist/modern/usePreventCaretReset.js +0 -31
  78. package/dist/usePreventCaretReset.d.ts +0 -8
  79. package/dist/usePreventCaretReset.js +0 -36
@@ -1,8 +0,0 @@
1
- import { RefObject } from 'react';
2
- type Args = {
3
- inputRef: RefObject<HTMLInputElement>;
4
- countryCodeLength: number;
5
- clearableCountryCode: boolean;
6
- };
7
- declare function usePreventCaretReset({ inputRef, clearableCountryCode, countryCodeLength }: Args): void;
8
- export { usePreventCaretReset };
@@ -1,31 +0,0 @@
1
- import { useCallback, useEffect } from 'react';
2
-
3
- function usePreventCaretReset({ inputRef, clearableCountryCode, countryCodeLength }) {
4
- const handleDeleteChar = useCallback((event) => {
5
- const input = event.target;
6
- const caretPosition = input.selectionStart;
7
- if (event.key !== 'Backspace' || !caretPosition)
8
- return;
9
- if (!clearableCountryCode && caretPosition <= countryCodeLength) {
10
- event.preventDefault();
11
- return;
12
- }
13
- const newPosition = caretPosition - 1;
14
- requestAnimationFrame(() => {
15
- input.setSelectionRange(newPosition, newPosition);
16
- });
17
- }, [clearableCountryCode, countryCodeLength]);
18
- useEffect(() => {
19
- const input = inputRef.current;
20
- if (!input)
21
- return;
22
- input.addEventListener('keydown', handleDeleteChar);
23
- // eslint-disable-next-line consistent-return
24
- return () => {
25
- input.removeEventListener('keydown', handleDeleteChar);
26
- };
27
- // eslint-disable-next-line react-hooks/exhaustive-deps
28
- }, [handleDeleteChar]);
29
- }
30
-
31
- export { usePreventCaretReset };
@@ -1,8 +0,0 @@
1
- import { RefObject } from 'react';
2
- type Args = {
3
- inputRef: RefObject<HTMLInputElement>;
4
- countryCodeLength: number;
5
- clearableCountryCode: boolean;
6
- };
7
- declare function usePreventCaretReset({ inputRef, clearableCountryCode, countryCodeLength }: Args): void;
8
- export { usePreventCaretReset };
@@ -1,36 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
-
7
- function usePreventCaretReset(_a) {
8
- var inputRef = _a.inputRef, clearableCountryCode = _a.clearableCountryCode, countryCodeLength = _a.countryCodeLength;
9
- var handleDeleteChar = React.useCallback(function (event) {
10
- var input = event.target;
11
- var caretPosition = input.selectionStart;
12
- if (event.key !== 'Backspace' || !caretPosition)
13
- return;
14
- if (!clearableCountryCode && caretPosition <= countryCodeLength) {
15
- event.preventDefault();
16
- return;
17
- }
18
- var newPosition = caretPosition - 1;
19
- requestAnimationFrame(function () {
20
- input.setSelectionRange(newPosition, newPosition);
21
- });
22
- }, [clearableCountryCode, countryCodeLength]);
23
- React.useEffect(function () {
24
- var input = inputRef.current;
25
- if (!input)
26
- return;
27
- input.addEventListener('keydown', handleDeleteChar);
28
- // eslint-disable-next-line consistent-return
29
- return function () {
30
- input.removeEventListener('keydown', handleDeleteChar);
31
- };
32
- // eslint-disable-next-line react-hooks/exhaustive-deps
33
- }, [handleDeleteChar]);
34
- }
35
-
36
- exports.usePreventCaretReset = usePreventCaretReset;