@alfalab/core-components-time-input 2.2.55-snapshot-f57d3d0 → 2.2.55

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 (61) hide show
  1. package/Component.d.ts +24 -4
  2. package/Component.js +4 -5
  3. package/cssm/Component.d.ts +24 -4
  4. package/cssm/Component.js +6 -7
  5. package/cssm/index.d.ts +2 -2
  6. package/cssm/index.js +2 -3
  7. package/cssm/utils/format.d.ts +6 -5
  8. package/cssm/utils/format.js +0 -1
  9. package/cssm/utils/index.d.ts +1 -1
  10. package/cssm/utils/index.js +6 -7
  11. package/esm/Component.d.ts +24 -4
  12. package/esm/Component.js +0 -1
  13. package/esm/index.d.ts +2 -2
  14. package/esm/index.js +0 -1
  15. package/esm/utils/format.d.ts +6 -5
  16. package/esm/utils/format.js +0 -1
  17. package/esm/utils/index.d.ts +1 -1
  18. package/esm/utils/index.js +0 -1
  19. package/index.d.ts +2 -2
  20. package/index.js +2 -3
  21. package/modern/Component.d.ts +24 -4
  22. package/modern/Component.js +0 -1
  23. package/modern/index.d.ts +2 -2
  24. package/modern/index.js +0 -1
  25. package/modern/utils/format.d.ts +6 -5
  26. package/modern/utils/format.js +0 -1
  27. package/modern/utils/index.d.ts +1 -1
  28. package/modern/utils/index.js +0 -1
  29. package/moderncssm/Component.d.ts +24 -4
  30. package/moderncssm/Component.js +0 -1
  31. package/moderncssm/index.d.ts +2 -2
  32. package/moderncssm/index.js +0 -1
  33. package/moderncssm/utils/format.d.ts +6 -5
  34. package/moderncssm/utils/format.js +0 -1
  35. package/moderncssm/utils/index.d.ts +1 -1
  36. package/moderncssm/utils/index.js +0 -1
  37. package/package.json +4 -4
  38. package/utils/format.d.ts +6 -5
  39. package/utils/format.js +0 -1
  40. package/utils/index.d.ts +1 -1
  41. package/utils/index.js +6 -7
  42. package/Component.js.map +0 -1
  43. package/cssm/Component.js.map +0 -1
  44. package/cssm/index.js.map +0 -1
  45. package/cssm/utils/format.js.map +0 -1
  46. package/cssm/utils/index.js.map +0 -1
  47. package/esm/Component.js.map +0 -1
  48. package/esm/index.js.map +0 -1
  49. package/esm/utils/format.js.map +0 -1
  50. package/esm/utils/index.js.map +0 -1
  51. package/index.js.map +0 -1
  52. package/modern/Component.js.map +0 -1
  53. package/modern/index.js.map +0 -1
  54. package/modern/utils/format.js.map +0 -1
  55. package/modern/utils/index.js.map +0 -1
  56. package/moderncssm/Component.js.map +0 -1
  57. package/moderncssm/index.js.map +0 -1
  58. package/moderncssm/utils/format.js.map +0 -1
  59. package/moderncssm/utils/index.js.map +0 -1
  60. package/utils/format.js.map +0 -1
  61. package/utils/index.js.map +0 -1
