@alfalab/core-components-calendar-input 5.0.2 → 5.1.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.
- package/CHANGELOG.md +40 -0
- package/dist/Component.d.ts +17 -1
- package/dist/Component.js +9 -5
- package/dist/cssm/Component.d.ts +17 -1
- package/dist/cssm/Component.js +8 -4
- package/dist/cssm/index.module.css +7 -1
- package/dist/esm/Component.d.ts +17 -1
- package/dist/esm/Component.js +9 -5
- package/dist/esm/index.css +16 -10
- package/dist/index.css +16 -10
- package/dist/modern/Component.d.ts +17 -1
- package/dist/modern/Component.js +9 -5
- package/dist/modern/index.css +16 -10
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,46 @@
|
|
|
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
|
+
## [5.1.2](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-calendar-input@5.1.1...@alfalab/core-components-calendar-input@5.1.2) (2021-12-08)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @alfalab/core-components-calendar-input
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [5.1.1](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-calendar-input@5.1.0...@alfalab/core-components-calendar-input@5.1.1) (2021-12-08)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @alfalab/core-components-calendar-input
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [5.1.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-calendar-input@5.0.3...@alfalab/core-components-calendar-input@5.1.0) (2021-12-08)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **calendar-input:** рендер rightAddons, фикс затертых пропсов ([#895](https://github.com/alfa-laboratory/core-components/issues/895)) ([1eabd29](https://github.com/alfa-laboratory/core-components/commit/1eabd2902cd1bd62517284313f79cf31189cf525))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
* **calendar:** мобильные стили ([#867](https://github.com/alfa-laboratory/core-components/issues/867)) ([febf545](https://github.com/alfa-laboratory/core-components/commit/febf54551f8179a1ba03fe65ed47aa3b20b01472))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [5.0.3](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-calendar-input@5.0.2...@alfalab/core-components-calendar-input@5.0.3) (2021-12-01)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @alfalab/core-components-calendar-input
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
6
46
|
## [5.0.2](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-calendar-input@5.0.1...@alfalab/core-components-calendar-input@5.0.2) (2021-11-26)
|
|
7
47
|
|
|
8
48
|
**Note:** Version bump only for package @alfalab/core-components-calendar-input
|
package/dist/Component.d.ts
CHANGED
|
@@ -13,6 +13,10 @@ type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
|
|
|
13
13
|
* Дополнительный класс для инпута
|
|
14
14
|
*/
|
|
15
15
|
inputClassName?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Дополнительный класс для поповера
|
|
18
|
+
*/
|
|
19
|
+
popoverClassName?: string;
|
|
16
20
|
/**
|
|
17
21
|
* Доп. пропсы для календаря
|
|
18
22
|
*/
|
|
@@ -84,8 +88,12 @@ type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
|
|
|
84
88
|
* Позиционирование поповера с календарем
|
|
85
89
|
*/
|
|
86
90
|
popoverPosition?: PopoverProps['position'];
|
|
91
|
+
/**
|
|
92
|
+
* Календарь будет принимать ширину инпута
|
|
93
|
+
*/
|
|
94
|
+
useAnchorWidth?: boolean;
|
|
87
95
|
};
|
|
88
|
-
declare const CalendarInput: React.ForwardRefExoticComponent<Pick<DateInputProps, "children" | "value" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "dir" | "className" | "dataTestId" | "name" | "hidden" | "color" | "size" | "block" | "clear" | "multiple" | "disabled" | "leftAddons" | "rightAddons" | "colors" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "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" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "bottomAddons" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "
|
|
96
|
+
declare const CalendarInput: React.ForwardRefExoticComponent<Pick<DateInputProps, "children" | "value" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "dir" | "className" | "dataTestId" | "height" | "name" | "hidden" | "color" | "size" | "block" | "clear" | "multiple" | "disabled" | "leftAddons" | "rightAddons" | "colors" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "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" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "bottomAddons" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "max" | "maxLength" | "min" | "minLength" | "readOnly" | "required" | "src" | "width" | "success" | "inputClassName" | "focusedClassName" | "filledClassName" | "onClear" | "wrapperRef" | "keepCharPositions" | "minYear" | "maxYear"> & {
|
|
89
97
|
/**
|
|
90
98
|
* Дополнительный класс
|
|
91
99
|
*/
|
|
@@ -94,6 +102,10 @@ declare const CalendarInput: React.ForwardRefExoticComponent<Pick<DateInputProps
|
|
|
94
102
|
* Дополнительный класс для инпута
|
|
95
103
|
*/
|
|
96
104
|
inputClassName?: string | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Дополнительный класс для поповера
|
|
107
|
+
*/
|
|
108
|
+
popoverClassName?: string | undefined;
|
|
97
109
|
/**
|
|
98
110
|
* Доп. пропсы для календаря
|
|
99
111
|
*/
|
|
@@ -165,5 +177,9 @@ declare const CalendarInput: React.ForwardRefExoticComponent<Pick<DateInputProps
|
|
|
165
177
|
* Позиционирование поповера с календарем
|
|
166
178
|
*/
|
|
167
179
|
popoverPosition?: "top" | "bottom" | "right" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end" | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* Календарь будет принимать ширину инпута
|
|
182
|
+
*/
|
|
183
|
+
useAnchorWidth?: boolean | undefined;
|
|
168
184
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
169
185
|
export { CalendarInputProps, CalendarInput };
|
package/dist/Component.js
CHANGED
|
@@ -55,12 +55,12 @@ function __rest(s, e) {
|
|
|
55
55
|
return t;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
var styles = {"component":"calendar-
|
|
58
|
+
var styles = {"component":"calendar-input__component_7j6g4","block":"calendar-input__block_7j6g4","calendarContainer":"calendar-input__calendarContainer_7j6g4","calendarIcon":"calendar-input__calendarIcon_7j6g4","nativeInput":"calendar-input__nativeInput_7j6g4"};
|
|
59
59
|
require('./index.css')
|
|
60
60
|
|
|
61
61
|
var CalendarInput = React.forwardRef(function (_a, ref) {
|
|
62
62
|
var _b;
|
|
63
|
-
var _c = _a.block, block = _c === void 0 ? false : _c, className = _a.className, inputClassName = _a.inputClassName, _d = _a.defaultOpen, defaultOpen = _d === void 0 ? false : _d, defaultMonth = _a.defaultMonth, _e = _a.defaultValue, defaultValue = _e === void 0 ? '' : _e, _f = _a.calendarPosition, calendarPosition = _f === void 0 ? 'popover' : _f, value = _a.value, dataTestId = _a.dataTestId, _g = _a.calendarProps, calendarProps = _g === void 0 ? {} : _g, _h = _a.minDate, minDate = _h === void 0 ? calendarProps.minDate : _h, _j = _a.maxDate, maxDate = _j === void 0 ? calendarProps.maxDate : _j, _k = _a.offDays, offDays = _k === void 0 ? calendarProps.offDays || [] : _k, preventFlip = _a.preventFlip, _l = _a.mobileMode, mobileMode = _l === void 0 ? 'popover' : _l, _m = _a.wrapperRef, wrapperRef = _m === void 0 ? null : _m, disabled = _a.disabled, onChange = _a.onChange, onInputChange = _a.onInputChange, onCalendarChange = _a.onCalendarChange, readOnly = _a.readOnly, _o = _a.Calendar, Calendar = _o === void 0 ? coreComponentsCalendar.Calendar : _o, _p = _a.popoverPosition, popoverPosition = _p === void 0 ? 'bottom-start' : _p, restProps = __rest(_a, ["block", "className", "inputClassName", "defaultOpen", "defaultMonth", "defaultValue", "calendarPosition", "value", "dataTestId", "calendarProps", "minDate", "maxDate", "offDays", "preventFlip", "mobileMode", "wrapperRef", "disabled", "onChange", "onInputChange", "onCalendarChange", "readOnly", "Calendar", "popoverPosition"]);
|
|
63
|
+
var _c = _a.block, block = _c === void 0 ? false : _c, className = _a.className, inputClassName = _a.inputClassName, popoverClassName = _a.popoverClassName, _d = _a.defaultOpen, defaultOpen = _d === void 0 ? false : _d, defaultMonth = _a.defaultMonth, _e = _a.defaultValue, defaultValue = _e === void 0 ? '' : _e, _f = _a.calendarPosition, calendarPosition = _f === void 0 ? 'popover' : _f, value = _a.value, dataTestId = _a.dataTestId, _g = _a.calendarProps, calendarProps = _g === void 0 ? {} : _g, _h = _a.minDate, minDate = _h === void 0 ? calendarProps.minDate : _h, _j = _a.maxDate, maxDate = _j === void 0 ? calendarProps.maxDate : _j, _k = _a.offDays, offDays = _k === void 0 ? calendarProps.offDays || [] : _k, preventFlip = _a.preventFlip, _l = _a.mobileMode, mobileMode = _l === void 0 ? 'popover' : _l, _m = _a.wrapperRef, wrapperRef = _m === void 0 ? null : _m, disabled = _a.disabled, onChange = _a.onChange, onInputChange = _a.onInputChange, onCalendarChange = _a.onCalendarChange, onKeyDown = _a.onKeyDown, readOnly = _a.readOnly, _o = _a.Calendar, Calendar = _o === void 0 ? coreComponentsCalendar.Calendar : _o, _p = _a.popoverPosition, popoverPosition = _p === void 0 ? 'bottom-start' : _p, useAnchorWidth = _a.useAnchorWidth, rightAddons = _a.rightAddons, restProps = __rest(_a, ["block", "className", "inputClassName", "popoverClassName", "defaultOpen", "defaultMonth", "defaultValue", "calendarPosition", "value", "dataTestId", "calendarProps", "minDate", "maxDate", "offDays", "preventFlip", "mobileMode", "wrapperRef", "disabled", "onChange", "onInputChange", "onCalendarChange", "onKeyDown", "readOnly", "Calendar", "popoverPosition", "useAnchorWidth", "rightAddons"]);
|
|
64
64
|
var uncontrolled = value === undefined;
|
|
65
65
|
var shouldRenderNative = coreComponentsDateInput.SUPPORTS_INPUT_TYPE_DATE && mobileMode === 'native';
|
|
66
66
|
var shouldRenderOnlyInput = mobileMode === 'input';
|
|
@@ -105,7 +105,9 @@ var CalendarInput = React.forwardRef(function (_a, ref) {
|
|
|
105
105
|
event.preventDefault();
|
|
106
106
|
calendarRef.current.focus();
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
if (onKeyDown)
|
|
109
|
+
onKeyDown(event);
|
|
110
|
+
}, [onKeyDown]);
|
|
109
111
|
var changeHandler = React.useCallback(function (event, newValue, newDate, initiator, shouldChange) {
|
|
110
112
|
if (initiator === void 0) { initiator = 'input'; }
|
|
111
113
|
if (shouldChange === void 0) { shouldChange = true; }
|
|
@@ -157,9 +159,11 @@ var CalendarInput = React.forwardRef(function (_a, ref) {
|
|
|
157
159
|
React__default['default'].createElement("div", { className: cn__default['default'](styles.component, className, (_b = {},
|
|
158
160
|
_b[styles.block] = block,
|
|
159
161
|
_b)), tabIndex: -1, onKeyDown: inputDisabled ? undefined : handleKeyDown, onClick: inputDisabled ? undefined : handleClick, onFocus: inputDisabled ? undefined : handleFocus, onBlur: handleBlur, "data-test-id": dataTestId },
|
|
160
|
-
React__default['default'].createElement(coreComponentsDateInput.DateInput, __assign({}, restProps, { ref: ref, wrapperRef: mergeRefs__default['default']([wrapperRef, inputWrapperRef]),
|
|
162
|
+
React__default['default'].createElement(coreComponentsDateInput.DateInput, __assign({}, restProps, { ref: ref, wrapperRef: mergeRefs__default['default']([wrapperRef, inputWrapperRef]), value: inputValue, defaultValue: defaultValue, disabled: disabled, readOnly: readOnly, mobileMode: mobileMode === 'native' ? 'native' : 'input', rightAddons: React__default['default'].createElement(React__default['default'].Fragment, null,
|
|
163
|
+
rightAddons,
|
|
164
|
+
React__default['default'].createElement(CalendarMIcon.CalendarMIcon, { className: styles.calendarIcon })), onKeyDown: handleInputKeyDown, onChange: handleInputChange, block: true })),
|
|
161
165
|
shouldRenderStatic && renderCalendar(),
|
|
162
|
-
shouldRenderPopover && (React__default['default'].createElement(coreComponentsPopover.Popover, { open: open, anchorElement: inputWrapperRef.current, popperClassName: styles.calendarContainer, position: popoverPosition, offset: [0, 8], withTransition: false, preventFlip: preventFlip }, renderCalendar()))));
|
|
166
|
+
shouldRenderPopover && (React__default['default'].createElement(coreComponentsPopover.Popover, { open: open, useAnchorWidth: useAnchorWidth, anchorElement: inputWrapperRef.current, popperClassName: styles.calendarContainer, className: popoverClassName, position: popoverPosition, offset: [0, 8], withTransition: false, preventFlip: preventFlip }, renderCalendar()))));
|
|
163
167
|
});
|
|
164
168
|
|
|
165
169
|
exports.CalendarInput = CalendarInput;
|
package/dist/cssm/Component.d.ts
CHANGED
|
@@ -13,6 +13,10 @@ type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
|
|
|
13
13
|
* Дополнительный класс для инпута
|
|
14
14
|
*/
|
|
15
15
|
inputClassName?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Дополнительный класс для поповера
|
|
18
|
+
*/
|
|
19
|
+
popoverClassName?: string;
|
|
16
20
|
/**
|
|
17
21
|
* Доп. пропсы для календаря
|
|
18
22
|
*/
|
|
@@ -84,8 +88,12 @@ type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
|
|
|
84
88
|
* Позиционирование поповера с календарем
|
|
85
89
|
*/
|
|
86
90
|
popoverPosition?: PopoverProps['position'];
|
|
91
|
+
/**
|
|
92
|
+
* Календарь будет принимать ширину инпута
|
|
93
|
+
*/
|
|
94
|
+
useAnchorWidth?: boolean;
|
|
87
95
|
};
|
|
88
|
-
declare const CalendarInput: React.ForwardRefExoticComponent<Pick<DateInputProps, "children" | "value" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "dir" | "className" | "dataTestId" | "name" | "hidden" | "color" | "size" | "block" | "clear" | "multiple" | "disabled" | "leftAddons" | "rightAddons" | "colors" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "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" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "bottomAddons" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "
|
|
96
|
+
declare const CalendarInput: React.ForwardRefExoticComponent<Pick<DateInputProps, "children" | "value" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "dir" | "className" | "dataTestId" | "height" | "name" | "hidden" | "color" | "size" | "block" | "clear" | "multiple" | "disabled" | "leftAddons" | "rightAddons" | "colors" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "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" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "bottomAddons" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "max" | "maxLength" | "min" | "minLength" | "readOnly" | "required" | "src" | "width" | "success" | "inputClassName" | "focusedClassName" | "filledClassName" | "onClear" | "wrapperRef" | "keepCharPositions" | "minYear" | "maxYear"> & {
|
|
89
97
|
/**
|
|
90
98
|
* Дополнительный класс
|
|
91
99
|
*/
|
|
@@ -94,6 +102,10 @@ declare const CalendarInput: React.ForwardRefExoticComponent<Pick<DateInputProps
|
|
|
94
102
|
* Дополнительный класс для инпута
|
|
95
103
|
*/
|
|
96
104
|
inputClassName?: string | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Дополнительный класс для поповера
|
|
107
|
+
*/
|
|
108
|
+
popoverClassName?: string | undefined;
|
|
97
109
|
/**
|
|
98
110
|
* Доп. пропсы для календаря
|
|
99
111
|
*/
|
|
@@ -165,5 +177,9 @@ declare const CalendarInput: React.ForwardRefExoticComponent<Pick<DateInputProps
|
|
|
165
177
|
* Позиционирование поповера с календарем
|
|
166
178
|
*/
|
|
167
179
|
popoverPosition?: "top" | "bottom" | "right" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end" | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* Календарь будет принимать ширину инпута
|
|
182
|
+
*/
|
|
183
|
+
useAnchorWidth?: boolean | undefined;
|
|
168
184
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
169
185
|
export { CalendarInputProps, CalendarInput };
|
package/dist/cssm/Component.js
CHANGED
|
@@ -59,7 +59,7 @@ function __rest(s, e) {
|
|
|
59
59
|
|
|
60
60
|
var CalendarInput = React.forwardRef(function (_a, ref) {
|
|
61
61
|
var _b;
|
|
62
|
-
var _c = _a.block, block = _c === void 0 ? false : _c, className = _a.className, inputClassName = _a.inputClassName, _d = _a.defaultOpen, defaultOpen = _d === void 0 ? false : _d, defaultMonth = _a.defaultMonth, _e = _a.defaultValue, defaultValue = _e === void 0 ? '' : _e, _f = _a.calendarPosition, calendarPosition = _f === void 0 ? 'popover' : _f, value = _a.value, dataTestId = _a.dataTestId, _g = _a.calendarProps, calendarProps = _g === void 0 ? {} : _g, _h = _a.minDate, minDate = _h === void 0 ? calendarProps.minDate : _h, _j = _a.maxDate, maxDate = _j === void 0 ? calendarProps.maxDate : _j, _k = _a.offDays, offDays = _k === void 0 ? calendarProps.offDays || [] : _k, preventFlip = _a.preventFlip, _l = _a.mobileMode, mobileMode = _l === void 0 ? 'popover' : _l, _m = _a.wrapperRef, wrapperRef = _m === void 0 ? null : _m, disabled = _a.disabled, onChange = _a.onChange, onInputChange = _a.onInputChange, onCalendarChange = _a.onCalendarChange, readOnly = _a.readOnly, _o = _a.Calendar, Calendar = _o === void 0 ? coreComponentsCalendar.Calendar : _o, _p = _a.popoverPosition, popoverPosition = _p === void 0 ? 'bottom-start' : _p, restProps = __rest(_a, ["block", "className", "inputClassName", "defaultOpen", "defaultMonth", "defaultValue", "calendarPosition", "value", "dataTestId", "calendarProps", "minDate", "maxDate", "offDays", "preventFlip", "mobileMode", "wrapperRef", "disabled", "onChange", "onInputChange", "onCalendarChange", "readOnly", "Calendar", "popoverPosition"]);
|
|
62
|
+
var _c = _a.block, block = _c === void 0 ? false : _c, className = _a.className, inputClassName = _a.inputClassName, popoverClassName = _a.popoverClassName, _d = _a.defaultOpen, defaultOpen = _d === void 0 ? false : _d, defaultMonth = _a.defaultMonth, _e = _a.defaultValue, defaultValue = _e === void 0 ? '' : _e, _f = _a.calendarPosition, calendarPosition = _f === void 0 ? 'popover' : _f, value = _a.value, dataTestId = _a.dataTestId, _g = _a.calendarProps, calendarProps = _g === void 0 ? {} : _g, _h = _a.minDate, minDate = _h === void 0 ? calendarProps.minDate : _h, _j = _a.maxDate, maxDate = _j === void 0 ? calendarProps.maxDate : _j, _k = _a.offDays, offDays = _k === void 0 ? calendarProps.offDays || [] : _k, preventFlip = _a.preventFlip, _l = _a.mobileMode, mobileMode = _l === void 0 ? 'popover' : _l, _m = _a.wrapperRef, wrapperRef = _m === void 0 ? null : _m, disabled = _a.disabled, onChange = _a.onChange, onInputChange = _a.onInputChange, onCalendarChange = _a.onCalendarChange, onKeyDown = _a.onKeyDown, readOnly = _a.readOnly, _o = _a.Calendar, Calendar = _o === void 0 ? coreComponentsCalendar.Calendar : _o, _p = _a.popoverPosition, popoverPosition = _p === void 0 ? 'bottom-start' : _p, useAnchorWidth = _a.useAnchorWidth, rightAddons = _a.rightAddons, restProps = __rest(_a, ["block", "className", "inputClassName", "popoverClassName", "defaultOpen", "defaultMonth", "defaultValue", "calendarPosition", "value", "dataTestId", "calendarProps", "minDate", "maxDate", "offDays", "preventFlip", "mobileMode", "wrapperRef", "disabled", "onChange", "onInputChange", "onCalendarChange", "onKeyDown", "readOnly", "Calendar", "popoverPosition", "useAnchorWidth", "rightAddons"]);
|
|
63
63
|
var uncontrolled = value === undefined;
|
|
64
64
|
var shouldRenderNative = coreComponentsDateInput.SUPPORTS_INPUT_TYPE_DATE && mobileMode === 'native';
|
|
65
65
|
var shouldRenderOnlyInput = mobileMode === 'input';
|
|
@@ -104,7 +104,9 @@ var CalendarInput = React.forwardRef(function (_a, ref) {
|
|
|
104
104
|
event.preventDefault();
|
|
105
105
|
calendarRef.current.focus();
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
if (onKeyDown)
|
|
108
|
+
onKeyDown(event);
|
|
109
|
+
}, [onKeyDown]);
|
|
108
110
|
var changeHandler = React.useCallback(function (event, newValue, newDate, initiator, shouldChange) {
|
|
109
111
|
if (initiator === void 0) { initiator = 'input'; }
|
|
110
112
|
if (shouldChange === void 0) { shouldChange = true; }
|
|
@@ -156,9 +158,11 @@ var CalendarInput = React.forwardRef(function (_a, ref) {
|
|
|
156
158
|
React__default['default'].createElement("div", { className: cn__default['default'](styles__default['default'].component, className, (_b = {},
|
|
157
159
|
_b[styles__default['default'].block] = block,
|
|
158
160
|
_b)), tabIndex: -1, onKeyDown: inputDisabled ? undefined : handleKeyDown, onClick: inputDisabled ? undefined : handleClick, onFocus: inputDisabled ? undefined : handleFocus, onBlur: handleBlur, "data-test-id": dataTestId },
|
|
159
|
-
React__default['default'].createElement(coreComponentsDateInput.DateInput, __assign({}, restProps, { ref: ref, wrapperRef: mergeRefs__default['default']([wrapperRef, inputWrapperRef]),
|
|
161
|
+
React__default['default'].createElement(coreComponentsDateInput.DateInput, __assign({}, restProps, { ref: ref, wrapperRef: mergeRefs__default['default']([wrapperRef, inputWrapperRef]), value: inputValue, defaultValue: defaultValue, disabled: disabled, readOnly: readOnly, mobileMode: mobileMode === 'native' ? 'native' : 'input', rightAddons: React__default['default'].createElement(React__default['default'].Fragment, null,
|
|
162
|
+
rightAddons,
|
|
163
|
+
React__default['default'].createElement(CalendarMIcon.CalendarMIcon, { className: styles__default['default'].calendarIcon })), onKeyDown: handleInputKeyDown, onChange: handleInputChange, block: true })),
|
|
160
164
|
shouldRenderStatic && renderCalendar(),
|
|
161
|
-
shouldRenderPopover && (React__default['default'].createElement(coreComponentsPopover.Popover, { open: open, anchorElement: inputWrapperRef.current, popperClassName: styles__default['default'].calendarContainer, position: popoverPosition, offset: [0, 8], withTransition: false, preventFlip: preventFlip }, renderCalendar()))));
|
|
165
|
+
shouldRenderPopover && (React__default['default'].createElement(coreComponentsPopover.Popover, { open: open, useAnchorWidth: useAnchorWidth, anchorElement: inputWrapperRef.current, popperClassName: styles__default['default'].calendarContainer, className: popoverClassName, position: popoverPosition, offset: [0, 8], withTransition: false, preventFlip: preventFlip }, renderCalendar()))));
|
|
162
166
|
});
|
|
163
167
|
|
|
164
168
|
exports.CalendarInput = CalendarInput;
|
|
@@ -55,8 +55,14 @@
|
|
|
55
55
|
box-sizing: border-box;
|
|
56
56
|
box-shadow: var(--shadow-s);
|
|
57
57
|
border: 1px solid var(--calendar-input-popover-border-color);
|
|
58
|
-
border-radius: var(--calendar-input-popover-border-radius)
|
|
58
|
+
border-radius: var(--calendar-input-popover-border-radius)
|
|
59
59
|
}
|
|
60
|
+
@media (max-width: 374px) {
|
|
61
|
+
.calendarContainer {
|
|
62
|
+
width: 100%;
|
|
63
|
+
min-width: 288px
|
|
64
|
+
}
|
|
65
|
+
}
|
|
60
66
|
.calendarIcon {
|
|
61
67
|
width: 24px;
|
|
62
68
|
height: 24px;
|
package/dist/esm/Component.d.ts
CHANGED
|
@@ -13,6 +13,10 @@ type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
|
|
|
13
13
|
* Дополнительный класс для инпута
|
|
14
14
|
*/
|
|
15
15
|
inputClassName?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Дополнительный класс для поповера
|
|
18
|
+
*/
|
|
19
|
+
popoverClassName?: string;
|
|
16
20
|
/**
|
|
17
21
|
* Доп. пропсы для календаря
|
|
18
22
|
*/
|
|
@@ -84,8 +88,12 @@ type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
|
|
|
84
88
|
* Позиционирование поповера с календарем
|
|
85
89
|
*/
|
|
86
90
|
popoverPosition?: PopoverProps['position'];
|
|
91
|
+
/**
|
|
92
|
+
* Календарь будет принимать ширину инпута
|
|
93
|
+
*/
|
|
94
|
+
useAnchorWidth?: boolean;
|
|
87
95
|
};
|
|
88
|
-
declare const CalendarInput: React.ForwardRefExoticComponent<Pick<DateInputProps, "children" | "value" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "dir" | "className" | "dataTestId" | "name" | "hidden" | "color" | "size" | "block" | "clear" | "multiple" | "disabled" | "leftAddons" | "rightAddons" | "colors" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "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" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "bottomAddons" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "
|
|
96
|
+
declare const CalendarInput: React.ForwardRefExoticComponent<Pick<DateInputProps, "children" | "value" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "dir" | "className" | "dataTestId" | "height" | "name" | "hidden" | "color" | "size" | "block" | "clear" | "multiple" | "disabled" | "leftAddons" | "rightAddons" | "colors" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "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" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "bottomAddons" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "max" | "maxLength" | "min" | "minLength" | "readOnly" | "required" | "src" | "width" | "success" | "inputClassName" | "focusedClassName" | "filledClassName" | "onClear" | "wrapperRef" | "keepCharPositions" | "minYear" | "maxYear"> & {
|
|
89
97
|
/**
|
|
90
98
|
* Дополнительный класс
|
|
91
99
|
*/
|
|
@@ -94,6 +102,10 @@ declare const CalendarInput: React.ForwardRefExoticComponent<Pick<DateInputProps
|
|
|
94
102
|
* Дополнительный класс для инпута
|
|
95
103
|
*/
|
|
96
104
|
inputClassName?: string | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Дополнительный класс для поповера
|
|
107
|
+
*/
|
|
108
|
+
popoverClassName?: string | undefined;
|
|
97
109
|
/**
|
|
98
110
|
* Доп. пропсы для календаря
|
|
99
111
|
*/
|
|
@@ -165,5 +177,9 @@ declare const CalendarInput: React.ForwardRefExoticComponent<Pick<DateInputProps
|
|
|
165
177
|
* Позиционирование поповера с календарем
|
|
166
178
|
*/
|
|
167
179
|
popoverPosition?: "top" | "bottom" | "right" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end" | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* Календарь будет принимать ширину инпута
|
|
182
|
+
*/
|
|
183
|
+
useAnchorWidth?: boolean | undefined;
|
|
168
184
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
169
185
|
export { CalendarInputProps, CalendarInput };
|
package/dist/esm/Component.js
CHANGED
|
@@ -45,12 +45,12 @@ function __rest(s, e) {
|
|
|
45
45
|
return t;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
var styles = {"component":"calendar-
|
|
48
|
+
var styles = {"component":"calendar-input__component_7j6g4","block":"calendar-input__block_7j6g4","calendarContainer":"calendar-input__calendarContainer_7j6g4","calendarIcon":"calendar-input__calendarIcon_7j6g4","nativeInput":"calendar-input__nativeInput_7j6g4"};
|
|
49
49
|
require('./index.css')
|
|
50
50
|
|
|
51
51
|
var CalendarInput = forwardRef(function (_a, ref) {
|
|
52
52
|
var _b;
|
|
53
|
-
var _c = _a.block, block = _c === void 0 ? false : _c, className = _a.className, inputClassName = _a.inputClassName, _d = _a.defaultOpen, defaultOpen = _d === void 0 ? false : _d, defaultMonth = _a.defaultMonth, _e = _a.defaultValue, defaultValue = _e === void 0 ? '' : _e, _f = _a.calendarPosition, calendarPosition = _f === void 0 ? 'popover' : _f, value = _a.value, dataTestId = _a.dataTestId, _g = _a.calendarProps, calendarProps = _g === void 0 ? {} : _g, _h = _a.minDate, minDate = _h === void 0 ? calendarProps.minDate : _h, _j = _a.maxDate, maxDate = _j === void 0 ? calendarProps.maxDate : _j, _k = _a.offDays, offDays = _k === void 0 ? calendarProps.offDays || [] : _k, preventFlip = _a.preventFlip, _l = _a.mobileMode, mobileMode = _l === void 0 ? 'popover' : _l, _m = _a.wrapperRef, wrapperRef = _m === void 0 ? null : _m, disabled = _a.disabled, onChange = _a.onChange, onInputChange = _a.onInputChange, onCalendarChange = _a.onCalendarChange, readOnly = _a.readOnly, _o = _a.Calendar, Calendar$1 = _o === void 0 ? Calendar : _o, _p = _a.popoverPosition, popoverPosition = _p === void 0 ? 'bottom-start' : _p, restProps = __rest(_a, ["block", "className", "inputClassName", "defaultOpen", "defaultMonth", "defaultValue", "calendarPosition", "value", "dataTestId", "calendarProps", "minDate", "maxDate", "offDays", "preventFlip", "mobileMode", "wrapperRef", "disabled", "onChange", "onInputChange", "onCalendarChange", "readOnly", "Calendar", "popoverPosition"]);
|
|
53
|
+
var _c = _a.block, block = _c === void 0 ? false : _c, className = _a.className, inputClassName = _a.inputClassName, popoverClassName = _a.popoverClassName, _d = _a.defaultOpen, defaultOpen = _d === void 0 ? false : _d, defaultMonth = _a.defaultMonth, _e = _a.defaultValue, defaultValue = _e === void 0 ? '' : _e, _f = _a.calendarPosition, calendarPosition = _f === void 0 ? 'popover' : _f, value = _a.value, dataTestId = _a.dataTestId, _g = _a.calendarProps, calendarProps = _g === void 0 ? {} : _g, _h = _a.minDate, minDate = _h === void 0 ? calendarProps.minDate : _h, _j = _a.maxDate, maxDate = _j === void 0 ? calendarProps.maxDate : _j, _k = _a.offDays, offDays = _k === void 0 ? calendarProps.offDays || [] : _k, preventFlip = _a.preventFlip, _l = _a.mobileMode, mobileMode = _l === void 0 ? 'popover' : _l, _m = _a.wrapperRef, wrapperRef = _m === void 0 ? null : _m, disabled = _a.disabled, onChange = _a.onChange, onInputChange = _a.onInputChange, onCalendarChange = _a.onCalendarChange, onKeyDown = _a.onKeyDown, readOnly = _a.readOnly, _o = _a.Calendar, Calendar$1 = _o === void 0 ? Calendar : _o, _p = _a.popoverPosition, popoverPosition = _p === void 0 ? 'bottom-start' : _p, useAnchorWidth = _a.useAnchorWidth, rightAddons = _a.rightAddons, restProps = __rest(_a, ["block", "className", "inputClassName", "popoverClassName", "defaultOpen", "defaultMonth", "defaultValue", "calendarPosition", "value", "dataTestId", "calendarProps", "minDate", "maxDate", "offDays", "preventFlip", "mobileMode", "wrapperRef", "disabled", "onChange", "onInputChange", "onCalendarChange", "onKeyDown", "readOnly", "Calendar", "popoverPosition", "useAnchorWidth", "rightAddons"]);
|
|
54
54
|
var uncontrolled = value === undefined;
|
|
55
55
|
var shouldRenderNative = SUPPORTS_INPUT_TYPE_DATE && mobileMode === 'native';
|
|
56
56
|
var shouldRenderOnlyInput = mobileMode === 'input';
|
|
@@ -95,7 +95,9 @@ var CalendarInput = forwardRef(function (_a, ref) {
|
|
|
95
95
|
event.preventDefault();
|
|
96
96
|
calendarRef.current.focus();
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
if (onKeyDown)
|
|
99
|
+
onKeyDown(event);
|
|
100
|
+
}, [onKeyDown]);
|
|
99
101
|
var changeHandler = useCallback(function (event, newValue, newDate, initiator, shouldChange) {
|
|
100
102
|
if (initiator === void 0) { initiator = 'input'; }
|
|
101
103
|
if (shouldChange === void 0) { shouldChange = true; }
|
|
@@ -147,9 +149,11 @@ var CalendarInput = forwardRef(function (_a, ref) {
|
|
|
147
149
|
React.createElement("div", { className: cn(styles.component, className, (_b = {},
|
|
148
150
|
_b[styles.block] = block,
|
|
149
151
|
_b)), tabIndex: -1, onKeyDown: inputDisabled ? undefined : handleKeyDown, onClick: inputDisabled ? undefined : handleClick, onFocus: inputDisabled ? undefined : handleFocus, onBlur: handleBlur, "data-test-id": dataTestId },
|
|
150
|
-
React.createElement(DateInput, __assign({}, restProps, { ref: ref, wrapperRef: mergeRefs([wrapperRef, inputWrapperRef]),
|
|
152
|
+
React.createElement(DateInput, __assign({}, restProps, { ref: ref, wrapperRef: mergeRefs([wrapperRef, inputWrapperRef]), value: inputValue, defaultValue: defaultValue, disabled: disabled, readOnly: readOnly, mobileMode: mobileMode === 'native' ? 'native' : 'input', rightAddons: React.createElement(React.Fragment, null,
|
|
153
|
+
rightAddons,
|
|
154
|
+
React.createElement(CalendarMIcon, { className: styles.calendarIcon })), onKeyDown: handleInputKeyDown, onChange: handleInputChange, block: true })),
|
|
151
155
|
shouldRenderStatic && renderCalendar(),
|
|
152
|
-
shouldRenderPopover && (React.createElement(Popover, { open: open, anchorElement: inputWrapperRef.current, popperClassName: styles.calendarContainer, position: popoverPosition, offset: [0, 8], withTransition: false, preventFlip: preventFlip }, renderCalendar()))));
|
|
156
|
+
shouldRenderPopover && (React.createElement(Popover, { open: open, useAnchorWidth: useAnchorWidth, anchorElement: inputWrapperRef.current, popperClassName: styles.calendarContainer, className: popoverClassName, position: popoverPosition, offset: [0, 8], withTransition: false, preventFlip: preventFlip }, renderCalendar()))));
|
|
153
157
|
});
|
|
154
158
|
|
|
155
159
|
export { CalendarInput };
|
package/dist/esm/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: e3y9o */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-border-primary: #dbdee1;
|
|
4
4
|
--color-light-graphic-primary: #0b1f35;
|
|
@@ -43,31 +43,37 @@
|
|
|
43
43
|
--calendar-input-popover-border-color: var(--color-light-border-primary);
|
|
44
44
|
--calendar-input-popover-border-radius: var(--border-radius-m);
|
|
45
45
|
}
|
|
46
|
-
.calendar-
|
|
46
|
+
.calendar-input__component_7j6g4 {
|
|
47
47
|
display: inline-block;
|
|
48
48
|
outline: none;
|
|
49
49
|
position: relative;
|
|
50
50
|
}
|
|
51
|
-
.calendar-
|
|
51
|
+
.calendar-input__block_7j6g4 {
|
|
52
52
|
width: 100%;
|
|
53
53
|
}
|
|
54
|
-
.calendar-
|
|
54
|
+
.calendar-input__calendarContainer_7j6g4 {
|
|
55
55
|
display: inline-block;
|
|
56
56
|
box-sizing: border-box;
|
|
57
57
|
box-shadow: var(--shadow-s);
|
|
58
58
|
border: 1px solid var(--calendar-input-popover-border-color);
|
|
59
|
-
border-radius: var(--calendar-input-popover-border-radius)
|
|
59
|
+
border-radius: var(--calendar-input-popover-border-radius)
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
@media (max-width: 374px) {
|
|
62
|
+
.calendar-input__calendarContainer_7j6g4 {
|
|
63
|
+
width: 100%;
|
|
64
|
+
min-width: 288px
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
.calendar-input__calendarIcon_7j6g4 {
|
|
62
68
|
width: 24px;
|
|
63
69
|
height: 24px;
|
|
64
70
|
display: block;
|
|
65
71
|
color: var(--calendar-input-icon-color)
|
|
66
72
|
}
|
|
67
|
-
.calendar-
|
|
73
|
+
.calendar-input__calendarIcon_7j6g4:not(:only-child) {
|
|
68
74
|
margin-right: var(--gap-2xs);
|
|
69
75
|
}
|
|
70
|
-
.calendar-
|
|
76
|
+
.calendar-input__nativeInput_7j6g4 {
|
|
71
77
|
opacity: 0;
|
|
72
78
|
position: absolute;
|
|
73
79
|
top: 0;
|
|
@@ -78,9 +84,9 @@
|
|
|
78
84
|
appearance: none;
|
|
79
85
|
z-index: 1
|
|
80
86
|
}
|
|
81
|
-
.calendar-
|
|
87
|
+
.calendar-input__nativeInput_7j6g4::-webkit-calendar-picker-indicator {
|
|
82
88
|
display: none;
|
|
83
89
|
}
|
|
84
|
-
.calendar-
|
|
90
|
+
.calendar-input__nativeInput_7j6g4::-webkit-inner-spin-button {
|
|
85
91
|
display: none;
|
|
86
92
|
}
|
package/dist/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: e3y9o */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-border-primary: #dbdee1;
|
|
4
4
|
--color-light-graphic-primary: #0b1f35;
|
|
@@ -43,31 +43,37 @@
|
|
|
43
43
|
--calendar-input-popover-border-color: var(--color-light-border-primary);
|
|
44
44
|
--calendar-input-popover-border-radius: var(--border-radius-m);
|
|
45
45
|
}
|
|
46
|
-
.calendar-
|
|
46
|
+
.calendar-input__component_7j6g4 {
|
|
47
47
|
display: inline-block;
|
|
48
48
|
outline: none;
|
|
49
49
|
position: relative;
|
|
50
50
|
}
|
|
51
|
-
.calendar-
|
|
51
|
+
.calendar-input__block_7j6g4 {
|
|
52
52
|
width: 100%;
|
|
53
53
|
}
|
|
54
|
-
.calendar-
|
|
54
|
+
.calendar-input__calendarContainer_7j6g4 {
|
|
55
55
|
display: inline-block;
|
|
56
56
|
box-sizing: border-box;
|
|
57
57
|
box-shadow: var(--shadow-s);
|
|
58
58
|
border: 1px solid var(--calendar-input-popover-border-color);
|
|
59
|
-
border-radius: var(--calendar-input-popover-border-radius)
|
|
59
|
+
border-radius: var(--calendar-input-popover-border-radius)
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
@media (max-width: 374px) {
|
|
62
|
+
.calendar-input__calendarContainer_7j6g4 {
|
|
63
|
+
width: 100%;
|
|
64
|
+
min-width: 288px
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
.calendar-input__calendarIcon_7j6g4 {
|
|
62
68
|
width: 24px;
|
|
63
69
|
height: 24px;
|
|
64
70
|
display: block;
|
|
65
71
|
color: var(--calendar-input-icon-color)
|
|
66
72
|
}
|
|
67
|
-
.calendar-
|
|
73
|
+
.calendar-input__calendarIcon_7j6g4:not(:only-child) {
|
|
68
74
|
margin-right: var(--gap-2xs);
|
|
69
75
|
}
|
|
70
|
-
.calendar-
|
|
76
|
+
.calendar-input__nativeInput_7j6g4 {
|
|
71
77
|
opacity: 0;
|
|
72
78
|
position: absolute;
|
|
73
79
|
top: 0;
|
|
@@ -78,9 +84,9 @@
|
|
|
78
84
|
appearance: none;
|
|
79
85
|
z-index: 1
|
|
80
86
|
}
|
|
81
|
-
.calendar-
|
|
87
|
+
.calendar-input__nativeInput_7j6g4::-webkit-calendar-picker-indicator {
|
|
82
88
|
display: none;
|
|
83
89
|
}
|
|
84
|
-
.calendar-
|
|
90
|
+
.calendar-input__nativeInput_7j6g4::-webkit-inner-spin-button {
|
|
85
91
|
display: none;
|
|
86
92
|
}
|
|
@@ -13,6 +13,10 @@ type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
|
|
|
13
13
|
* Дополнительный класс для инпута
|
|
14
14
|
*/
|
|
15
15
|
inputClassName?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Дополнительный класс для поповера
|
|
18
|
+
*/
|
|
19
|
+
popoverClassName?: string;
|
|
16
20
|
/**
|
|
17
21
|
* Доп. пропсы для календаря
|
|
18
22
|
*/
|
|
@@ -84,8 +88,12 @@ type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
|
|
|
84
88
|
* Позиционирование поповера с календарем
|
|
85
89
|
*/
|
|
86
90
|
popoverPosition?: PopoverProps['position'];
|
|
91
|
+
/**
|
|
92
|
+
* Календарь будет принимать ширину инпута
|
|
93
|
+
*/
|
|
94
|
+
useAnchorWidth?: boolean;
|
|
87
95
|
};
|
|
88
|
-
declare const CalendarInput: React.ForwardRefExoticComponent<Pick<DateInputProps, "children" | "value" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "dir" | "className" | "dataTestId" | "name" | "hidden" | "color" | "size" | "block" | "clear" | "multiple" | "disabled" | "leftAddons" | "rightAddons" | "colors" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "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" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "bottomAddons" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "
|
|
96
|
+
declare const CalendarInput: React.ForwardRefExoticComponent<Pick<DateInputProps, "children" | "value" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "dir" | "className" | "dataTestId" | "height" | "name" | "hidden" | "color" | "size" | "block" | "clear" | "multiple" | "disabled" | "leftAddons" | "rightAddons" | "colors" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "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" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "bottomAddons" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "max" | "maxLength" | "min" | "minLength" | "readOnly" | "required" | "src" | "width" | "success" | "inputClassName" | "focusedClassName" | "filledClassName" | "onClear" | "wrapperRef" | "keepCharPositions" | "minYear" | "maxYear"> & {
|
|
89
97
|
/**
|
|
90
98
|
* Дополнительный класс
|
|
91
99
|
*/
|
|
@@ -94,6 +102,10 @@ declare const CalendarInput: React.ForwardRefExoticComponent<Pick<DateInputProps
|
|
|
94
102
|
* Дополнительный класс для инпута
|
|
95
103
|
*/
|
|
96
104
|
inputClassName?: string | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Дополнительный класс для поповера
|
|
107
|
+
*/
|
|
108
|
+
popoverClassName?: string | undefined;
|
|
97
109
|
/**
|
|
98
110
|
* Доп. пропсы для календаря
|
|
99
111
|
*/
|
|
@@ -165,5 +177,9 @@ declare const CalendarInput: React.ForwardRefExoticComponent<Pick<DateInputProps
|
|
|
165
177
|
* Позиционирование поповера с календарем
|
|
166
178
|
*/
|
|
167
179
|
popoverPosition?: "top" | "bottom" | "right" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end" | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* Календарь будет принимать ширину инпута
|
|
182
|
+
*/
|
|
183
|
+
useAnchorWidth?: boolean | undefined;
|
|
168
184
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
169
185
|
export { CalendarInputProps, CalendarInput };
|
package/dist/modern/Component.js
CHANGED
|
@@ -6,10 +6,10 @@ import { parseDateString, isCompleteDateInput, formatDate, DateInput, SUPPORTS_I
|
|
|
6
6
|
import { Calendar, dateInLimits } from '@alfalab/core-components-calendar/dist/modern';
|
|
7
7
|
import { CalendarMIcon } from '@alfalab/icons-glyph/CalendarMIcon';
|
|
8
8
|
|
|
9
|
-
var styles = {"component":"calendar-
|
|
9
|
+
var styles = {"component":"calendar-input__component_7j6g4","block":"calendar-input__block_7j6g4","calendarContainer":"calendar-input__calendarContainer_7j6g4","calendarIcon":"calendar-input__calendarIcon_7j6g4","nativeInput":"calendar-input__nativeInput_7j6g4"};
|
|
10
10
|
require('./index.css')
|
|
11
11
|
|
|
12
|
-
const CalendarInput = forwardRef(({ block = false, className, inputClassName, defaultOpen = false, defaultMonth, defaultValue = '', calendarPosition = 'popover', value, dataTestId, calendarProps = {}, minDate = calendarProps.minDate, maxDate = calendarProps.maxDate, offDays = calendarProps.offDays || [], preventFlip, mobileMode = 'popover', wrapperRef = null, disabled, onChange, onInputChange, onCalendarChange, readOnly, Calendar: Calendar$1 = Calendar, popoverPosition = 'bottom-start', ...restProps }, ref) => {
|
|
12
|
+
const CalendarInput = forwardRef(({ block = false, className, inputClassName, popoverClassName, defaultOpen = false, defaultMonth, defaultValue = '', calendarPosition = 'popover', value, dataTestId, calendarProps = {}, minDate = calendarProps.minDate, maxDate = calendarProps.maxDate, offDays = calendarProps.offDays || [], preventFlip, mobileMode = 'popover', wrapperRef = null, disabled, onChange, onInputChange, onCalendarChange, onKeyDown, readOnly, Calendar: Calendar$1 = Calendar, popoverPosition = 'bottom-start', useAnchorWidth, rightAddons, ...restProps }, ref) => {
|
|
13
13
|
const uncontrolled = value === undefined;
|
|
14
14
|
const shouldRenderNative = SUPPORTS_INPUT_TYPE_DATE && mobileMode === 'native';
|
|
15
15
|
const shouldRenderOnlyInput = mobileMode === 'input';
|
|
@@ -54,7 +54,9 @@ const CalendarInput = forwardRef(({ block = false, className, inputClassName, de
|
|
|
54
54
|
event.preventDefault();
|
|
55
55
|
calendarRef.current.focus();
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
if (onKeyDown)
|
|
58
|
+
onKeyDown(event);
|
|
59
|
+
}, [onKeyDown]);
|
|
58
60
|
const changeHandler = useCallback((event, newValue, newDate, initiator = 'input', shouldChange = true) => {
|
|
59
61
|
if (initiator === 'input' && event && onInputChange) {
|
|
60
62
|
onInputChange(event, { value: newValue, date: newDate });
|
|
@@ -104,9 +106,11 @@ const CalendarInput = forwardRef(({ block = false, className, inputClassName, de
|
|
|
104
106
|
React.createElement("div", { className: cn(styles.component, className, {
|
|
105
107
|
[styles.block]: block,
|
|
106
108
|
}), tabIndex: -1, onKeyDown: inputDisabled ? undefined : handleKeyDown, onClick: inputDisabled ? undefined : handleClick, onFocus: inputDisabled ? undefined : handleFocus, onBlur: handleBlur, "data-test-id": dataTestId },
|
|
107
|
-
React.createElement(DateInput, Object.assign({}, restProps, { ref: ref, wrapperRef: mergeRefs([wrapperRef, inputWrapperRef]),
|
|
109
|
+
React.createElement(DateInput, Object.assign({}, restProps, { ref: ref, wrapperRef: mergeRefs([wrapperRef, inputWrapperRef]), value: inputValue, defaultValue: defaultValue, disabled: disabled, readOnly: readOnly, mobileMode: mobileMode === 'native' ? 'native' : 'input', rightAddons: React.createElement(React.Fragment, null,
|
|
110
|
+
rightAddons,
|
|
111
|
+
React.createElement(CalendarMIcon, { className: styles.calendarIcon })), onKeyDown: handleInputKeyDown, onChange: handleInputChange, block: true })),
|
|
108
112
|
shouldRenderStatic && renderCalendar(),
|
|
109
|
-
shouldRenderPopover && (React.createElement(Popover, { open: open, anchorElement: inputWrapperRef.current, popperClassName: styles.calendarContainer, position: popoverPosition, offset: [0, 8], withTransition: false, preventFlip: preventFlip }, renderCalendar()))));
|
|
113
|
+
shouldRenderPopover && (React.createElement(Popover, { open: open, useAnchorWidth: useAnchorWidth, anchorElement: inputWrapperRef.current, popperClassName: styles.calendarContainer, className: popoverClassName, position: popoverPosition, offset: [0, 8], withTransition: false, preventFlip: preventFlip }, renderCalendar()))));
|
|
110
114
|
});
|
|
111
115
|
|
|
112
116
|
export { CalendarInput };
|
package/dist/modern/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: e3y9o */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-border-primary: #dbdee1;
|
|
4
4
|
--color-light-graphic-primary: #0b1f35;
|
|
@@ -43,31 +43,37 @@
|
|
|
43
43
|
--calendar-input-popover-border-color: var(--color-light-border-primary);
|
|
44
44
|
--calendar-input-popover-border-radius: var(--border-radius-m);
|
|
45
45
|
}
|
|
46
|
-
.calendar-
|
|
46
|
+
.calendar-input__component_7j6g4 {
|
|
47
47
|
display: inline-block;
|
|
48
48
|
outline: none;
|
|
49
49
|
position: relative;
|
|
50
50
|
}
|
|
51
|
-
.calendar-
|
|
51
|
+
.calendar-input__block_7j6g4 {
|
|
52
52
|
width: 100%;
|
|
53
53
|
}
|
|
54
|
-
.calendar-
|
|
54
|
+
.calendar-input__calendarContainer_7j6g4 {
|
|
55
55
|
display: inline-block;
|
|
56
56
|
box-sizing: border-box;
|
|
57
57
|
box-shadow: var(--shadow-s);
|
|
58
58
|
border: 1px solid var(--calendar-input-popover-border-color);
|
|
59
|
-
border-radius: var(--calendar-input-popover-border-radius)
|
|
59
|
+
border-radius: var(--calendar-input-popover-border-radius)
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
@media (max-width: 374px) {
|
|
62
|
+
.calendar-input__calendarContainer_7j6g4 {
|
|
63
|
+
width: 100%;
|
|
64
|
+
min-width: 288px
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
.calendar-input__calendarIcon_7j6g4 {
|
|
62
68
|
width: 24px;
|
|
63
69
|
height: 24px;
|
|
64
70
|
display: block;
|
|
65
71
|
color: var(--calendar-input-icon-color)
|
|
66
72
|
}
|
|
67
|
-
.calendar-
|
|
73
|
+
.calendar-input__calendarIcon_7j6g4:not(:only-child) {
|
|
68
74
|
margin-right: var(--gap-2xs);
|
|
69
75
|
}
|
|
70
|
-
.calendar-
|
|
76
|
+
.calendar-input__nativeInput_7j6g4 {
|
|
71
77
|
opacity: 0;
|
|
72
78
|
position: absolute;
|
|
73
79
|
top: 0;
|
|
@@ -78,9 +84,9 @@
|
|
|
78
84
|
appearance: none;
|
|
79
85
|
z-index: 1
|
|
80
86
|
}
|
|
81
|
-
.calendar-
|
|
87
|
+
.calendar-input__nativeInput_7j6g4::-webkit-calendar-picker-indicator {
|
|
82
88
|
display: none;
|
|
83
89
|
}
|
|
84
|
-
.calendar-
|
|
90
|
+
.calendar-input__nativeInput_7j6g4::-webkit-inner-spin-button {
|
|
85
91
|
display: none;
|
|
86
92
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-calendar-input",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.2",
|
|
4
4
|
"description": "Calendar input component",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"react-dom": "^16.9.0 || ^17.0.1"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@alfalab/core-components-calendar": "^
|
|
23
|
-
"@alfalab/core-components-date-input": "^1.2.
|
|
24
|
-
"@alfalab/core-components-popover": "^5.
|
|
22
|
+
"@alfalab/core-components-calendar": "^4.0.0",
|
|
23
|
+
"@alfalab/core-components-date-input": "^1.2.7",
|
|
24
|
+
"@alfalab/core-components-popover": "^5.6.0",
|
|
25
25
|
"classnames": "^2.2.6",
|
|
26
26
|
"date-fns": "^2.16.1",
|
|
27
27
|
"react-merge-refs": "^1.1.0"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "4b32bf362777c910cd896057689e6035b3c4ad2e"
|
|
30
30
|
}
|