@alfalab/core-components-date-input 1.3.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,73 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.1.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-date-input@2.0.0...@alfalab/core-components-date-input@2.1.0) (2022-03-04)
7
+
8
+
9
+ ### Features
10
+
11
+ * Исправить импорты в сторях. ([#998](https://github.com/alfa-laboratory/core-components/issues/998)) ([e6a654a](https://github.com/alfa-laboratory/core-components/commit/e6a654a0599451c7d149484cb61d8067eed083b7))
12
+
13
+
14
+
15
+
16
+
17
+ # [2.0.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-date-input@1.3.0...@alfalab/core-components-date-input@2.0.0) (2022-02-17)
18
+
19
+
20
+ * refactor/calendar-range (#984) ([714f615](https://github.com/alfa-laboratory/core-components/commit/714f61590586bafe1060e652943e95c133ed002a)), closes [#984](https://github.com/alfa-laboratory/core-components/issues/984)
21
+
22
+
23
+ ### BREAKING CHANGES
24
+
25
+ * Большое обновление CalendarRange
26
+
27
+ * feat(date-input): add some improvements
28
+
29
+ * feat(date-input): some updates
30
+
31
+ * feat(date-input): validation
32
+
33
+ * feat(calendar): change period selection logic
34
+
35
+ * fix(calendar): range styles
36
+
37
+ * fix(calendar): fix styles, add rangeComplete flag
38
+
39
+ * refactor(calendar-range): temporary
40
+
41
+ * fix(calendar-range): fix hook
42
+
43
+ * fix(calendar-range): fix period
44
+
45
+ * fix(calendar-range): fix tests, fix max date
46
+
47
+ * fix: update exports
48
+
49
+ * feat(calendar): allow empty values for PeriodSlider, update today
50
+
51
+ * fix(calendar-range): hide error icon
52
+
53
+ * chore(calendar-range): demo
54
+
55
+ * feat(calendar): use IconButton
56
+
57
+ * feat(calendar-range): add onChange, update demo
58
+
59
+ * fix(calendar-range): update width
60
+
61
+ * test(calendar-range): update snapshot
62
+
63
+ * fix: import date-fns separately
64
+
65
+ * fix(calendar-range): fix rest props
66
+
67
+ Co-authored-by: dmitrsavk <dmitrsavk@yandex.ru>
68
+
69
+
70
+
71
+
72
+
6
73
  # [1.3.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-date-input@1.2.13...@alfalab/core-components-date-input@1.3.0) (2022-02-17)
7
74
 
8
75
 
@@ -22,7 +22,7 @@ type DateInputProps = Omit<InputProps, 'onChange'> & {
22
22
  value: string;
23
23
  }) => void;
24
24
  };
25
- declare const DateInput: React.ForwardRefExoticComponent<Pick<InputProps, "dir" | "form" | "label" | "slot" | "style" | "title" | "type" | "value" | "className" | "dataTestId" | "pattern" | "children" | "leftAddons" | "rightAddons" | "size" | "block" | "colors" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "list" | "step" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "bottomAddons" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "height" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "readOnly" | "required" | "src" | "width" | "clear" | "success" | "inputClassName" | "focusedClassName" | "filledClassName" | "onClear" | "wrapperRef"> & {
25
+ declare const DateInput: React.ForwardRefExoticComponent<Pick<InputProps, "className" | "dataTestId" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "children" | "leftAddons" | "rightAddons" | "size" | "block" | "colors" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "list" | "step" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "value" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "bottomAddons" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "height" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "readOnly" | "required" | "src" | "width" | "clear" | "success" | "inputClassName" | "focusedClassName" | "filledClassName" | "onClear" | "wrapperRef"> & {
26
26
  /**
27
27
  * Управление нативным режимом на мобильных устройствах
28
28
  */
package/dist/Component.js CHANGED
@@ -5,7 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var React = require('react');
6
6
  var coreComponentsInput = require('@alfalab/core-components-input');
7
7
  var mergeRefs = require('react-merge-refs');
8
- require('date-fns');
8
+ require('date-fns/parse');
9
+ require('date-fns/format');
10
+ require('date-fns/isValid');
9
11
  var utils_format = require('./utils/format.js');
10
12
  var utils_nativeSupports = require('./utils/native-supports.js');
11
13
 
@@ -53,7 +55,7 @@ function __rest(s, e) {
53
55
  return t;
54
56
  }
55
57
 
56
- var styles = {"nativeInput":"date-input__nativeInput_1692t"};
58
+ var styles = {"nativeInput":"date-input__nativeInput_3z5ub"};
57
59
  require('./index.css')
58
60
 
59
61
  var DateInput = React.forwardRef(function (_a, ref) {
@@ -5,7 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var React = require('react');
6
6
  var coreComponentsInput = require('@alfalab/core-components-input/dist/cssm');
7
7
  var mergeRefs = require('react-merge-refs');
8
- require('date-fns');
8
+ require('date-fns/parse');
9
+ require('date-fns/format');
10
+ require('date-fns/isValid');
9
11
  var utils_format = require('./utils/format.js');
10
12
  var utils_nativeSupports = require('./utils/native-supports.js');
11
13
  var styles = require('./index.module.css');
@@ -6,7 +6,9 @@ var Component = require('./Component.js');
6
6
  require('react');
7
7
  require('@alfalab/core-components-input/dist/cssm');
8
8
  require('react-merge-refs');
9
- require('date-fns');
9
+ require('date-fns/parse');
10
+ require('date-fns/format');
11
+ require('date-fns/isValid');
10
12
  var utils_format = require('./utils/format.js');
11
13
  var utils_nativeSupports = require('./utils/native-supports.js');
12
14
  require('./index.module.css');
@@ -2,7 +2,15 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dateFns = require('date-fns');
5
+ var parse = require('date-fns/parse');
6
+ var dateFnsFormat = require('date-fns/format');
7
+ var dateFnsIsValid = require('date-fns/isValid');
8
+
9
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
+
11
+ var parse__default = /*#__PURE__*/_interopDefaultLegacy(parse);
12
+ var dateFnsFormat__default = /*#__PURE__*/_interopDefaultLegacy(dateFnsFormat);
13
+ var dateFnsIsValid__default = /*#__PURE__*/_interopDefaultLegacy(dateFnsIsValid);
6
14
 
7
15
  var DATE_FORMAT = 'dd.MM.yyyy';
8
16
  var NATIVE_DATE_FORMAT = 'yyyy-MM-dd';
@@ -10,14 +18,14 @@ var DATE_MASK = [/\d/, /\d/, '.', /\d/, /\d/, '.', /\d/, /\d/, /\d/, /\d/];
10
18
  var isCompleteDateInput = function (input) { return input.length === DATE_MASK.length; };
11
19
  var formatDate = function (date, dateFormat) {
12
20
  if (dateFormat === void 0) { dateFormat = DATE_FORMAT; }
13
- return dateFns.format(date, dateFormat);
21
+ return dateFnsFormat__default['default'](date, dateFormat);
14
22
  };
15
23
  var parseDateString = function (value, dateFormat) {
16
24
  if (dateFormat === void 0) { dateFormat = DATE_FORMAT; }
17
- return dateFns.parse(value, dateFormat, new Date());
25
+ return parse__default['default'](value, dateFormat, new Date());
18
26
  };
19
27
  var isValid = function (inputValue) {
20
- return !inputValue || (isCompleteDateInput(inputValue) && dateFns.isValid(parseDateString(inputValue)));
28
+ return !inputValue || (isCompleteDateInput(inputValue) && dateFnsIsValid__default['default'](parseDateString(inputValue)));
21
29
  };
22
30
  var format = function (value) {
23
31
  return value
@@ -2,7 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('date-fns');
5
+ require('date-fns/parse');
6
+ require('date-fns/format');
7
+ require('date-fns/isValid');
6
8
  var utils_format = require('./format.js');
7
9
  var utils_nativeSupports = require('./native-supports.js');
8
10
 
@@ -1,7 +1,9 @@
1
1
  import React, { forwardRef, useRef, useState, useCallback, useEffect } from 'react';
2
2
  import { Input } from '@alfalab/core-components-input/dist/esm';
3
3
  import mergeRefs from 'react-merge-refs';
4
- import 'date-fns';
4
+ import 'date-fns/parse';
5
+ import 'date-fns/format';
6
+ import 'date-fns/isValid';
5
7
  import { isValid, DATE_MASK, format, parseDateString, isCompleteDateInput, NATIVE_DATE_FORMAT, formatDate } from './utils/format.js';
6
8
  import { isInputDateSupported } from './utils/native-supports.js';
7
9
 
@@ -44,7 +46,7 @@ function __rest(s, e) {
44
46
  return t;
45
47
  }
46
48
 
47
- var styles = {"nativeInput":"date-input__nativeInput_1692t"};
49
+ var styles = {"nativeInput":"date-input__nativeInput_3z5ub"};
48
50
  require('./index.css')
49
51
 
50
52
  var DateInput = forwardRef(function (_a, ref) {
@@ -1,4 +1,4 @@
1
- /* hash: 1yoqs */
1
+ /* hash: aibpb */
2
2
  :root {
3
3
 
4
4
  /* Hard */
@@ -7,7 +7,7 @@
7
7
 
8
8
  /* Hard up */
9
9
  }
10
- .date-input__nativeInput_1692t {
10
+ .date-input__nativeInput_3z5ub {
11
11
  opacity: 0;
12
12
  position: absolute;
13
13
  top: 0;
@@ -18,9 +18,9 @@
18
18
  appearance: none;
19
19
  z-index: 1
20
20
  }
21
- .date-input__nativeInput_1692t::-webkit-calendar-picker-indicator {
21
+ .date-input__nativeInput_3z5ub::-webkit-calendar-picker-indicator {
22
22
  display: none;
23
23
  }
24
- .date-input__nativeInput_1692t::-webkit-inner-spin-button {
24
+ .date-input__nativeInput_3z5ub::-webkit-inner-spin-button {
25
25
  display: none;
26
26
  }
package/dist/esm/index.js CHANGED
@@ -2,6 +2,8 @@ export { DateInput } from './Component.js';
2
2
  import 'react';
3
3
  import '@alfalab/core-components-input/dist/esm';
4
4
  import 'react-merge-refs';
5
- import 'date-fns';
5
+ import 'date-fns/parse';
6
+ import 'date-fns/format';
7
+ import 'date-fns/isValid';
6
8
  export { DATE_FORMAT, DATE_MASK, NATIVE_DATE_FORMAT, format, formatDate, isCompleteDateInput, isValid, parseDateString } from './utils/format.js';
7
9
  export { isInputDateSupported } from './utils/native-supports.js';
@@ -1,4 +1,6 @@
1
- import { format as format$1, parse, isValid as isValid$1 } from 'date-fns';
1
+ import parse from 'date-fns/parse';
2
+ import dateFnsFormat from 'date-fns/format';
3
+ import dateFnsIsValid from 'date-fns/isValid';
2
4
 
3
5
  var DATE_FORMAT = 'dd.MM.yyyy';
4
6
  var NATIVE_DATE_FORMAT = 'yyyy-MM-dd';
@@ -6,14 +8,14 @@ var DATE_MASK = [/\d/, /\d/, '.', /\d/, /\d/, '.', /\d/, /\d/, /\d/, /\d/];
6
8
  var isCompleteDateInput = function (input) { return input.length === DATE_MASK.length; };
7
9
  var formatDate = function (date, dateFormat) {
8
10
  if (dateFormat === void 0) { dateFormat = DATE_FORMAT; }
9
- return format$1(date, dateFormat);
11
+ return dateFnsFormat(date, dateFormat);
10
12
  };
11
13
  var parseDateString = function (value, dateFormat) {
12
14
  if (dateFormat === void 0) { dateFormat = DATE_FORMAT; }
13
15
  return parse(value, dateFormat, new Date());
14
16
  };
15
17
  var isValid = function (inputValue) {
16
- return !inputValue || (isCompleteDateInput(inputValue) && isValid$1(parseDateString(inputValue)));
18
+ return !inputValue || (isCompleteDateInput(inputValue) && dateFnsIsValid(parseDateString(inputValue)));
17
19
  };
18
20
  var format = function (value) {
19
21
  return value
@@ -1,3 +1,5 @@
1
- import 'date-fns';
1
+ import 'date-fns/parse';
2
+ import 'date-fns/format';
3
+ import 'date-fns/isValid';
2
4
  export { DATE_FORMAT, DATE_MASK, NATIVE_DATE_FORMAT, format, formatDate, isCompleteDateInput, isValid, parseDateString } from './format.js';
3
5
  export { isInputDateSupported } from './native-supports.js';
package/dist/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* hash: 1yoqs */
1
+ /* hash: aibpb */
2
2
  :root {
3
3
 
4
4
  /* Hard */
@@ -7,7 +7,7 @@
7
7
 
8
8
  /* Hard up */
9
9
  }
10
- .date-input__nativeInput_1692t {
10
+ .date-input__nativeInput_3z5ub {
11
11
  opacity: 0;
12
12
  position: absolute;
13
13
  top: 0;
@@ -18,9 +18,9 @@
18
18
  appearance: none;
19
19
  z-index: 1
20
20
  }
21
- .date-input__nativeInput_1692t::-webkit-calendar-picker-indicator {
21
+ .date-input__nativeInput_3z5ub::-webkit-calendar-picker-indicator {
22
22
  display: none;
23
23
  }
24
- .date-input__nativeInput_1692t::-webkit-inner-spin-button {
24
+ .date-input__nativeInput_3z5ub::-webkit-inner-spin-button {
25
25
  display: none;
26
26
  }
package/dist/index.js CHANGED
@@ -6,7 +6,9 @@ var Component = require('./Component.js');
6
6
  require('react');
7
7
  require('@alfalab/core-components-input');
8
8
  require('react-merge-refs');
9
- require('date-fns');
9
+ require('date-fns/parse');
10
+ require('date-fns/format');
11
+ require('date-fns/isValid');
10
12
  var utils_format = require('./utils/format.js');
11
13
  var utils_nativeSupports = require('./utils/native-supports.js');
12
14
 
@@ -1,11 +1,13 @@
1
1
  import React, { forwardRef, useRef, useState, useCallback, useEffect } from 'react';
2
2
  import { Input } from '@alfalab/core-components-input/dist/modern';
3
3
  import mergeRefs from 'react-merge-refs';
4
- import 'date-fns';
4
+ import 'date-fns/parse';
5
+ import 'date-fns/format';
6
+ import 'date-fns/isValid';
5
7
  import { isValid, DATE_MASK, format, parseDateString, isCompleteDateInput, NATIVE_DATE_FORMAT, formatDate } from './utils/format.js';
6
8
  import { isInputDateSupported } from './utils/native-supports.js';
7
9
 
8
- var styles = {"nativeInput":"date-input__nativeInput_1692t"};
10
+ var styles = {"nativeInput":"date-input__nativeInput_3z5ub"};
9
11
  require('./index.css')
10
12
 
11
13
  const DateInput = forwardRef(({ mobileMode = 'input', defaultValue = '', rightAddons, error, value: propValue, onBlur, onChange, onComplete, ...restProps }, ref) => {
@@ -1,4 +1,4 @@
1
- /* hash: 1yoqs */
1
+ /* hash: aibpb */
2
2
  :root {
3
3
 
4
4
  /* Hard */
@@ -7,7 +7,7 @@
7
7
 
8
8
  /* Hard up */
9
9
  }
10
- .date-input__nativeInput_1692t {
10
+ .date-input__nativeInput_3z5ub {
11
11
  opacity: 0;
12
12
  position: absolute;
13
13
  top: 0;
@@ -18,9 +18,9 @@
18
18
  appearance: none;
19
19
  z-index: 1
20
20
  }
21
- .date-input__nativeInput_1692t::-webkit-calendar-picker-indicator {
21
+ .date-input__nativeInput_3z5ub::-webkit-calendar-picker-indicator {
22
22
  display: none;
23
23
  }
24
- .date-input__nativeInput_1692t::-webkit-inner-spin-button {
24
+ .date-input__nativeInput_3z5ub::-webkit-inner-spin-button {
25
25
  display: none;
26
26
  }
@@ -1,7 +1,9 @@
1
1
  import 'react';
2
2
  import '@alfalab/core-components-input/dist/modern';
3
3
  import 'react-merge-refs';
4
- import 'date-fns';
4
+ import 'date-fns/parse';
5
+ import 'date-fns/format';
6
+ import 'date-fns/isValid';
5
7
  export { DATE_FORMAT, DATE_MASK, NATIVE_DATE_FORMAT, format, formatDate, isCompleteDateInput, isValid, parseDateString } from './utils/format.js';
6
8
  export { isInputDateSupported } from './utils/native-supports.js';
7
9
  export { DateInput } from './Component.js';
@@ -1,12 +1,14 @@
1
- import { format as format$1, parse, isValid as isValid$1 } from 'date-fns';
1
+ import parse from 'date-fns/parse';
2
+ import dateFnsFormat from 'date-fns/format';
3
+ import dateFnsIsValid from 'date-fns/isValid';
2
4
 
3
5
  const DATE_FORMAT = 'dd.MM.yyyy';
4
6
  const NATIVE_DATE_FORMAT = 'yyyy-MM-dd';
5
7
  const DATE_MASK = [/\d/, /\d/, '.', /\d/, /\d/, '.', /\d/, /\d/, /\d/, /\d/];
6
8
  const isCompleteDateInput = (input) => input.length === DATE_MASK.length;
7
- const formatDate = (date, dateFormat = DATE_FORMAT) => format$1(date, dateFormat);
9
+ const formatDate = (date, dateFormat = DATE_FORMAT) => dateFnsFormat(date, dateFormat);
8
10
  const parseDateString = (value, dateFormat = DATE_FORMAT) => parse(value, dateFormat, new Date());
9
- const isValid = (inputValue) => !inputValue || (isCompleteDateInput(inputValue) && isValid$1(parseDateString(inputValue)));
11
+ const isValid = (inputValue) => !inputValue || (isCompleteDateInput(inputValue) && dateFnsIsValid(parseDateString(inputValue)));
10
12
  const format = (value) => value
11
13
  .replace(/^(\d\d)(\d)$/, '$1.$2') // 121 => 12.1
12
14
  .replace(/^(\d\d)\.(\d\d)(\d)$/, '$1.$2.$3') // 12.122 => 12.12.2
@@ -1,3 +1,5 @@
1
- import 'date-fns';
1
+ import 'date-fns/parse';
2
+ import 'date-fns/format';
3
+ import 'date-fns/isValid';
2
4
  export { DATE_FORMAT, DATE_MASK, NATIVE_DATE_FORMAT, format, formatDate, isCompleteDateInput, isValid, parseDateString } from './format.js';
3
5
  export { isInputDateSupported } from './native-supports.js';
@@ -2,7 +2,15 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dateFns = require('date-fns');
5
+ var parse = require('date-fns/parse');
6
+ var dateFnsFormat = require('date-fns/format');
7
+ var dateFnsIsValid = require('date-fns/isValid');
8
+
9
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
+
11
+ var parse__default = /*#__PURE__*/_interopDefaultLegacy(parse);
12
+ var dateFnsFormat__default = /*#__PURE__*/_interopDefaultLegacy(dateFnsFormat);
13
+ var dateFnsIsValid__default = /*#__PURE__*/_interopDefaultLegacy(dateFnsIsValid);
6
14
 
7
15
  var DATE_FORMAT = 'dd.MM.yyyy';
8
16
  var NATIVE_DATE_FORMAT = 'yyyy-MM-dd';
@@ -10,14 +18,14 @@ var DATE_MASK = [/\d/, /\d/, '.', /\d/, /\d/, '.', /\d/, /\d/, /\d/, /\d/];
10
18
  var isCompleteDateInput = function (input) { return input.length === DATE_MASK.length; };
11
19
  var formatDate = function (date, dateFormat) {
12
20
  if (dateFormat === void 0) { dateFormat = DATE_FORMAT; }
13
- return dateFns.format(date, dateFormat);
21
+ return dateFnsFormat__default['default'](date, dateFormat);
14
22
  };
15
23
  var parseDateString = function (value, dateFormat) {
16
24
  if (dateFormat === void 0) { dateFormat = DATE_FORMAT; }
17
- return dateFns.parse(value, dateFormat, new Date());
25
+ return parse__default['default'](value, dateFormat, new Date());
18
26
  };
19
27
  var isValid = function (inputValue) {
20
- return !inputValue || (isCompleteDateInput(inputValue) && dateFns.isValid(parseDateString(inputValue)));
28
+ return !inputValue || (isCompleteDateInput(inputValue) && dateFnsIsValid__default['default'](parseDateString(inputValue)));
21
29
  };
22
30
  var format = function (value) {
23
31
  return value
@@ -2,7 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('date-fns');
5
+ require('date-fns/parse');
6
+ require('date-fns/format');
7
+ require('date-fns/isValid');
6
8
  var utils_format = require('./format.js');
7
9
  var utils_nativeSupports = require('./native-supports.js');
8
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-date-input",
3
- "version": "1.3.0",
3
+ "version": "2.1.1",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -19,9 +19,9 @@
19
19
  "react": "^16.9.0 || ^17.0.1"
20
20
  },
21
21
  "dependencies": {
22
- "@alfalab/core-components-input": "^8.0.7",
23
- "date-fns": "^2.16.1",
24
- "react-merge-refs": "^1.1.0"
22
+ "@alfalab/core-components-input": "^8.1.1",
23
+ "date-fns": "2.16.1",
24
+ "react-merge-refs": "1.1.0"
25
25
  },
26
- "gitHead": "45ff10d1efc81a4a1afb82c6b6eca1b428c7c459"
26
+ "gitHead": "0363f194b7d8e6d2949795b8f0570262d7028aff"
27
27
  }