@alfalab/core-components-slider-input 4.4.5 → 5.0.0

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.
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import React from 'react';
3
3
  import { ChangeEvent, FC, ReactNode } from "react";
4
+ import { SliderProps } from "@alfalab/core-components-slider";
4
5
  import { InputProps } from "@alfalab/core-components-input";
5
6
  type SliderInputProps = Omit<InputProps, 'min' | 'max' | 'step' | 'value' | 'type' | 'onChange' | 'bottomAddons'> & {
6
7
  /**
@@ -16,9 +17,15 @@ type SliderInputProps = Omit<InputProps, 'min' | 'max' | 'step' | 'value' | 'typ
16
17
  */
17
18
  step?: number;
18
19
  /**
19
- * Массив подписей к слайдеру
20
+ * Отображение подписей
21
+ * https://refreshless.com/nouislider/pips/
20
22
  */
21
- steps?: ReactNode[];
23
+ pips?: SliderProps['pips'];
24
+ /**
25
+ * Настройка шагов
26
+ * https://refreshless.com/nouislider/pips/#section-range
27
+ */
28
+ range?: SliderProps['range'];
22
29
  /**
23
30
  * Значение инпута
24
31
  */
@@ -47,14 +54,10 @@ type SliderInputProps = Omit<InputProps, 'min' | 'max' | 'step' | 'value' | 'typ
47
54
  * Класс для слайдера
48
55
  */
49
56
  sliderClassName?: string;
50
- /**
51
- * Класс для шагов
52
- */
53
- stepsClassName?: string;
54
57
  /**
55
58
  * Обработчик изменения значения через слайдер или поле ввода
56
59
  */
57
- onChange?: (event: ChangeEvent<HTMLInputElement>, payload: {
60
+ onChange?: (event: ChangeEvent<HTMLInputElement> | null, payload: {
58
61
  value: number | '';
59
62
  }) => void;
60
63
  /**
@@ -66,7 +69,7 @@ type SliderInputProps = Omit<InputProps, 'min' | 'max' | 'step' | 'value' | 'typ
66
69
  /**
67
70
  * Обработчик изменения слайдера
68
71
  */
69
- onSliderChange?: (event: ChangeEvent<HTMLInputElement>, payload: {
72
+ onSliderChange?: (payload: {
70
73
  value: number;
71
74
  }) => void;
72
75
  /**
@@ -74,7 +77,7 @@ type SliderInputProps = Omit<InputProps, 'min' | 'max' | 'step' | 'value' | 'typ
74
77
  */
75
78
  dataTestId?: string;
76
79
  };
77
- declare const SliderInput: React.ForwardRefExoticComponent<Pick<InputProps, "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "disabled" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "maxLength" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "required" | "size" | "src" | "width" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "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" | "children" | "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" | "dataTestId" | "label" | "leftAddons" | "rightAddons" | "block" | "colors" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "clear" | "success" | "inputClassName" | "focusedClassName" | "filledClassName" | "onClear" | "wrapperRef"> & {
80
+ declare const SliderInput: React.ForwardRefExoticComponent<Pick<InputProps, "disabled" | "size" | "className" | "dataTestId" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "children" | "leftAddons" | "rightAddons" | "block" | "colors" | "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" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "height" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "src" | "width" | "clear" | "success" | "inputClassName" | "focusedClassName" | "filledClassName" | "onClear" | "wrapperRef"> & {
78
81
  /**
79
82
  * Мин. допустимое число
80
83
  */
@@ -88,9 +91,28 @@ declare const SliderInput: React.ForwardRefExoticComponent<Pick<InputProps, "acc
88
91
  */
89
92
  step?: number | undefined;
90
93
  /**
91
- * Массив подписей к слайдеру
92
- */
93
- steps?: React.ReactNode[] | undefined;
94
+ * Отображение подписей
95
+ * https://refreshless.com/nouislider/pips/
96
+ */
97
+ pips?: {
98
+ mode: "range" | "steps" | "positions" | "count" | "values";
99
+ values: number | number[];
100
+ filter?: ((value: number, type: 0 | 1 | 2 | -1) => 0 | 1 | 2 | -1) | undefined; /**
101
+ * Макс. допустимое число
102
+ */
103
+ format?: {
104
+ to: (value: number) => React.ReactText; /**
105
+ * Шаг (должен нацело делить отрезок между мин и макс)
106
+ */
107
+ from?: ((value: string) => number | false) | undefined;
108
+ } | undefined;
109
+ stepped?: boolean | undefined;
110
+ } | undefined;
111
+ /**
112
+ * Настройка шагов
113
+ * https://refreshless.com/nouislider/pips/#section-range
114
+ */
115
+ range?: Range | undefined;
94
116
  /**
95
117
  * Значение инпута
96
118
  */
@@ -106,7 +128,7 @@ declare const SliderInput: React.ForwardRefExoticComponent<Pick<InputProps, "acc
106
128
  /**
107
129
  * Компонент поля ввода
108
130
  */
109
- Input?: React.FC<Pick<InputProps, "min" | "max" | "step" | "type" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "disabled" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "maxLength" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "required" | "size" | "src" | "width" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "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" | "children" | "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" | "dataTestId" | "label" | "leftAddons" | "rightAddons" | "block" | "colors" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "bottomAddons" | "clear" | "success" | "inputClassName" | "focusedClassName" | "filledClassName" | "onClear" | "wrapperRef">> | undefined;
131
+ Input?: React.FC<Pick<InputProps, "min" | "max" | "step" | "disabled" | "size" | "className" | "dataTestId" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "children" | "leftAddons" | "rightAddons" | "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" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "bottomAddons" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "height" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "src" | "width" | "clear" | "success" | "inputClassName" | "focusedClassName" | "filledClassName" | "onClear" | "wrapperRef">> | undefined;
110
132
  /**
111
133
  * Кастомные пропсы для поля ввода
112
134
  */
@@ -119,14 +141,10 @@ declare const SliderInput: React.ForwardRefExoticComponent<Pick<InputProps, "acc
119
141
  * Класс для слайдера
120
142
  */
121
143
  sliderClassName?: string | undefined;
122
- /**
123
- * Класс для шагов
124
- */
125
- stepsClassName?: string | undefined;
126
144
  /**
127
145
  * Обработчик изменения значения через слайдер или поле ввода
128
146
  */
129
- onChange?: ((event: React.ChangeEvent<HTMLInputElement>, payload: {
147
+ onChange?: ((event: React.ChangeEvent<HTMLInputElement> | null, payload: {
130
148
  value: number | "";
131
149
  }) => void) | undefined;
132
150
  /**
@@ -138,7 +156,7 @@ declare const SliderInput: React.ForwardRefExoticComponent<Pick<InputProps, "acc
138
156
  /**
139
157
  * Обработчик изменения слайдера
140
158
  */
141
- onSliderChange?: ((event: React.ChangeEvent<HTMLInputElement>, payload: {
159
+ onSliderChange?: ((payload: {
142
160
  value: number;
143
161
  }) => void) | undefined;
144
162
  /**
@@ -1,21 +1,21 @@
1
- import React, { forwardRef, useCallback, Fragment, isValidElement, cloneElement } from 'react';
1
+ import React, { forwardRef, useCallback, Fragment } from 'react';
2
2
  import cn from 'classnames';
3
3
  import { Slider } from '@alfalab/core-components-slider/dist/modern';
4
4
  import { Input } from '@alfalab/core-components-input/dist/modern';
5
5
 
6
- var styles = {"component":"slider-input__component_zylre","block":"slider-input__block_zylre","slider":"slider-input__slider_zylre","field":"slider-input__field_zylre","input":"slider-input__input_zylre","steps":"slider-input__steps_zylre","info":"slider-input__info_zylre","s":"slider-input__s_zylre","hasLabel":"slider-input__hasLabel_zylre","m":"slider-input__m_zylre","l":"slider-input__l_zylre","xl":"slider-input__xl_zylre","focused":"slider-input__focused_zylre","filled":"slider-input__filled_zylre"};
6
+ var styles = {"component":"slider-input__component_grg9x","block":"slider-input__block_grg9x","slider":"slider-input__slider_grg9x","field":"slider-input__field_grg9x","input":"slider-input__input_grg9x","steps":"slider-input__steps_grg9x","info":"slider-input__info_grg9x","s":"slider-input__s_grg9x","hasLabel":"slider-input__hasLabel_grg9x","m":"slider-input__m_grg9x","l":"slider-input__l_grg9x","xl":"slider-input__xl_grg9x","focused":"slider-input__focused_grg9x","filled":"slider-input__filled_grg9x"};
7
7
  require('./index.css')
8
8
 
9
- const SliderInput = forwardRef(({ className, inputClassName, sliderClassName, stepsClassName, focusedClassName, fieldClassName, value = '', min = 0, max = 100, step = 1, block, sliderValue = +value, steps = [], size = 's', label, info, disabled, readOnly, onChange, onInputChange, onSliderChange, rightAddons, Input: Input$1 = Input, customInputProps = {}, dataTestId, error, ...restProps }, ref) => {
9
+ const SliderInput = forwardRef(({ className, inputClassName, sliderClassName, focusedClassName, fieldClassName, value = '', min = 0, max = 100, step = 1, block, sliderValue = +value, size = 's', label, info, disabled, readOnly, onChange, onInputChange, onSliderChange, rightAddons, Input: Input$1 = Input, customInputProps = {}, error, hint, pips, range, dataTestId, ...restProps }, ref) => {
10
10
  const getValidInputValue = useCallback((inputValue) => {
11
11
  const number = parseInt(inputValue, 10);
12
12
  return inputValue === '' || Number.isNaN(number) ? '' : Math.abs(number);
13
13
  }, []);
14
- const handleSliderChange = useCallback((event, payload) => {
14
+ const handleSliderChange = useCallback(payload => {
15
15
  if (onChange)
16
- onChange(event, payload);
16
+ onChange(null, payload);
17
17
  if (onSliderChange)
18
- onSliderChange(event, payload);
18
+ onSliderChange(payload);
19
19
  }, [onChange, onSliderChange]);
20
20
  const handleInputChange = useCallback((event, payload) => {
21
21
  if (onChange)
@@ -29,12 +29,9 @@ const SliderInput = forwardRef(({ className, inputClassName, sliderClassName, st
29
29
  [styles.hasLabel]: label,
30
30
  [styles.hasError]: Boolean(error),
31
31
  }, styles[size], className), "data-test-id": dataTestId },
32
- React.createElement(Input$1, Object.assign({}, restProps, customInputProps, { ref: ref, value: value.toString(), onChange: handleInputChange, block: true, size: size, label: label, disabled: disabled, readOnly: readOnly, className: cn(inputClassName, styles.input), focusedClassName: cn(focusedClassName, styles.focused), fieldClassName: cn(fieldClassName, styles.field), inputMode: 'numeric', pattern: '[0-9]*', error: error, bottomAddons: !disabled && (React.createElement(Slider, { min: min, max: max, step: step, onChange: handleSliderChange, ref: ref, value: Number.isNaN(sliderValue) ? 0 : sliderValue, disabled: disabled || readOnly, className: cn(styles.slider, sliderClassName) })), rightAddons: (info || rightAddons) && (React.createElement(Fragment, null,
32
+ React.createElement(Input$1, Object.assign({}, restProps, customInputProps, { ref: ref, value: value.toString(), onChange: handleInputChange, block: true, size: size, label: label, disabled: disabled, readOnly: readOnly, className: cn(inputClassName, styles.input), focusedClassName: cn(focusedClassName, styles.focused), fieldClassName: cn(fieldClassName, styles.field), inputMode: 'numeric', pattern: '[0-9]*', error: error, hint: hint, bottomAddons: !disabled && (React.createElement(Slider, { min: min, max: max, step: step, onChange: handleSliderChange, value: Number.isNaN(sliderValue) || !sliderValue ? min : sliderValue, disabled: disabled || readOnly, className: cn(styles.slider, sliderClassName), pips: !error && !hint ? pips : undefined, range: range })), rightAddons: (info || rightAddons) && (React.createElement(Fragment, null,
33
33
  info && React.createElement("span", { className: styles.info }, info),
34
- rightAddons)) })),
35
- steps.length > 0 && !error && (React.createElement("div", { className: cn(styles.steps, stepsClassName) }, steps.map((stepLabel, i) => isValidElement(stepLabel) ? (cloneElement(stepLabel, { key: i })) : (
36
- // eslint-disable-next-line react/no-array-index-key
37
- React.createElement("span", { key: i }, stepLabel)))))));
34
+ rightAddons)) }))));
38
35
  });
39
36
  /**
40
37
  * Для отображения в сторибуке
@@ -44,7 +41,6 @@ SliderInput.defaultProps = {
44
41
  min: 0,
45
42
  max: 100,
46
43
  step: 1,
47
- steps: [],
48
44
  size: 's',
49
45
  Input: Input,
50
46
  customInputProps: {},
@@ -1,4 +1,4 @@
1
- /* hash: 1d34z */
1
+ /* hash: zcfb2 */
2
2
  :root {
3
3
  --color-light-text-secondary: #546272;
4
4
  }
@@ -13,40 +13,44 @@
13
13
  :root {
14
14
  --gap-xs: 8px;
15
15
  }
16
+ :root {
17
+ --slider-progress-s-height: 2px;
18
+
19
+ /* Отступы по бокам — на мобилке thumb не должен заходить за края контрола */
20
+ }
16
21
  :root {
17
22
  --slider-input-steps-color: var(--color-light-text-secondary);
18
23
  --slider-input-info-color: var(--color-light-text-secondary);
19
24
  --slider-input-font-weight: 700;
20
25
  }
21
- .slider-input__component_zylre {
26
+ .slider-input__component_grg9x {
22
27
  position: relative;
23
28
  display: inline-block;
24
29
  }
25
- .slider-input__block_zylre {
30
+ .slider-input__block_grg9x {
26
31
  display: block;
27
32
  }
28
- .slider-input__slider_zylre {
29
- position: absolute;
30
- margin-top: -1px;
31
- transform: translateY(-50%)
33
+ .slider-input__slider_grg9x {
34
+ margin-top: calc(var(--slider-progress-s-height) / -2);
35
+ transform: translateY(-1px)
32
36
  }
33
- .slider-input__slider_zylre + * {
37
+ .slider-input__slider_grg9x + * {
34
38
  margin-top: var(--gap-xs);
35
39
  }
36
- .slider-input__field_zylre {
40
+ .slider-input__field_grg9x {
37
41
  border-bottom-left-radius: 0;
38
42
  border-bottom-right-radius: 0;
39
43
  }
40
- .slider-input__input_zylre input,
41
- .slider-input__input_zylre input + div {
44
+ .slider-input__input_grg9x input,
45
+ .slider-input__input_grg9x input + div {
42
46
  font-weight: var(--slider-input-font-weight);
43
47
  font-feature-settings: "tnum";
44
48
  font-variant-numeric: tabular-nums;
45
49
  }
46
- .slider-input__input_zylre input::placeholder {
50
+ .slider-input__input_grg9x input::placeholder {
47
51
  font-weight: 400;
48
52
  }
49
- .slider-input__steps_zylre {
53
+ .slider-input__steps_grg9x {
50
54
  font-size: 14px;
51
55
  line-height: 18px;
52
56
  font-weight: 400;
@@ -56,7 +60,7 @@
56
60
  margin-top: var(--gap-xs);
57
61
  color: var(--slider-input-steps-color);
58
62
  }
59
- .slider-input__info_zylre {
63
+ .slider-input__info_grg9x {
60
64
  font-size: 16px;
61
65
  line-height: 20px;
62
66
  font-weight: 400;
@@ -67,28 +71,28 @@
67
71
  transition: 0.2s ease;
68
72
  visibility: hidden;
69
73
  }
70
- .slider-input__s_zylre.slider-input__hasLabel_zylre .slider-input__info_zylre:first-child {
74
+ .slider-input__s_grg9x.slider-input__hasLabel_grg9x .slider-input__info_grg9x:first-child {
71
75
  padding: var(--form-control-labeled-s-paddings);
72
76
  padding-left: 0;
73
77
  padding-right: 0;
74
78
  }
75
- .slider-input__m_zylre.slider-input__hasLabel_zylre .slider-input__info_zylre:first-child {
79
+ .slider-input__m_grg9x.slider-input__hasLabel_grg9x .slider-input__info_grg9x:first-child {
76
80
  padding: var(--form-control-labeled-m-paddings);
77
81
  padding-left: 0;
78
82
  padding-right: 0;
79
83
  }
80
- .slider-input__l_zylre.slider-input__hasLabel_zylre .slider-input__info_zylre:first-child {
84
+ .slider-input__l_grg9x.slider-input__hasLabel_grg9x .slider-input__info_grg9x:first-child {
81
85
  padding: var(--form-control-labeled-l-paddings);
82
86
  padding-left: 0;
83
87
  padding-right: 0;
84
88
  }
85
- .slider-input__xl_zylre.slider-input__hasLabel_zylre .slider-input__info_zylre:first-child {
89
+ .slider-input__xl_grg9x.slider-input__hasLabel_grg9x .slider-input__info_grg9x:first-child {
86
90
  padding: var(--form-control-labeled-xl-paddings);
87
91
  padding-left: 0;
88
92
  padding-right: 0;
89
93
  }
90
- .slider-input__focused_zylre .slider-input__info_zylre,
91
- .slider-input__filled_zylre .slider-input__info_zylre {
94
+ .slider-input__focused_grg9x .slider-input__info_grg9x,
95
+ .slider-input__filled_grg9x .slider-input__info_grg9x {
92
96
  visibility: visible;
93
97
  opacity: 1;
94
98
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-slider-input",
3
- "version": "4.4.5",
3
+ "version": "5.0.0",
4
4
  "description": "Slider input component",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -20,10 +20,10 @@
20
20
  "react-dom": "^16.9.0 || ^17.0.1"
21
21
  },
22
22
  "dependencies": {
23
- "@alfalab/core-components-input": "^8.1.5",
24
- "@alfalab/core-components-slider": "^2.3.3",
25
- "classnames": "2.2.6",
26
- "react-merge-refs": "1.1.0"
23
+ "@alfalab/core-components-input": "^8.2.0",
24
+ "@alfalab/core-components-slider": "^3.0.0",
25
+ "classnames": "^2.2.6",
26
+ "react-merge-refs": "^1.1.0"
27
27
  },
28
- "gitHead": "b44d81f1c42835fa6946c4bf15aee99abe2b4b96"
28
+ "gitHead": "a33b1c28b472d5ed38cf6cf099112296f8d160c7"
29
29
  }