use-mask-input 3.10.0 → 3.10.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 (49) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/dist/antd.cjs +1 -65
  3. package/dist/antd.cjs.map +1 -1
  4. package/dist/antd.d.cts +12 -10
  5. package/dist/{antd.d.ts → antd.d.mts} +12 -10
  6. package/dist/antd.mjs +2 -0
  7. package/dist/antd.mjs.map +1 -0
  8. package/dist/index-BmKzoe0X.d.cts +836 -0
  9. package/dist/index-BmKzoe0X.d.mts +836 -0
  10. package/dist/index.cjs +1 -173
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +18 -15
  13. package/dist/{index.d.ts → index.d.mts} +18 -15
  14. package/dist/index.mjs +2 -0
  15. package/dist/index.mjs.map +1 -0
  16. package/dist/withMask-VWeBqi_u.cjs +2 -0
  17. package/dist/withMask-VWeBqi_u.cjs.map +1 -0
  18. package/dist/withMask-jrErtLYS.mjs +2 -0
  19. package/dist/withMask-jrErtLYS.mjs.map +1 -0
  20. package/package.json +42 -22
  21. package/src/api/withMask.ts +1 -1
  22. package/src/core/inputmask.ts +10 -0
  23. package/src/core/maskEngine.ts +2 -2
  24. package/src/utils/maskHelpers.ts +5 -3
  25. package/dist/antd.js +0 -63
  26. package/dist/antd.js.map +0 -1
  27. package/dist/chunk-DTC7JTZP.cjs +0 -3925
  28. package/dist/chunk-DTC7JTZP.cjs.map +0 -1
  29. package/dist/chunk-TVCNC3TP.js +0 -3915
  30. package/dist/chunk-TVCNC3TP.js.map +0 -1
  31. package/dist/index-D8KkaDbQ.d.cts +0 -596
  32. package/dist/index-D8KkaDbQ.d.ts +0 -596
  33. package/dist/index.js +0 -165
  34. package/dist/index.js.map +0 -1
  35. package/src/antd/useHookFormMaskAntd.spec.ts +0 -181
  36. package/src/antd/useMaskInputAntd-server.spec.tsx +0 -37
  37. package/src/antd/useMaskInputAntd.spec.tsx +0 -131
  38. package/src/api/useHookFormMask.spec.ts +0 -259
  39. package/src/api/useMaskInput-server.spec.tsx +0 -30
  40. package/src/api/useMaskInput.spec.tsx +0 -238
  41. package/src/api/withHookFormMask.spec.ts +0 -179
  42. package/src/api/withMask.spec.ts +0 -137
  43. package/src/api/withTanStackFormMask.spec.ts +0 -76
  44. package/src/core/elementResolver.spec.ts +0 -175
  45. package/src/core/maskConfig.spec.ts +0 -208
  46. package/src/core/maskEngine.spec.ts +0 -114
  47. package/src/utils/flow.spec.ts +0 -57
  48. package/src/utils/isServer.spec.ts +0 -15
  49. package/src/utils/moduleInterop.spec.ts +0 -37
@@ -1,57 +0,0 @@
1
- import {
2
- describe, expect, it,
3
- } from 'vitest';
4
-
5
- import flow from './flow';
6
-
7
- describe('flow', () => {
8
- it('returns a function', () => {
9
- const result = flow();
10
- expect(typeof result).toBe('function');
11
- });
12
-
13
- it('returns undefined value if no return function provided', () => {
14
- const result = flow(() => { });
15
- expect(result(42)).toBe(undefined);
16
- });
17
-
18
- it('throws an error if any argument is not a function', () => {
19
- // @ts-expect-error - null is not a function
20
- expect(() => flow(null)).toThrow(TypeError);
21
- // @ts-expect-error - null is not a function
22
- expect(() => flow(() => { }, null)).toThrow(TypeError);
23
- expect(() => {
24
- flow(1 as unknown as () => void, () => { });
25
- }).toThrow(TypeError);
26
- });
27
-
28
- it('returns the original value if no functions are provided', () => {
29
- const result = flow();
30
- expect(result(42)).toBe(42);
31
- expect(result('test')).toBe('test');
32
- });
33
-
34
- it('composes functions correctly', () => {
35
- const addOne = (x: number) => x + 1;
36
- const multiplyByTwo = (x: number) => x * 2;
37
- const subtractThree = (x: number) => x - 3;
38
-
39
- const composed = flow(addOne, multiplyByTwo, subtractThree);
40
- expect(composed(5)).toBe(9); // (5 + 1) * 2 - 3 = 9
41
- });
42
-
43
- it('works with single function', () => {
44
- const double = (x: number) => x * 2;
45
- const fn = flow(double);
46
- expect(fn(5)).toBe(10);
47
- });
48
-
49
- it('works with multiple functions', () => {
50
- const fn1 = (n: number) => n + 1;
51
- const fn2 = (n: number) => n * 2;
52
- const fn3 = (n: number) => n - 1;
53
-
54
- const composed = flow(fn1, fn2, fn3);
55
- expect(composed(5)).toBe(11); // ((5 + 1) * 2) - 1 = 11
56
- });
57
- });
@@ -1,15 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- describe('isServer', () => {
4
- it('returns boolean value', async () => {
5
- const { default: isServer } = await import('./isServer');
6
- expect(typeof isServer).toBe('boolean');
7
- });
8
-
9
- it('returns false in browser environment', async () => {
10
- // in jsdom environment, window and document exist
11
- const { default: isServer } = await import('./isServer');
12
- // in test environment with jsdom, it should be false
13
- expect(isServer).toBe(false);
14
- });
15
- });
@@ -1,37 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- import interopDefaultSync from './moduleInterop';
4
-
5
- describe('interopDefaultSync', () => {
6
- it('returns module with default export', () => {
7
- const module = { default: 'test' };
8
- expect(interopDefaultSync(module)).toBe('test');
9
- });
10
-
11
- it('returns module without default export', () => {
12
- const module = { foo: 'bar' };
13
- expect(interopDefaultSync(module)).toBe(module);
14
- });
15
-
16
- it('returns non-object values as-is', () => {
17
- expect(interopDefaultSync('string')).toBe('string');
18
- expect(interopDefaultSync(123)).toBe(123);
19
- expect(interopDefaultSync(null)).toBe(null);
20
- // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
21
- expect(interopDefaultSync(undefined)).toBe(undefined);
22
- });
23
-
24
- it('handles null module', () => {
25
- expect(interopDefaultSync(null)).toBe(null);
26
- });
27
-
28
- it('handles module with null default', () => {
29
- const module = { default: null };
30
- expect(interopDefaultSync(module)).toBe(null);
31
- });
32
-
33
- it('handles module with undefined default', () => {
34
- const module = { default: undefined };
35
- expect(interopDefaultSync(module)).toBe(undefined);
36
- });
37
- });