package/Component.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- import React, { ChangeEvent } from 'react';
2
- import { InputProps } from '@alfalab/core-components-input';
3
- export declare type TimeInputProps = Omit<InputProps, 'onChange'> & {
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { ChangeEvent } from "react";
4
+ import { InputProps } from "@alfalab/core-components-input";
5
+ type TimeInputProps = Omit<InputProps, 'onChange'> & {
4
6
  /**
5
7
  * Обработчик изменения значения
6
8
  */
@@ -22,4 +24,22 @@ export declare type TimeInputProps = Omit<InputProps, 'onChange'> & {
22
24
  * @deprecated
23
25
  * use UniversalDateInput instead
24
26
  */
25
- export declare const TimeInput: React.ForwardRefExoticComponent<Omit<TimeInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
27
+ declare const TimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "onChange"> & {
28
+ /**
29
+ * Обработчик изменения значения
30
+ */
31
+ onChange?: ((event: ChangeEvent<HTMLInputElement>, payload: {
32
+ hours: number;
33
+ mins: number;
34
+ value: string;
35
+ }) => void) | undefined;
36
+ /**
37
+ * Обработчик окончания ввода
38
+ */
39
+ onComplete?: ((event: ChangeEvent<HTMLInputElement>, payload: {
40
+ hours: number;
41
+ mins: number;
42
+ value: string;
43
+ }) => void) | undefined;
44
+ } & React.RefAttributes<HTMLInputElement>>;
45
+ export { TimeInputProps, TimeInput };
package/Component.js CHANGED
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var tslib = require('tslib');
6
6
  var React = require('react');
7
7
  var coreComponentsInput = require('@alfalab/core-components-input');
8
- var format = require('./utils/format.js');
8
+ var utils_format = require('./utils/format.js');
9
9
 
10
10
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
11
11
 
@@ -32,15 +32,15 @@ var TimeInput = React__default.default.forwardRef(function (_a, ref) {
32
32
  if (colon && colon.length > 1) {
33
33
  return;
34
34
  }
35
- var formattedValue = format.format(newValue);
35
+ var formattedValue = utils_format.format(newValue);
36
36
  var formattedValueArr = formattedValue.split(':');
37
37
  var hours = Number(formattedValueArr[0]);
38
38
  var mins = Number(formattedValueArr[1]);
39
39
  setValue(formattedValue);
40
40
  if (onChange)
41
41
  onChange(event, { hours: hours, mins: mins, value: formattedValue });
42
- if (format.isCompleteTimeInput(formattedValue)) {
43
- var valid = formattedValue.length > 0 && format.isValidInputValue(formattedValue);
42
+ if (utils_format.isCompleteTimeInput(formattedValue)) {
43
+ var valid = formattedValue.length > 0 && utils_format.isValidInputValue(formattedValue);
44
44
  if (!valid)
45
45
  return;
46
46
  if (onComplete) {
@@ -55,4 +55,3 @@ var TimeInput = React__default.default.forwardRef(function (_a, ref) {
55
55
  });
56
56
 
57
57
  exports.TimeInput = TimeInput;
58
- //# sourceMappingURL=Component.js.map
@@ -1,6 +1,8 @@
1
- import React, { ChangeEvent } from 'react';
2
- import { InputProps } from '@alfalab/core-components-input';
3
- export declare type TimeInputProps = Omit<InputProps, 'onChange'> & {
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { ChangeEvent } from "react";
4
+ import { InputProps } from "@alfalab/core-components-input";
5
+ type TimeInputProps = Omit<InputProps, 'onChange'> & {
4
6
  /**
5
7
  * Обработчик изменения значения
6
8
  */
@@ -22,4 +24,22 @@ export declare type TimeInputProps = Omit<InputProps, 'onChange'> & {
22
24
  * @deprecated
23
25
  * use UniversalDateInput instead
24
26
  */
25
- export declare const TimeInput: React.ForwardRefExoticComponent<Omit<TimeInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
27
+ declare const TimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "onChange"> & {
28
+ /**
29
+ * Обработчик изменения значения
30
+ */
31
+ onChange?: ((event: ChangeEvent<HTMLInputElement>, payload: {
32
+ hours: number;
33
+ mins: number;
34
+ value: string;
35
+ }) => void) | undefined;
36
+ /**
37
+ * Обработчик окончания ввода
38
+ */
39
+ onComplete?: ((event: ChangeEvent<HTMLInputElement>, payload: {
40
+ hours: number;
41
+ mins: number;
42
+ value: string;
43
+ }) => void) | undefined;
44
+ } & React.RefAttributes<HTMLInputElement>>;
45
+ export { TimeInputProps, TimeInput };
package/cssm/Component.js CHANGED
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib = require('tslib');
6
6
  var React = require('react');
7
- var cssm = require('@alfalab/core-components-input/cssm');
8
- var format = require('./utils/format.js');
7
+ var coreComponentsInput = require('@alfalab/core-components-input/cssm');
8
+ var utils_format = require('./utils/format.js');
9
9
 
10
10
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
11
11
 
@@ -32,15 +32,15 @@ var TimeInput = React__default.default.forwardRef(function (_a, ref) {
32
32
  if (colon && colon.length > 1) {
33
33
  return;
34
34
  }
35
- var formattedValue = format.format(newValue);
35
+ var formattedValue = utils_format.format(newValue);
36
36
  var formattedValueArr = formattedValue.split(':');
37
37
  var hours = Number(formattedValueArr[0]);
38
38
  var mins = Number(formattedValueArr[1]);
39
39
  setValue(formattedValue);
40
40
  if (onChange)
41
41
  onChange(event, { hours: hours, mins: mins, value: formattedValue });
42
- if (format.isCompleteTimeInput(formattedValue)) {
43
- var valid = formattedValue.length > 0 && format.isValidInputValue(formattedValue);
42
+ if (utils_format.isCompleteTimeInput(formattedValue)) {
43
+ var valid = formattedValue.length > 0 && utils_format.isValidInputValue(formattedValue);
44
44
  if (!valid)
45
45
  return;
46
46
  if (onComplete) {
@@ -51,8 +51,7 @@ var TimeInput = React__default.default.forwardRef(function (_a, ref) {
51
51
  var handleClearClick = function () {
52
52
  setValue('');
53
53
  };
54
- return (React__default.default.createElement(cssm.Input, tslib.__assign({}, restProps, { ref: ref, value: value, className: className, onChange: handleChange, onClear: handleClearClick })));
54
+ return (React__default.default.createElement(coreComponentsInput.Input, tslib.__assign({}, restProps, { ref: ref, value: value, className: className, onChange: handleChange, onClear: handleClearClick })));
55
55
  });
56
56
 
57
57
  exports.TimeInput = TimeInput;
58
- //# sourceMappingURL=Component.js.map
package/cssm/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './Component';
2
- export { isValidInputValue } from './utils';
1
+ export * from "./Component";
2
+ export { isValidInputValue } from "./utils/index";
package/cssm/index.js CHANGED
@@ -3,10 +3,9 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var Component = require('./Component.js');
6
- var format = require('./utils/format.js');
6
+ var utils_format = require('./utils/format.js');
7
7
 
8
8
 
9
9
 
10
10
  exports.TimeInput = Component.TimeInput;
11
- exports.isValidInputValue = format.isValidInputValue;
12
- //# sourceMappingURL=index.js.map
11
+ exports.isValidInputValue = utils_format.isValidInputValue;
@@ -1,5 +1,6 @@
1
- export declare const DATE_MASK: (string | RegExp)[];
2
- export declare const isCompleteTimeInput: (input: string) => boolean;
3
- export declare const isValidTimeFormat: (value: string) => boolean;
4
- export declare const isValidInputValue: (inputValue?: string) => boolean;
5
- export declare const format: (value: string) => string;
1
+ declare const DATE_MASK: (string | RegExp)[];
2
+ declare const isCompleteTimeInput: (input: string) => boolean;
3
+ declare const isValidTimeFormat: (value: string) => boolean;
4
+ declare const isValidInputValue: (inputValue?: string) => boolean;
5
+ declare const format: (value: string) => string;
6
+ export { DATE_MASK, isCompleteTimeInput, isValidTimeFormat, isValidInputValue, format };
@@ -33,4 +33,3 @@ exports.format = format;
33
33
  exports.isCompleteTimeInput = isCompleteTimeInput;
34
34
  exports.isValidInputValue = isValidInputValue;
35
35
  exports.isValidTimeFormat = isValidTimeFormat;
36
- //# sourceMappingURL=format.js.map
@@ -1 +1 @@
1
- export * from './format';
1
+ export * from "./format";
@@ -2,13 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var format = require('./format.js');
5
+ var utils_format = require('./format.js');
6
6
 
7
7
 
8
8
 
9
- exports.DATE_MASK = format.DATE_MASK;
10
- exports.format = format.format;
11
- exports.isCompleteTimeInput = format.isCompleteTimeInput;
12
- exports.isValidInputValue = format.isValidInputValue;
13
- exports.isValidTimeFormat = format.isValidTimeFormat;
14
- //# sourceMappingURL=index.js.map
9
+ exports.DATE_MASK = utils_format.DATE_MASK;
10
+ exports.format = utils_format.format;
11
+ exports.isCompleteTimeInput = utils_format.isCompleteTimeInput;
12
+ exports.isValidInputValue = utils_format.isValidInputValue;
13
+ exports.isValidTimeFormat = utils_format.isValidTimeFormat;
@@ -1,6 +1,8 @@
1
- import React, { ChangeEvent } from 'react';
2
- import { InputProps } from '@alfalab/core-components-input';
3
- export declare type TimeInputProps = Omit<InputProps, 'onChange'> & {
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { ChangeEvent } from "react";
4
+ import { InputProps } from "@alfalab/core-components-input";
5
+ type TimeInputProps = Omit<InputProps, 'onChange'> & {
4
6
  /**
5
7
  * Обработчик изменения значения
6
8
  */
@@ -22,4 +24,22 @@ export declare type TimeInputProps = Omit<InputProps, 'onChange'> & {
22
24
  * @deprecated
23
25
  * use UniversalDateInput instead
24
26
  */
25
- export declare const TimeInput: React.ForwardRefExoticComponent<Omit<TimeInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
27
+ declare const TimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "onChange"> & {
28
+ /**
29
+ * Обработчик изменения значения
30
+ */
31
+ onChange?: ((event: ChangeEvent<HTMLInputElement>, payload: {
32
+ hours: number;
33
+ mins: number;
34
+ value: string;
35
+ }) => void) | undefined;
36
+ /**
37
+ * Обработчик окончания ввода
38
+ */
39
+ onComplete?: ((event: ChangeEvent<HTMLInputElement>, payload: {
40
+ hours: number;
41
+ mins: number;
42
+ value: string;
43
+ }) => void) | undefined;
44
+ } & React.RefAttributes<HTMLInputElement>>;
45
+ export { TimeInputProps, TimeInput };
package/esm/Component.js CHANGED
@@ -47,4 +47,3 @@ var TimeInput = React.forwardRef(function (_a, ref) {
47
47
  });
48
48
 
49
49
  export { TimeInput };
50
- //# sourceMappingURL=Component.js.map
package/esm/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './Component';
2
- export { isValidInputValue } from './utils';
1
+ export * from "./Component";
2
+ export { isValidInputValue } from "./utils/index";
package/esm/index.js CHANGED
@@ -1,3 +1,2 @@
1
1
  export { TimeInput } from './Component.js';
2
2
  export { isValidInputValue } from './utils/format.js';
3
- //# sourceMappingURL=index.js.map
@@ -1,5 +1,6 @@
1
- export declare const DATE_MASK: (string | RegExp)[];
2
- export declare const isCompleteTimeInput: (input: string) => boolean;
3
- export declare const isValidTimeFormat: (value: string) => boolean;
4
- export declare const isValidInputValue: (inputValue?: string) => boolean;
5
- export declare const format: (value: string) => string;
1
+ declare const DATE_MASK: (string | RegExp)[];
2
+ declare const isCompleteTimeInput: (input: string) => boolean;
3
+ declare const isValidTimeFormat: (value: string) => boolean;
4
+ declare const isValidInputValue: (inputValue?: string) => boolean;
5
+ declare const format: (value: string) => string;
6
+ export { DATE_MASK, isCompleteTimeInput, isValidTimeFormat, isValidInputValue, format };
@@ -25,4 +25,3 @@ var format = function (value) {
25
25
  }; // 12: => 12 || : => void
26
26
 
27
27
  export { DATE_MASK, format, isCompleteTimeInput, isValidInputValue, isValidTimeFormat };
28
- //# sourceMappingURL=format.js.map
@@ -1 +1 @@
1
- export * from './format';
1
+ export * from "./format";
@@ -1,2 +1 @@
1
1
  export { DATE_MASK, format, isCompleteTimeInput, isValidInputValue, isValidTimeFormat } from './format.js';
2
- //# sourceMappingURL=index.js.map
package/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './Component';
2
- export { isValidInputValue } from './utils';
1
+ export * from "./Component";
2
+ export { isValidInputValue } from "./utils/index";
package/index.js CHANGED
@@ -3,10 +3,9 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var Component = require('./Component.js');
6
- var format = require('./utils/format.js');
6
+ var utils_format = require('./utils/format.js');
7
7
 
8
8
 
9
9
 
10
10
  exports.TimeInput = Component.TimeInput;
11
- exports.isValidInputValue = format.isValidInputValue;
12
- //# sourceMappingURL=index.js.map
11
+ exports.isValidInputValue = utils_format.isValidInputValue;
@@ -1,6 +1,8 @@
1
- import React, { ChangeEvent } from 'react';
2
- import { InputProps } from '@alfalab/core-components-input';
3
- export declare type TimeInputProps = Omit<InputProps, 'onChange'> & {
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { ChangeEvent } from "react";
4
+ import { InputProps } from "@alfalab/core-components-input";
5
+ type TimeInputProps = Omit<InputProps, 'onChange'> & {
4
6
  /**
5
7
  * Обработчик изменения значения
6
8
  */
@@ -22,4 +24,22 @@ export declare type TimeInputProps = Omit<InputProps, 'onChange'> & {
22
24
  * @deprecated
23
25
  * use UniversalDateInput instead
24
26
  */
25
- export declare const TimeInput: React.ForwardRefExoticComponent<Omit<TimeInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
27
+ declare const TimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "onChange"> & {
28
+ /**
29
+ * Обработчик изменения значения
30
+ */
31
+ onChange?: ((event: ChangeEvent<HTMLInputElement>, payload: {
32
+ hours: number;
33
+ mins: number;
34
+ value: string;
35
+ }) => void) | undefined;
36
+ /**
37
+ * Обработчик окончания ввода
38
+ */
39
+ onComplete?: ((event: ChangeEvent<HTMLInputElement>, payload: {
40
+ hours: number;
41
+ mins: number;
42
+ value: string;
43
+ }) => void) | undefined;
44
+ } & React.RefAttributes<HTMLInputElement>>;
45
+ export { TimeInputProps, TimeInput };
@@ -45,4 +45,3 @@ const TimeInput = React.forwardRef(({ defaultValue = '', value: propValue, onCha
45
45
  });
46
46
 
47
47
  export { TimeInput };
48
- //# sourceMappingURL=Component.js.map
package/modern/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './Component';
2
- export { isValidInputValue } from './utils';
1
+ export * from "./Component";
2
+ export { isValidInputValue } from "./utils/index";
package/modern/index.js CHANGED
@@ -1,3 +1,2 @@
1
1
  export { TimeInput } from './Component.js';
2
2
  export { isValidInputValue } from './utils/format.js';
3
- //# sourceMappingURL=index.js.map
@@ -1,5 +1,6 @@
1
- export declare const DATE_MASK: (string | RegExp)[];
2
- export declare const isCompleteTimeInput: (input: string) => boolean;
3
- export declare const isValidTimeFormat: (value: string) => boolean;
4
- export declare const isValidInputValue: (inputValue?: string) => boolean;
5
- export declare const format: (value: string) => string;
1
+ declare const DATE_MASK: (string | RegExp)[];
2
+ declare const isCompleteTimeInput: (input: string) => boolean;
3
+ declare const isValidTimeFormat: (value: string) => boolean;
4
+ declare const isValidInputValue: (inputValue?: string) => boolean;
5
+ declare const format: (value: string) => string;
6
+ export { DATE_MASK, isCompleteTimeInput, isValidTimeFormat, isValidInputValue, format };
@@ -21,4 +21,3 @@ const format = (value) => value
21
21
  .replace(/\:$/, ''); // 12: => 12 || : => void
22
22
 
23
23
  export { DATE_MASK, format, isCompleteTimeInput, isValidInputValue, isValidTimeFormat };
24
- //# sourceMappingURL=format.js.map
@@ -1 +1 @@
1
- export * from './format';
1
+ export * from "./format";
@@ -1,2 +1 @@
1
1
  export { DATE_MASK, format, isCompleteTimeInput, isValidInputValue, isValidTimeFormat } from './format.js';
2
- //# sourceMappingURL=index.js.map
@@ -1,6 +1,8 @@
1
- import React, { ChangeEvent } from 'react';
2
- import { InputProps } from '@alfalab/core-components-input';
3
- export declare type TimeInputProps = Omit<InputProps, 'onChange'> & {
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { ChangeEvent } from "react";
4
+ import { InputProps } from "@alfalab/core-components-input";
5
+ type TimeInputProps = Omit<InputProps, 'onChange'> & {
4
6
  /**
5
7
  * Обработчик изменения значения
6
8
  */
@@ -22,4 +24,22 @@ export declare type TimeInputProps = Omit<InputProps, 'onChange'> & {
22
24
  * @deprecated
23
25
  * use UniversalDateInput instead
24
26
  */
25
- export declare const TimeInput: React.ForwardRefExoticComponent<Omit<TimeInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
27
+ declare const TimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "onChange"> & {
28
+ /**
29
+ * Обработчик изменения значения
30
+ */
31
+ onChange?: ((event: ChangeEvent<HTMLInputElement>, payload: {
32
+ hours: number;
33
+ mins: number;
34
+ value: string;
35
+ }) => void) | undefined;
36
+ /**
37
+ * Обработчик окончания ввода
38
+ */
39
+ onComplete?: ((event: ChangeEvent<HTMLInputElement>, payload: {
40
+ hours: number;
41
+ mins: number;
42
+ value: string;
43
+ }) => void) | undefined;
44
+ } & React.RefAttributes<HTMLInputElement>>;
45
+ export { TimeInputProps, TimeInput };
@@ -45,4 +45,3 @@ const TimeInput = React.forwardRef(({ defaultValue = '', value: propValue, onCha
45
45
  });
46
46
 
47
47
  export { TimeInput };
48
- //# sourceMappingURL=Component.js.map
@@ -1,2 +1,2 @@
1
- export * from './Component';
2
- export { isValidInputValue } from './utils';
1
+ export * from "./Component";
2
+ export { isValidInputValue } from "./utils/index";
@@ -1,3 +1,2 @@
1
1
  export { TimeInput } from './Component.js';
2
2
  export { isValidInputValue } from './utils/format.js';
3
- //# sourceMappingURL=index.js.map
@@ -1,5 +1,6 @@
1
- export declare const DATE_MASK: (string | RegExp)[];
2
- export declare const isCompleteTimeInput: (input: string) => boolean;
3
- export declare const isValidTimeFormat: (value: string) => boolean;
4
- export declare const isValidInputValue: (inputValue?: string) => boolean;
5
- export declare const format: (value: string) => string;
1
+ declare const DATE_MASK: (string | RegExp)[];
2
+ declare const isCompleteTimeInput: (input: string) => boolean;
3
+ declare const isValidTimeFormat: (value: string) => boolean;
4
+ declare const isValidInputValue: (inputValue?: string) => boolean;
5
+ declare const format: (value: string) => string;
6
+ export { DATE_MASK, isCompleteTimeInput, isValidTimeFormat, isValidInputValue, format };
@@ -21,4 +21,3 @@ const format = (value) => value
21
21
  .replace(/\:$/, ''); // 12: => 12 || : => void
22
22
 
23
23
  export { DATE_MASK, format, isCompleteTimeInput, isValidInputValue, isValidTimeFormat };
24
- //# sourceMappingURL=format.js.map
@@ -1 +1 @@
1
- export * from './format';
1
+ export * from "./format";
@@ -1,2 +1 @@
1
1
  export { DATE_MASK, format, isCompleteTimeInput, isValidInputValue, isValidTimeFormat } from './format.js';
2
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-time-input",
3
- "version": "2.2.55-snapshot-f57d3d0",
3
+ "version": "2.2.55",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -16,9 +16,9 @@
16
16
  "react-dom": "^16.9.0 || ^17.0.1 || ^18.0.0"
17
17
  },
18
18
  "dependencies": {
19
- "@alfalab/core-components-input": "15.5.5-snapshot-f57d3d0",
19
+ "@alfalab/core-components-input": "^15.5.5",
20
20
  "tslib": "^2.4.0"
21
21
  },
22
- "themesVersion": "14.0.0-snapshot-f57d3d0",
23
- "varsVersion": "9.20.1-snapshot-f57d3d0"
22
+ "themesVersion": "13.7.3",
23
+ "varsVersion": "9.20.0"
24
24
  }
package/utils/format.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- export declare const DATE_MASK: (string | RegExp)[];
2
- export declare const isCompleteTimeInput: (input: string) => boolean;
3
- export declare const isValidTimeFormat: (value: string) => boolean;
4
- export declare const isValidInputValue: (inputValue?: string) => boolean;
5
- export declare const format: (value: string) => string;
1
+ declare const DATE_MASK: (string | RegExp)[];
2
+ declare const isCompleteTimeInput: (input: string) => boolean;
3
+ declare const isValidTimeFormat: (value: string) => boolean;
4
+ declare const isValidInputValue: (inputValue?: string) => boolean;
5
+ declare const format: (value: string) => string;
6
+ export { DATE_MASK, isCompleteTimeInput, isValidTimeFormat, isValidInputValue, format };
package/utils/format.js CHANGED
@@ -33,4 +33,3 @@ exports.format = format;
33
33
  exports.isCompleteTimeInput = isCompleteTimeInput;
34
34
  exports.isValidInputValue = isValidInputValue;
35
35
  exports.isValidTimeFormat = isValidTimeFormat;
36
- //# sourceMappingURL=format.js.map
package/utils/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './format';
1
+ export * from "./format";
package/utils/index.js CHANGED
@@ -2,13 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var format = require('./format.js');
5
+ var utils_format = require('./format.js');
6
6
 
7
7
 
8
8
 
9
- exports.DATE_MASK = format.DATE_MASK;
10
- exports.format = format.format;
11
- exports.isCompleteTimeInput = format.isCompleteTimeInput;
12
- exports.isValidInputValue = format.isValidInputValue;
13
- exports.isValidTimeFormat = format.isValidTimeFormat;
14
- //# sourceMappingURL=index.js.map
9
+ exports.DATE_MASK = utils_format.DATE_MASK;
10
+ exports.format = utils_format.format;
11
+ exports.isCompleteTimeInput = utils_format.isCompleteTimeInput;
12
+ exports.isValidInputValue = utils_format.isValidInputValue;
13
+ exports.isValidTimeFormat = utils_format.isValidTimeFormat;
package/Component.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"Component.js","sources":["src/Component.tsx"],"sourcesContent":["/* eslint-disable no-useless-escape */\n\nimport React, { ChangeEvent, useState } from 'react';\n\nimport { Input, InputProps } from '@alfalab/core-components-input';\n\nimport { format, isCompleteTimeInput, isValidInputValue } from './utils';\n\nexport type TimeInputProps = Omit<InputProps, 'onChange'> & {\n /**\n * Обработчик изменения значения\n */\n onChange?: (\n event: ChangeEvent<HTMLInputElement>,\n payload: { hours: number; mins: number; value: string },\n ) => void;\n\n /**\n * Обработчик окончания ввода\n */\n onComplete?: (\n event: ChangeEvent<HTMLInputElement>,\n payload: { hours: number; mins: number; value: string },\n ) => void;\n};\n\n/**\n * @deprecated\n * use UniversalDateInput instead\n */\nexport const TimeInput = React.forwardRef<HTMLInputElement, TimeInputProps>(\n (\n { defaultValue = '', value: propValue, onChange, onComplete, className, ...restProps },\n ref,\n ) => {\n const [value, setValue] = useState(propValue || defaultValue);\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const { value: newValue } = event.target;\n\n if (newValue.length > 5) return;\n\n // Позволяем вводить только цифры и двоеточия\n if (/[^\\d:]/.test(newValue)) {\n return;\n }\n\n const colon = newValue.match(/\\:/g);\n\n // Не даем вводить больше, чем одно двоеточие\n if (colon && colon.length > 1) {\n return;\n }\n\n const formattedValue = format(newValue);\n\n const formattedValueArr = formattedValue.split(':');\n const hours = Number(formattedValueArr[0]);\n const mins = Number(formattedValueArr[1]);\n\n setValue(formattedValue);\n\n if (onChange) onChange(event, { hours, mins, value: formattedValue });\n\n if (isCompleteTimeInput(formattedValue)) {\n const valid = formattedValue.length > 0 && isValidInputValue(formattedValue);\n\n if (!valid) return;\n\n if (onComplete) {\n onComplete(event, { hours, mins, value: formattedValue });\n }\n }\n };\n\n const handleClearClick = () => {\n setValue('');\n };\n\n return (\n <Input\n {...restProps}\n ref={ref}\n value={value}\n className={className}\n onChange={handleChange}\n onClear={handleClearClick}\n />\n );\n },\n);\n"],"names":["React","__rest","useState","format","isCompleteTimeInput","isValidInputValue","Input","__assign"],"mappings":";;;;;;;;;;;;;AAAA;AA0BA;;;AAGG;AACU,IAAA,SAAS,GAAGA,sBAAK,CAAC,UAAU,CACrC,UACI,EAAsF,EACtF,GAAG,EAAA;IADD,IAAA,EAAA,GAAA,EAAA,CAAA,YAAiB,EAAjB,YAAY,GAAA,EAAA,KAAA,MAAA,GAAG,EAAE,GAAA,EAAA,EAAS,SAAS,GAAA,E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AAM,GAAG,CAAC,IAAIC,wBAAiB,CAAC,cAAc,CAAC;AAE5E,YAAA,IAAI,CAAC,KAAK;gBAAE;AAEZ,YAAA,IAAI,UAAU,EAAE;AACZ,gBAAA,UAAU,CAAC,KAAK,EAAE,EAAE,KAAK,EAAA,KAAA,EAAE,IAAI,EAAA,IAAA,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;AAC5D;AACJ;AACL,KAAC;AAED,IAAA,IAAM,gBAAgB,GAAG,YAAA;QACrB,QAAQ,CAAC,EAAE,CAAC;AAChB,KAAC;IAED,QACIL,sBAAC,CAAA,aAAA,CAAAM,yBAAK,EACEC,cAAA,CAAA,EAAA,EAAA,SAAS,EACb,EAAA,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,gBAAgB,EAC3B,CAAA,CAAA;AAEV,CAAC;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["/* eslint-disable no-useless-escape */\n\nimport React, { ChangeEvent, useState } from 'react';\n\nimport { Input, InputProps } from '@alfalab/core-components-input';\n\nimport { format, isCompleteTimeInput, isValidInputValue } from './utils';\n\nexport type TimeInputProps = Omit<InputProps, 'onChange'> & {\n /**\n * Обработчик изменения значения\n */\n onChange?: (\n event: ChangeEvent<HTMLInputElement>,\n payload: { hours: number; mins: number; value: string },\n ) => void;\n\n /**\n * Обработчик окончания ввода\n */\n onComplete?: (\n event: ChangeEvent<HTMLInputElement>,\n payload: { hours: number; mins: number; value: string },\n ) => void;\n};\n\n/**\n * @deprecated\n * use UniversalDateInput instead\n */\nexport const TimeInput = React.forwardRef<HTMLInputElement, TimeInputProps>(\n (\n { defaultValue = '', value: propValue, onChange, onComplete, className, ...restProps },\n ref,\n ) => {\n const [value, setValue] = useState(propValue || defaultValue);\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const { value: newValue } = event.target;\n\n if (newValue.length > 5) return;\n\n // Позволяем вводить только цифры и двоеточия\n if (/[^\\d:]/.test(newValue)) {\n return;\n }\n\n const colon = newValue.match(/\\:/g);\n\n // Не даем вводить больше, чем одно двоеточие\n if (colon && colon.length > 1) {\n return;\n }\n\n const formattedValue = format(newValue);\n\n const formattedValueArr = formattedValue.split(':');\n const hours = Number(formattedValueArr[0]);\n const mins = Number(formattedValueArr[1]);\n\n setValue(formattedValue);\n\n if (onChange) onChange(event, { hours, mins, value: formattedValue });\n\n if (isCompleteTimeInput(formattedValue)) {\n const valid = formattedValue.length > 0 && isValidInputValue(formattedValue);\n\n if (!valid) return;\n\n if (onComplete) {\n onComplete(event, { hours, mins, value: formattedValue });\n }\n }\n };\n\n const handleClearClick = () => {\n setValue('');\n };\n\n return (\n <Input\n {...restProps}\n ref={ref}\n value={value}\n className={className}\n onChange={handleChange}\n onClear={handleClearClick}\n />\n );\n },\n);\n"],"names":["React","__rest","useState","format","isCompleteTimeInput","isValidInputValue","Input","__assign"],"mappings":";;;;;;;;;;;;;AAAA;AA0BA;;;AAGG;AACU,IAAA,SAAS,GAAGA,sBAAK,CAAC,UAAU,CACrC,UACI,EAAsF,EACtF,GAAG,EAAA;IADD,IAAA,EAAA,GAAA,EAAA,CAAA,YAAiB,EAAjB,YAAY,GAAA,EAAA,KAAA,MAAA,GAAG,EAAE,GAAA,EAAA,EAAS,SAAS,GAAA,EAAA,CAAA,KAAA,EAAE,QAAQ,cAAA,EAAE,UAAU,gBAAA,EAAE,SAAS,eAAA,EAAK,SAAS,GAApFC,YAAA,CAAA,EAAA,EAAA,CAAA,cAAA,EAAA,OAAA,EAAA,UAAA,EAAA,YAAA,EAAA,WAAA,CAAsF,CAAF;AAG9E,IAAA,IAAA,EAAoB,GAAAC,cAAQ,CAAC,SAAS,IAAI,YAAY,CAAC,EAAtD,KAAK,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,QAAQ,QAAuC;IAE7D,IAAM,YAAY,GA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IAED,QACIL,sBAAC,CAAA,aAAA,CAAAM,UAAK,EACEC,cAAA,CAAA,EAAA,EAAA,SAAS,EACb,EAAA,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,gBAAgB,EAC3B,CAAA,CAAA;AAEV,CAAC;;;;"}
package/cssm/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"format.js","sources":["../../src/utils/format.ts"],"sourcesContent":["/* eslint-disable no-useless-escape */\n\nexport const DATE_MASK = [/\\d/, /\\d/, ':', /\\d/, /\\d/];\n\nexport const isCompleteTimeInput = (input: string) => input.length === DATE_MASK.length;\n\nexport const isValidTimeFormat = (value: string): boolean => {\n const timeArr = value.split(':');\n const hours = timeArr[0];\n const mins = timeArr[1];\n\n if (hours.length !== 2 || Number(hours) > 23) {\n return false;\n }\n\n if (mins.length !== 2 || Number(mins) > 59) {\n return false;\n }\n\n return true;\n};\n\nexport const isValidInputValue = (inputValue?: string) =>\n !inputValue || (isCompleteTimeInput(inputValue) && isValidTimeFormat(inputValue));\n\nexport const format = (value: string): string =>\n value\n .replace(/^(\\d\\d)(\\d)$/, '$1:$2') // 123 => 12:3\n .replace(/^(\\d\\d)(\\d\\d)/, '$1:$2') // 12345 => 12:45 (если вместо двоеточия введена цифра, она обратно заменяется на двоеточие)\n .replace(/^(\\d):(\\d\\d)(\\d)/, '$1:$2') // 1:234 => 1:23\n .replace(/\\:$/, ''); // 12: => 12 || : => void\n"],"names":[],"mappings":";;;;AAAA;AAEO,IAAM,SAAS,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI;AAExC,IAAA,mBAAmB,GAAG,UAAC,KAAa,EAAK,EAAA,OAAA,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,CAAA;AAEhF,IAAM,iBAAiB,GAAG,UAAC,KAAa,EAAA;IAC3C,IAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;AAChC,IAAA,IAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC;AACxB,IAAA,IAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;AAEvB,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE;AAC1C,QAAA,OAAO,KAAK;AACf;AAED,IAAA,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE;AACxC,QAAA,OAAO,KAAK;AACf;AAED,IAAA,OAAO,IAAI;AACf;AAEO,IAAM,iBAAiB,GAAG,UAAC,UAAmB,EAAA;AACjD,IAAA,OAAA,CAAC,UAAU,KAAK,mBAAmB,CAAC,UAAU,CAAC,IAAI,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAAjF;AAEG,IAAM,MAAM,GAAG,UAAC,KAAa,EAAA;AAChC,IAAA,OAAA;AACK,SAAA,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC;AAChC,SAAA,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC;AACjC,SAAA,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC;AACpC,SAAA,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;AAJvB,EAIwB;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["/* eslint-disable no-useless-escape */\n\nimport React, { ChangeEvent, useState } from 'react';\n\nimport { Input, InputProps } from '@alfalab/core-components-input';\n\nimport { format, isCompleteTimeInput, isValidInputValue } from './utils';\n\nexport type TimeInputProps = Omit<InputProps, 'onChange'> & {\n /**\n * Обработчик изменения значения\n */\n onChange?: (\n event: ChangeEvent<HTMLInputElement>,\n payload: { hours: number; mins: number; value: string },\n ) => void;\n\n /**\n * Обработчик окончания ввода\n */\n onComplete?: (\n event: ChangeEvent<HTMLInputElement>,\n payload: { hours: number; mins: number; value: string },\n ) => void;\n};\n\n/**\n * @deprecated\n * use UniversalDateInput instead\n */\nexport const TimeInput = React.forwardRef<HTMLInputElement, TimeInputProps>(\n (\n { defaultValue = '', value: propValue, onChange, onComplete, className, ...restProps },\n ref,\n ) => {\n const [value, setValue] = useState(propValue || defaultValue);\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const { value: newValue } = event.target;\n\n if (newValue.length > 5) return;\n\n // Позволяем вводить только цифры и двоеточия\n if (/[^\\d:]/.test(newValue)) {\n return;\n }\n\n const colon = newValue.match(/\\:/g);\n\n // Не даем вводить больше, чем одно двоеточие\n if (colon && colon.length > 1) {\n return;\n }\n\n const formattedValue = format(newValue);\n\n const formattedValueArr = formattedValue.split(':');\n const hours = Number(formattedValueArr[0]);\n const mins = Number(formattedValueArr[1]);\n\n setValue(formattedValue);\n\n if (onChange) onChange(event, { hours, mins, value: formattedValue });\n\n if (isCompleteTimeInput(formattedValue)) {\n const valid = formattedValue.length > 0 && isValidInputValue(formattedValue);\n\n if (!valid) return;\n\n if (onComplete) {\n onComplete(event, { hours, mins, value: formattedValue });\n }\n }\n };\n\n const handleClearClick = () => {\n setValue('');\n };\n\n return (\n <Input\n {...restProps}\n ref={ref}\n value={value}\n className={className}\n onChange={handleChange}\n onClear={handleClearClick}\n />\n );\n },\n);\n"],"names":[],"mappings":";;;;;AAAA;AA0BA;;;AAGG;AACU,IAAA,SAAS,GAAG,KAAK,CAAC,UAAU,CACrC,UACI,EAAsF,EACtF,GAAG,EAAA;IADD,IAAA,EAAA,GAAA,EAAA,CAAA,YAAiB,EAAjB,YAAY,GAAA,EAAA,KAAA,MAAA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C,YAAA,IAAM,KAAK,GAAG,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,iBAAiB,CAAC,cAAc,CAAC;AAE5E,YAAA,IAAI,CAAC,KAAK;gBAAE;AAEZ,YAAA,IAAI,UAAU,EAAE;AACZ,gBAAA,UAAU,CAAC,KAAK,EAAE,EAAE,KAAK,EAAA,KAAA,EAAE,IAAI,EAAA,IAAA,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;AAC5D;AACJ;AACL,KAAC;AAED,IAAA,IAAM,gBAAgB,GAAG,YAAA;QACrB,QAAQ,CAAC,EAAE,CAAC;AAChB,KAAC;IAED,QACI,KAAC,CAAA,aAAA,CAAA,KAAK,EACE,QAAA,CAAA,EAAA,EAAA,SAAS,EACb,EAAA,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,gBAAgB,EAC3B,CAAA,CAAA;AAEV,CAAC;;;;"}
package/esm/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"format.js","sources":["../../src/utils/format.ts"],"sourcesContent":["/* eslint-disable no-useless-escape */\n\nexport const DATE_MASK = [/\\d/, /\\d/, ':', /\\d/, /\\d/];\n\nexport const isCompleteTimeInput = (input: string) => input.length === DATE_MASK.length;\n\nexport const isValidTimeFormat = (value: string): boolean => {\n const timeArr = value.split(':');\n const hours = timeArr[0];\n const mins = timeArr[1];\n\n if (hours.length !== 2 || Number(hours) > 23) {\n return false;\n }\n\n if (mins.length !== 2 || Number(mins) > 59) {\n return false;\n }\n\n return true;\n};\n\nexport const isValidInputValue = (inputValue?: string) =>\n !inputValue || (isCompleteTimeInput(inputValue) && isValidTimeFormat(inputValue));\n\nexport const format = (value: string): string =>\n value\n .replace(/^(\\d\\d)(\\d)$/, '$1:$2') // 123 => 12:3\n .replace(/^(\\d\\d)(\\d\\d)/, '$1:$2') // 12345 => 12:45 (если вместо двоеточия введена цифра, она обратно заменяется на двоеточие)\n .replace(/^(\\d):(\\d\\d)(\\d)/, '$1:$2') // 1:234 => 1:23\n .replace(/\\:$/, ''); // 12: => 12 || : => void\n"],"names":[],"mappings":"AAAA;AAEO,IAAM,SAAS,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI;AAExC,IAAA,mBAAmB,GAAG,UAAC,KAAa,EAAK,EAAA,OAAA,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,CAAA;AAEhF,IAAM,iBAAiB,GAAG,UAAC,KAAa,EAAA;IAC3C,IAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;AAChC,IAAA,IAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC;AACxB,IAAA,IAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;AAEvB,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE;AAC1C,QAAA,OAAO,KAAK;AACf;AAED,IAAA,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE;AACxC,QAAA,OAAO,KAAK;AACf;AAED,IAAA,OAAO,IAAI;AACf;AAEO,IAAM,iBAAiB,GAAG,UAAC,UAAmB,EAAA;AACjD,IAAA,OAAA,CAAC,UAAU,KAAK,mBAAmB,CAAC,UAAU,CAAC,IAAI,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAAjF;AAEG,IAAM,MAAM,GAAG,UAAC,KAAa,EAAA;AAChC,IAAA,OAAA;AACK,SAAA,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC;AAChC,SAAA,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC;AACjC,SAAA,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC;AACpC,SAAA,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;AAJvB,EAIwB;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["/* eslint-disable no-useless-escape */\n\nimport React, { ChangeEvent, useState } from 'react';\n\nimport { Input, InputProps } from '@alfalab/core-components-input';\n\nimport { format, isCompleteTimeInput, isValidInputValue } from './utils';\n\nexport type TimeInputProps = Omit<InputProps, 'onChange'> & {\n /**\n * Обработчик изменения значения\n */\n onChange?: (\n event: ChangeEvent<HTMLInputElement>,\n payload: { hours: number; mins: number; value: string },\n ) => void;\n\n /**\n * Обработчик окончания ввода\n */\n onComplete?: (\n event: ChangeEvent<HTMLInputElement>,\n payload: { hours: number; mins: number; value: string },\n ) => void;\n};\n\n/**\n * @deprecated\n * use UniversalDateInput instead\n */\nexport const TimeInput = React.forwardRef<HTMLInputElement, TimeInputProps>(\n (\n { defaultValue = '', value: propValue, onChange, onComplete, className, ...restProps },\n ref,\n ) => {\n const [value, setValue] = useState(propValue || defaultValue);\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const { value: newValue } = event.target;\n\n if (newValue.length > 5) return;\n\n // Позволяем вводить только цифры и двоеточия\n if (/[^\\d:]/.test(newValue)) {\n return;\n }\n\n const colon = newValue.match(/\\:/g);\n\n // Не даем вводить больше, чем одно двоеточие\n if (colon && colon.length > 1) {\n return;\n }\n\n const formattedValue = format(newValue);\n\n const formattedValueArr = formattedValue.split(':');\n const hours = Number(formattedValueArr[0]);\n const mins = Number(formattedValueArr[1]);\n\n setValue(formattedValue);\n\n if (onChange) onChange(event, { hours, mins, value: formattedValue });\n\n if (isCompleteTimeInput(formattedValue)) {\n const valid = formattedValue.length > 0 && isValidInputValue(formattedValue);\n\n if (!valid) return;\n\n if (onComplete) {\n onComplete(event, { hours, mins, value: formattedValue });\n }\n }\n };\n\n const handleClearClick = () => {\n setValue('');\n };\n\n return (\n <Input\n {...restProps}\n ref={ref}\n value={value}\n className={className}\n onChange={handleChange}\n onClear={handleClearClick}\n />\n );\n },\n);\n"],"names":[],"mappings":";;;;AAAA;AA0BA;;;AAGG;AACI,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CACrC,CACI,EAAE,YAAY,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,EACtF,GAAG,KACH;AACA,IAAA,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,SAAS,IAAI,YAAY,CAAC;AAE7D,IAAA,MAAM,YAAY,GAAG,CAAC,KAAoC,KAAI;QAC1D,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,MAAM;AAExC,QAAA,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;YAAE;;AAGzB,QAAA,IAAI,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YACzB;AACH;QAED,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;;AAGnC,QAAA,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B;AACH;AAED,QAAA,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC;QAEvC,MAAM,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC;QACnD,MAAM,KAAK,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;QAC1C,MAAM,IAAI,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;QAEzC,QAAQ,CAAC,cAAc,CAAC;AAExB,QAAA,IAAI,QAAQ;AAAE,YAAA,QAAQ,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;AAErE,QAAA,IAAI,mBAAmB,CAAC,cAAc,CAAC,EAAE;AACrC,YAAA,MAAM,KAAK,GAAG,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,iBAAiB,CAAC,cAAc,CAAC;AAE5E,YAAA,IAAI,CAAC,KAAK;gBAAE;AAEZ,YAAA,IAAI,UAAU,EAAE;AACZ,gBAAA,UAAU,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;AAC5D;AACJ;AACL,KAAC;IAED,MAAM,gBAAgB,GAAG,MAAK;QAC1B,QAAQ,CAAC,EAAE,CAAC;AAChB,KAAC;IAED,QACI,KAAC,CAAA,aAAA,CAAA,KAAK,EACE,EAAA,GAAA,SAAS,EACb,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,gBAAgB,EAC3B,CAAA;AAEV,CAAC;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"format.js","sources":["../../src/utils/format.ts"],"sourcesContent":["/* eslint-disable no-useless-escape */\n\nexport const DATE_MASK = [/\\d/, /\\d/, ':', /\\d/, /\\d/];\n\nexport const isCompleteTimeInput = (input: string) => input.length === DATE_MASK.length;\n\nexport const isValidTimeFormat = (value: string): boolean => {\n const timeArr = value.split(':');\n const hours = timeArr[0];\n const mins = timeArr[1];\n\n if (hours.length !== 2 || Number(hours) > 23) {\n return false;\n }\n\n if (mins.length !== 2 || Number(mins) > 59) {\n return false;\n }\n\n return true;\n};\n\nexport const isValidInputValue = (inputValue?: string) =>\n !inputValue || (isCompleteTimeInput(inputValue) && isValidTimeFormat(inputValue));\n\nexport const format = (value: string): string =>\n value\n .replace(/^(\\d\\d)(\\d)$/, '$1:$2') // 123 => 12:3\n .replace(/^(\\d\\d)(\\d\\d)/, '$1:$2') // 12345 => 12:45 (если вместо двоеточия введена цифра, она обратно заменяется на двоеточие)\n .replace(/^(\\d):(\\d\\d)(\\d)/, '$1:$2') // 1:234 => 1:23\n .replace(/\\:$/, ''); // 12: => 12 || : => void\n"],"names":[],"mappings":"AAAA;AAEO,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI;AAExC,MAAA,mBAAmB,GAAG,CAAC,KAAa,KAAK,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC;AAEpE,MAAA,iBAAiB,GAAG,CAAC,KAAa,KAAa;IACxD,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;AAChC,IAAA,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC;AACxB,IAAA,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;AAEvB,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE;AAC1C,QAAA,OAAO,KAAK;AACf;AAED,IAAA,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE;AACxC,QAAA,OAAO,KAAK;AACf;AAED,IAAA,OAAO,IAAI;AACf;MAEa,iBAAiB,GAAG,CAAC,UAAmB,KACjD,CAAC,UAAU,KAAK,mBAAmB,CAAC,UAAU,CAAC,IAAI,iBAAiB,CAAC,UAAU,CAAC;MAEvE,MAAM,GAAG,CAAC,KAAa,KAChC;AACK,KAAA,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC;AAChC,KAAA,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC;AACjC,KAAA,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC;AACpC,KAAA,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["/* eslint-disable no-useless-escape */\n\nimport React, { ChangeEvent, useState } from 'react';\n\nimport { Input, InputProps } from '@alfalab/core-components-input';\n\nimport { format, isCompleteTimeInput, isValidInputValue } from './utils';\n\nexport type TimeInputProps = Omit<InputProps, 'onChange'> & {\n /**\n * Обработчик изменения значения\n */\n onChange?: (\n event: ChangeEvent<HTMLInputElement>,\n payload: { hours: number; mins: number; value: string },\n ) => void;\n\n /**\n * Обработчик окончания ввода\n */\n onComplete?: (\n event: ChangeEvent<HTMLInputElement>,\n payload: { hours: number; mins: number; value: string },\n ) => void;\n};\n\n/**\n * @deprecated\n * use UniversalDateInput instead\n */\nexport const TimeInput = React.forwardRef<HTMLInputElement, TimeInputProps>(\n (\n { defaultValue = '', value: propValue, onChange, onComplete, className, ...restProps },\n ref,\n ) => {\n const [value, setValue] = useState(propValue || defaultValue);\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const { value: newValue } = event.target;\n\n if (newValue.length > 5) return;\n\n // Позволяем вводить только цифры и двоеточия\n if (/[^\\d:]/.test(newValue)) {\n return;\n }\n\n const colon = newValue.match(/\\:/g);\n\n // Не даем вводить больше, чем одно двоеточие\n if (colon && colon.length > 1) {\n return;\n }\n\n const formattedValue = format(newValue);\n\n const formattedValueArr = formattedValue.split(':');\n const hours = Number(formattedValueArr[0]);\n const mins = Number(formattedValueArr[1]);\n\n setValue(formattedValue);\n\n if (onChange) onChange(event, { hours, mins, value: formattedValue });\n\n if (isCompleteTimeInput(formattedValue)) {\n const valid = formattedValue.length > 0 && isValidInputValue(formattedValue);\n\n if (!valid) return;\n\n if (onComplete) {\n onComplete(event, { hours, mins, value: formattedValue });\n }\n }\n };\n\n const handleClearClick = () => {\n setValue('');\n };\n\n return (\n <Input\n {...restProps}\n ref={ref}\n value={value}\n className={className}\n onChange={handleChange}\n onClear={handleClearClick}\n />\n );\n },\n);\n"],"names":[],"mappings":";;;;AAAA;AA0BA;;;AAGG;AACI,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CACrC,CACI,EAAE,YAAY,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,EACtF,GAAG,KACH;AACA,IAAA,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,SAAS,IAAI,YAAY,CAAC;AAE7D,IAAA,MAAM,YAAY,GAAG,CAAC,KAAoC,KAAI;QAC1D,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,MAAM;AAExC,QAAA,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;YAAE;;AAGzB,QAAA,IAAI,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YACzB;AACH;QAED,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;;AAGnC,QAAA,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B;AACH;AAED,QAAA,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC;QAEvC,MAAM,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC;QACnD,MAAM,KAAK,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;QAC1C,MAAM,IAAI,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;QAEzC,QAAQ,CAAC,cAAc,CAAC;AAExB,QAAA,IAAI,QAAQ;AAAE,YAAA,QAAQ,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;AAErE,QAAA,IAAI,mBAAmB,CAAC,cAAc,CAAC,EAAE;AACrC,YAAA,MAAM,KAAK,GAAG,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,iBAAiB,CAAC,cAAc,CAAC;AAE5E,YAAA,IAAI,CAAC,KAAK;gBAAE;AAEZ,YAAA,IAAI,UAAU,EAAE;AACZ,gBAAA,UAAU,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;AAC5D;AACJ;AACL,KAAC;IAED,MAAM,gBAAgB,GAAG,MAAK;QAC1B,QAAQ,CAAC,EAAE,CAAC;AAChB,KAAC;IAED,QACI,KAAC,CAAA,aAAA,CAAA,KAAK,EACE,EAAA,GAAA,SAAS,EACb,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,gBAAgB,EAC3B,CAAA;AAEV,CAAC;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"format.js","sources":["../../src/utils/format.ts"],"sourcesContent":["/* eslint-disable no-useless-escape */\n\nexport const DATE_MASK = [/\\d/, /\\d/, ':', /\\d/, /\\d/];\n\nexport const isCompleteTimeInput = (input: string) => input.length === DATE_MASK.length;\n\nexport const isValidTimeFormat = (value: string): boolean => {\n const timeArr = value.split(':');\n const hours = timeArr[0];\n const mins = timeArr[1];\n\n if (hours.length !== 2 || Number(hours) > 23) {\n return false;\n }\n\n if (mins.length !== 2 || Number(mins) > 59) {\n return false;\n }\n\n return true;\n};\n\nexport const isValidInputValue = (inputValue?: string) =>\n !inputValue || (isCompleteTimeInput(inputValue) && isValidTimeFormat(inputValue));\n\nexport const format = (value: string): string =>\n value\n .replace(/^(\\d\\d)(\\d)$/, '$1:$2') // 123 => 12:3\n .replace(/^(\\d\\d)(\\d\\d)/, '$1:$2') // 12345 => 12:45 (если вместо двоеточия введена цифра, она обратно заменяется на двоеточие)\n .replace(/^(\\d):(\\d\\d)(\\d)/, '$1:$2') // 1:234 => 1:23\n .replace(/\\:$/, ''); // 12: => 12 || : => void\n"],"names":[],"mappings":"AAAA;AAEO,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI;AAExC,MAAA,mBAAmB,GAAG,CAAC,KAAa,KAAK,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC;AAEpE,MAAA,iBAAiB,GAAG,CAAC,KAAa,KAAa;IACxD,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;AAChC,IAAA,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC;AACxB,IAAA,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;AAEvB,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE;AAC1C,QAAA,OAAO,KAAK;AACf;AAED,IAAA,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE;AACxC,QAAA,OAAO,KAAK;AACf;AAED,IAAA,OAAO,IAAI;AACf;MAEa,iBAAiB,GAAG,CAAC,UAAmB,KACjD,CAAC,UAAU,KAAK,mBAAmB,CAAC,UAAU,CAAC,IAAI,iBAAiB,CAAC,UAAU,CAAC;MAEvE,MAAM,GAAG,CAAC,KAAa,KAChC;AACK,KAAA,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC;AAChC,KAAA,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC;AACjC,KAAA,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC;AACpC,KAAA,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"format.js","sources":["../src/utils/format.ts"],"sourcesContent":["/* eslint-disable no-useless-escape */\n\nexport const DATE_MASK = [/\\d/, /\\d/, ':', /\\d/, /\\d/];\n\nexport const isCompleteTimeInput = (input: string) => input.length === DATE_MASK.length;\n\nexport const isValidTimeFormat = (value: string): boolean => {\n const timeArr = value.split(':');\n const hours = timeArr[0];\n const mins = timeArr[1];\n\n if (hours.length !== 2 || Number(hours) > 23) {\n return false;\n }\n\n if (mins.length !== 2 || Number(mins) > 59) {\n return false;\n }\n\n return true;\n};\n\nexport const isValidInputValue = (inputValue?: string) =>\n !inputValue || (isCompleteTimeInput(inputValue) && isValidTimeFormat(inputValue));\n\nexport const format = (value: string): string =>\n value\n .replace(/^(\\d\\d)(\\d)$/, '$1:$2') // 123 => 12:3\n .replace(/^(\\d\\d)(\\d\\d)/, '$1:$2') // 12345 => 12:45 (если вместо двоеточия введена цифра, она обратно заменяется на двоеточие)\n .replace(/^(\\d):(\\d\\d)(\\d)/, '$1:$2') // 1:234 => 1:23\n .replace(/\\:$/, ''); // 12: => 12 || : => void\n"],"names":[],"mappings":";;;;AAAA;AAEO,IAAM,SAAS,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI;AAExC,IAAA,mBAAmB,GAAG,UAAC,KAAa,EAAK,EAAA,OAAA,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,CAAA;AAEhF,IAAM,iBAAiB,GAAG,UAAC,KAAa,EAAA;IAC3C,IAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;AAChC,IAAA,IAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC;AACxB,IAAA,IAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;AAEvB,IAAA,IAAI,KAAK,CAAC,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