@consta/uikit 3.25.0 → 3.26.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.
- package/Attach/package.json +1 -1
- package/Attachment/package.json +1 -1
- package/Avatar/package.json +1 -1
- package/Badge/package.json +1 -1
- package/BasicSelectDeprecated/package.json +1 -1
- package/Breadcrumbs/package.json +1 -1
- package/BreadcrumbsCanary/package.json +1 -1
- package/Button/package.json +1 -1
- package/CHANGELOG.md +16 -7
- package/Calendar/package.json +1 -1
- package/Card/package.json +1 -1
- package/Checkbox/package.json +1 -1
- package/CheckboxGroup/package.json +1 -1
- package/CheckboxGroupCanary/package.json +1 -1
- package/ChoiceGroup/package.json +1 -1
- package/ChoiceGroupCanary/package.json +1 -1
- package/Collapse/package.json +1 -1
- package/CollapseGroup/package.json +1 -1
- package/Combobox/package.json +1 -1
- package/ComboboxDeprecated/package.json +1 -1
- package/ContextMenu/package.json +1 -1
- package/ContextMenuCanary/package.json +1 -1
- package/DatePickerCanary/package.json +1 -1
- package/DateTimeCanary/package.json +1 -1
- package/DragNDropField/package.json +1 -1
- package/EventInterceptor/package.json +1 -1
- package/FieldCaption/package.json +1 -1
- package/FieldGroup/package.json +1 -1
- package/FieldLabel/package.json +1 -1
- package/File/package.json +1 -1
- package/FileField/package.json +1 -1
- package/FileIcon/package.json +1 -1
- package/FileIconAvi/package.json +1 -1
- package/FileIconBmp/package.json +1 -1
- package/FileIconCsv/package.json +1 -1
- package/FileIconDoc/package.json +1 -1
- package/FileIconExe/package.json +1 -1
- package/FileIconGif/package.json +1 -1
- package/FileIconJpg/package.json +1 -1
- package/FileIconJson/package.json +1 -1
- package/FileIconLoading/package.json +1 -1
- package/FileIconMov/package.json +1 -1
- package/FileIconMp3/package.json +1 -1
- package/FileIconMp4/package.json +1 -1
- package/FileIconPdf/package.json +1 -1
- package/FileIconPng/package.json +1 -1
- package/FileIconPpt/package.json +1 -1
- package/FileIconRar/package.json +1 -1
- package/FileIconRtf/package.json +1 -1
- package/FileIconTiff/package.json +1 -1
- package/FileIconTxt/package.json +1 -1
- package/FileIconUndefined/package.json +1 -1
- package/FileIconWav/package.json +1 -1
- package/FileIconXls/package.json +1 -1
- package/FileIconZip/package.json +1 -1
- package/Grid/package.json +1 -1
- package/Header/package.json +1 -1
- package/Icon/package.json +1 -1
- package/IconAdd/package.json +1 -1
- package/IconAddToComparison/package.json +1 -1
- package/IconAlert/package.json +1 -1
- package/IconAlignBlocksLeft/package.json +1 -1
- package/IconAlignBlocksRight/package.json +1 -1
- package/IconAlignCenter/package.json +1 -1
- package/IconAlignJustify/package.json +1 -1
- package/IconAlignLeft/package.json +1 -1
- package/IconAlignRight/package.json +1 -1
- package/IconAllDone/package.json +1 -1
- package/IconArrowDown/package.json +1 -1
- package/IconArrowLeft/package.json +1 -1
- package/IconArrowRight/package.json +1 -1
- package/IconArrowUp/package.json +1 -1
- package/IconArtBrush/package.json +1 -1
- package/IconAttach/package.json +1 -1
- package/IconBackward/package.json +1 -1
- package/IconBag/package.json +1 -1
- package/IconBarrier/package.json +1 -1
- package/IconBento/package.json +1 -1
- package/IconBold/package.json +1 -1
- package/IconBook/package.json +1 -1
- package/IconBookmarkFilled/package.json +1 -1
- package/IconBookmarkStroked/package.json +1 -1
- package/IconCalculator/package.json +1 -1
- package/IconCalendar/package.json +1 -1
- package/IconCamera/package.json +1 -1
- package/IconCancel/package.json +1 -1
- package/IconCards/package.json +1 -1
- package/IconChat/package.json +1 -1
- package/IconCheck/package.json +1 -1
- package/IconClose/package.json +1 -1
- package/IconCollapse/package.json +1 -1
- package/IconColorFill/package.json +1 -1
- package/IconColorText/package.json +1 -1
- package/IconColumns/package.json +1 -1
- package/IconComment/package.json +1 -1
- package/IconConnection/package.json +1 -1
- package/IconCopy/package.json +1 -1
- package/IconCrown/package.json +1 -1
- package/IconCursorMouse/package.json +1 -1
- package/IconDataNull/package.json +1 -1
- package/IconDiamond/package.json +1 -1
- package/IconDinosaur/package.json +1 -1
- package/IconDisconnection/package.json +1 -1
- package/IconDocAdd/package.json +1 -1
- package/IconDocBlank/package.json +1 -1
- package/IconDocDelete/package.json +1 -1
- package/IconDocExport/package.json +1 -1
- package/IconDocFilled/package.json +1 -1
- package/IconDown/package.json +1 -1
- package/IconDownload/package.json +1 -1
- package/IconDrag/package.json +1 -1
- package/IconDraggable/package.json +1 -1
- package/IconDrillingRig/package.json +1 -1
- package/IconDrop/package.json +1 -1
- package/IconEdit/package.json +1 -1
- package/IconExit/package.json +1 -1
- package/IconExpand/package.json +1 -1
- package/IconEye/package.json +1 -1
- package/IconEyeClose/package.json +1 -1
- package/IconFacebook/package.json +1 -1
- package/IconFavorite/package.json +1 -1
- package/IconFilter/package.json +1 -1
- package/IconFitToDefault/package.json +1 -1
- package/IconFlagFilled/package.json +1 -1
- package/IconFlagStroked/package.json +1 -1
- package/IconFolders/package.json +1 -1
- package/IconForward/package.json +1 -1
- package/IconFunnel/package.json +1 -1
- package/IconGas/package.json +1 -1
- package/IconGeo/package.json +1 -1
- package/IconGrouping/package.json +1 -1
- package/IconHamburger/package.json +1 -1
- package/IconHand/package.json +1 -1
- package/IconHealth/package.json +1 -1
- package/IconHome/package.json +1 -1
- package/IconInComparison/package.json +1 -1
- package/IconInfo/package.json +1 -1
- package/IconInstagram/package.json +1 -1
- package/IconIntroduction/package.json +1 -1
- package/IconIpad/package.json +1 -1
- package/IconItalic/package.json +1 -1
- package/IconKebab/package.json +1 -1
- package/IconLaptop/package.json +1 -1
- package/IconLayers/package.json +1 -1
- package/IconLeaf/package.json +1 -1
- package/IconLightningBolt/package.json +1 -1
- package/IconLineAndBarChart/package.json +1 -1
- package/IconLink/package.json +1 -1
- package/IconList/package.json +1 -1
- package/IconListNumbered/package.json +1 -1
- package/IconLock/package.json +1 -1
- package/IconLogicalElement/package.json +1 -1
- package/IconMBU/package.json +1 -1
- package/IconMGRP/package.json +1 -1
- package/IconMLSP/package.json +1 -1
- package/IconMMP/package.json +1 -1
- package/IconMail/package.json +1 -1
- package/IconMap/package.json +1 -1
- package/IconMaxHeight/package.json +1 -1
- package/IconMaxWidth/package.json +1 -1
- package/IconMeatball/package.json +1 -1
- package/IconMic/package.json +1 -1
- package/IconMolecules/package.json +1 -1
- package/IconMoon/package.json +1 -1
- package/IconNodeEnd/package.json +1 -1
- package/IconNodeStart/package.json +1 -1
- package/IconNodeStep/package.json +1 -1
- package/IconNodes/package.json +1 -1
- package/IconOpenInNew/package.json +1 -1
- package/IconOperators/package.json +1 -1
- package/IconPanelBottom/package.json +1 -1
- package/IconPanelLeft/package.json +1 -1
- package/IconPanelRight/package.json +1 -1
- package/IconPanelTop/package.json +1 -1
- package/IconPaste/package.json +1 -1
- package/IconPause/package.json +1 -1
- package/IconPhone/package.json +1 -1
- package/IconPhoto/package.json +1 -1
- package/IconPicture/package.json +1 -1
- package/IconPlay/package.json +1 -1
- package/IconPressure/package.json +1 -1
- package/IconPriceLabel/package.json +1 -1
- package/IconProcessing/package.json +1 -1
- package/IconQuestion/package.json +1 -1
- package/IconQuote/package.json +1 -1
- package/IconRUO/package.json +1 -1
- package/IconRUS/package.json +1 -1
- package/IconRecord/package.json +1 -1
- package/IconRemove/package.json +1 -1
- package/IconRemoveFromComparison/package.json +1 -1
- package/IconReply/package.json +1 -1
- package/IconResize/package.json +1 -1
- package/IconRestart/package.json +1 -1
- package/IconRevert/package.json +1 -1
- package/IconRing/package.json +1 -1
- package/IconRouble/package.json +1 -1
- package/IconRuler/package.json +1 -1
- package/IconSave/package.json +1 -1
- package/IconScreen/package.json +1 -1
- package/IconSearch/package.json +1 -1
- package/IconSelect/package.json +1 -1
- package/IconSelectOpen/package.json +1 -1
- package/IconSendMessage/package.json +1 -1
- package/IconSettings/package.json +1 -1
- package/IconShape/package.json +1 -1
- package/IconShuffle/package.json +1 -1
- package/IconSmile/package.json +1 -1
- package/IconSortDown/package.json +1 -1
- package/IconSortDownCenter/package.json +1 -1
- package/IconSortUp/package.json +1 -1
- package/IconSortUpCenter/package.json +1 -1
- package/IconStop/package.json +1 -1
- package/IconStorage/package.json +1 -1
- package/IconStrikethrough/package.json +1 -1
- package/IconSun/package.json +1 -1
- package/IconTable/package.json +1 -1
- package/IconTable2/package.json +1 -1
- package/IconTarget/package.json +1 -1
- package/IconTeam/package.json +1 -1
- package/IconTechResponse/package.json +1 -1
- package/IconTest/package.json +1 -1
- package/IconThumbUp/package.json +1 -1
- package/IconTie/package.json +1 -1
- package/IconTop/package.json +1 -1
- package/IconTrash/package.json +1 -1
- package/IconType/package.json +1 -1
- package/IconUnderline/package.json +1 -1
- package/IconUnlock/package.json +1 -1
- package/IconUnsort/package.json +1 -1
- package/IconUnsortCenter/package.json +1 -1
- package/IconUpload/package.json +1 -1
- package/IconUser/package.json +1 -1
- package/IconVZD/package.json +1 -1
- package/IconVideo/package.json +1 -1
- package/IconVkontakte/package.json +1 -1
- package/IconWarning/package.json +1 -1
- package/IconWatch/package.json +1 -1
- package/IconWideScreen/package.json +1 -1
- package/IconWorld/package.json +1 -1
- package/IconWrench/package.json +1 -1
- package/IconYandexDzen/package.json +1 -1
- package/IconYoutube/package.json +1 -1
- package/Informer/package.json +1 -1
- package/LayoutCanary/package.json +1 -1
- package/Loader/package.json +1 -1
- package/MixCard/package.json +1 -1
- package/MixFocus/package.json +1 -1
- package/MixPopoverAnimate/package.json +1 -1
- package/MixPopoverArrow/package.json +1 -1
- package/MixSpace/package.json +1 -1
- package/MixVisuallyHidden/package.json +1 -1
- package/Modal/package.json +1 -1
- package/MultiComboboxDeprecated/package.json +1 -1
- package/Pagination/package.json +1 -1
- package/Popover/package.json +1 -1
- package/PortalWithTheme/package.json +1 -1
- package/ProgressLine/es.js +1 -0
- package/ProgressLine/index.d.ts +1 -0
- package/ProgressLine/index.js +4 -0
- package/ProgressLine/package.json +9 -0
- package/ProgressSpin/package.json +1 -1
- package/ProgressStepBarCanary/package.json +1 -1
- package/Radio/package.json +1 -1
- package/RadioGroup/package.json +1 -1
- package/Responses/package.json +1 -1
- package/Responses403/package.json +1 -1
- package/Responses404/package.json +1 -1
- package/Responses500/package.json +1 -1
- package/Responses503/package.json +1 -1
- package/ResponsesConnectionError/package.json +1 -1
- package/ResponsesDeleted/package.json +1 -1
- package/ResponsesEmptyBox/package.json +1 -1
- package/ResponsesEmptyPockets/package.json +1 -1
- package/ResponsesExit/package.json +1 -1
- package/ResponsesImage/package.json +1 -1
- package/ResponsesImage403/package.json +1 -1
- package/ResponsesImage404/package.json +1 -1
- package/ResponsesImage500/package.json +1 -1
- package/ResponsesImage503/package.json +1 -1
- package/ResponsesImageConnectionError/package.json +1 -1
- package/ResponsesImageDeleted/package.json +1 -1
- package/ResponsesImageEmptyBox/package.json +1 -1
- package/ResponsesImageEmptyPockets/package.json +1 -1
- package/ResponsesImageNothingFound/package.json +1 -1
- package/ResponsesImageSuccess/package.json +1 -1
- package/ResponsesNothingFound/package.json +1 -1
- package/ResponsesSuccess/package.json +1 -1
- package/Select/package.json +1 -1
- package/Sidebar/package.json +1 -1
- package/Skeleton/package.json +1 -1
- package/SliderCanary/package.json +1 -1
- package/SnackBar/package.json +1 -1
- package/Steps/package.json +1 -1
- package/StepsCanary/package.json +1 -1
- package/Switch/package.json +1 -1
- package/SwitchGroup/package.json +1 -1
- package/SwitchGroupCanary/package.json +1 -1
- package/Table/package.json +1 -1
- package/Tabs/package.json +1 -1
- package/TabsCanary/package.json +1 -1
- package/Tag/package.json +1 -1
- package/TagBase/package.json +1 -1
- package/Text/package.json +1 -1
- package/TextField/package.json +1 -1
- package/Theme/package.json +1 -1
- package/ThemeToggler/package.json +1 -1
- package/Timer/package.json +1 -1
- package/Tooltip/package.json +1 -1
- package/User/package.json +1 -1
- package/UserSelect/package.json +1 -1
- package/UserSelectDeprecated/package.json +1 -1
- package/__internal__/cjs-src/components/EventInterceptor/propsHandlers/useTextFieldEventsHandler.d.ts +8 -1
- package/__internal__/cjs-src/components/ProgressLine/ProgressLine.css +67 -0
- package/__internal__/cjs-src/components/ProgressLine/ProgressLine.d.ts +3 -0
- package/__internal__/cjs-src/components/ProgressLine/ProgressLine.js +27 -0
- package/__internal__/cjs-src/components/ProgressLine/types.d.ts +10 -0
- package/__internal__/cjs-src/components/ProgressLine/types.js +5 -0
- package/__internal__/cjs-src/components/ProgressSpin/ProgressSpin.d.ts +1 -0
- package/__internal__/cjs-src/components/ProgressSpin/ProgressSpin.js +2 -1
- package/__internal__/cjs-src/components/SliderCanary/SliderCanary.js +19 -11
- package/__internal__/cjs-src/components/SliderCanary/SliderLine/SliderLine.css +2 -2
- package/__internal__/cjs-src/components/SliderCanary/SliderPoint/SliderPoint.css +2 -4
- package/__internal__/cjs-src/components/SliderCanary/useSlider/helper.d.ts +3 -2
- package/__internal__/cjs-src/components/SliderCanary/useSlider/helper.js +37 -14
- package/__internal__/cjs-src/components/SliderCanary/useSlider/useSlider.d.ts +1 -0
- package/__internal__/cjs-src/components/SliderCanary/useSlider/useSlider.js +32 -4
- package/__internal__/cjs-src/components/SliderCanary/useSliderStationing.d.ts +1 -1
- package/__internal__/cjs-src/components/SliderCanary/useSliderStationing.js +14 -3
- package/__internal__/cjs-src/components/TextField/TextField.js +13 -5
- package/__internal__/cjs-src/components/TextField/types.d.ts +7 -0
- package/__internal__/cjs-src/components/User/User.css +1 -0
- package/__internal__/src/components/EventInterceptor/propsHandlers/useTextFieldEventsHandler.d.ts +8 -1
- package/__internal__/src/components/ProgressLine/ProgressLine.css +67 -0
- package/__internal__/src/components/ProgressLine/ProgressLine.d.ts +3 -0
- package/__internal__/src/components/ProgressLine/ProgressLine.js +24 -0
- package/__internal__/src/components/ProgressLine/types.d.ts +10 -0
- package/__internal__/src/components/ProgressLine/types.js +2 -0
- package/__internal__/src/components/ProgressSpin/ProgressSpin.d.ts +1 -0
- package/__internal__/src/components/ProgressSpin/ProgressSpin.js +2 -1
- package/__internal__/src/components/SliderCanary/SliderCanary.js +19 -11
- package/__internal__/src/components/SliderCanary/SliderLine/SliderLine.css +2 -2
- package/__internal__/src/components/SliderCanary/SliderPoint/SliderPoint.css +2 -4
- package/__internal__/src/components/SliderCanary/useSlider/helper.d.ts +3 -2
- package/__internal__/src/components/SliderCanary/useSlider/helper.js +37 -14
- package/__internal__/src/components/SliderCanary/useSlider/useSlider.d.ts +1 -0
- package/__internal__/src/components/SliderCanary/useSlider/useSlider.js +32 -4
- package/__internal__/src/components/SliderCanary/useSliderStationing.d.ts +1 -1
- package/__internal__/src/components/SliderCanary/useSliderStationing.js +15 -4
- package/__internal__/src/components/TextField/TextField.js +13 -5
- package/__internal__/src/components/TextField/types.d.ts +7 -0
- package/__internal__/src/components/User/User.css +1 -0
- package/createIcon/package.json +1 -1
- package/createResponsesImage/package.json +1 -1
- package/package.json +2 -1
- package/useBreakpoints/package.json +1 -1
- package/useChoiceGroup/package.json +1 -1
- package/useChoiceGroupIndexed/package.json +1 -1
- package/useClickOutside/package.json +1 -1
- package/useComponentSize/package.json +1 -1
- package/useDebounce/package.json +1 -1
- package/useFlag/package.json +1 -1
- package/useForkRef/package.json +1 -1
- package/useGlobalKeys/package.json +1 -1
- package/useHideElementsInLine/package.json +1 -1
- package/useKeys/package.json +1 -1
- package/useMutableRef/package.json +1 -1
- package/useOverflow/package.json +1 -1
- package/usePrevious/package.json +1 -1
- package/useRefs/package.json +1 -1
- package/useResizeObserved/package.json +1 -1
- package/useScrollElements/package.json +1 -1
- package/useScrollPosition/package.json +1 -1
- package/useSelect/package.json +1 -1
- package/useSortSteps/package.json +1 -1
- package/useThemeVars/package.json +1 -1
- package/useTimer/package.json +1 -1
- package/withTooltip/package.json +1 -1
|
@@ -24,27 +24,35 @@ var sizeMap = {
|
|
|
24
24
|
export var COMPONENT_NAME = 'Slider';
|
|
25
25
|
function SliderRender(props, ref) {
|
|
26
26
|
var sliderRef = useRef(null);
|
|
27
|
-
var _a = usePropsHandler(COMPONENT_NAME, props, sliderRef), _b = _a.min, min = _b === void 0 ? 0 : _b, _c = _a.max, max = _c === void 0 ? 100 : _c, onChange = _a.onChange, onAfterChange = _a.onAfterChange, value = _a.value,
|
|
28
|
-
var
|
|
27
|
+
var _a = usePropsHandler(COMPONENT_NAME, props, sliderRef), _b = _a.min, min = _b === void 0 ? 0 : _b, _c = _a.max, max = _c === void 0 ? 100 : _c, onChange = _a.onChange, onAfterChange = _a.onAfterChange, value = _a.value, stepProp = _a.step, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.size, size = _e === void 0 ? defaultPropSize : _e, _f = _a.view, view = _f === void 0 ? 'default' : _f, leftSide = _a.leftSide, rightSide = _a.rightSide, withTooltip = _a.withTooltip, _g = _a.range, range = _g === void 0 ? false : _g, label = _a.label, status = _a.status, caption = _a.caption, _h = _a.tooltipFormatter, tooltipFormatter = _h === void 0 ? defaultTooltipFormatter : _h, className = _a.className, style = _a.style, otherProps = __rest(_a, ["min", "max", "onChange", "onAfterChange", "value", "step", "disabled", "size", "view", "leftSide", "rightSide", "withTooltip", "range", "label", "status", "caption", "tooltipFormatter", "className", "style"]);
|
|
28
|
+
var _j = __read(useFlag(false), 2), isHovered = _j[0], _k = _j[1], on = _k.on, off = _k.off;
|
|
29
29
|
var leftButtonRef = useRef(null);
|
|
30
30
|
var rightButtonRef = useRef(null);
|
|
31
|
-
var sortedSteps = useSortSteps({ step:
|
|
31
|
+
var sortedSteps = useSortSteps({ step: stepProp, min: min, max: max });
|
|
32
|
+
var step = stepProp ? sortedSteps : Math.abs((max - min) / 100);
|
|
32
33
|
var IconRight = rightSide;
|
|
33
|
-
var IconLeft =
|
|
34
|
+
var IconLeft = props.leftSide !== 'input' && props.leftSide;
|
|
34
35
|
var iconSize = getByMap(sizeMap, size);
|
|
35
|
-
var
|
|
36
|
+
var _l = useSlider({
|
|
36
37
|
disabled: disabled,
|
|
37
38
|
range: range,
|
|
38
39
|
value: value,
|
|
39
40
|
min: min,
|
|
40
41
|
max: max,
|
|
41
|
-
step:
|
|
42
|
+
step: step,
|
|
42
43
|
onChange: onChange,
|
|
43
44
|
onAfterChange: onAfterChange,
|
|
44
45
|
sliderRef: sliderRef,
|
|
45
46
|
buttonRefs: [leftButtonRef, rightButtonRef]
|
|
46
|
-
}), onKeyPress =
|
|
47
|
-
var
|
|
47
|
+
}), onKeyPress = _l.onKeyPress, onFocus = _l.onFocus, handlePress = _l.handlePress, onSliderClick = _l.onSliderClick, popoverPosition = _l.popoverPosition, activeButton = _l.activeButton, currentValue = _l.currentValue;
|
|
48
|
+
var _m = useSliderStationing(currentValue.length === 1 ? currentValue[0] : currentValue, min, max, view, range, step, [leftButtonRef, rightButtonRef], sliderRef), lineSizes = _m.lineSizes, buttonPositions = _m.buttonPositions;
|
|
49
|
+
var containerProps = {
|
|
50
|
+
role: 'button',
|
|
51
|
+
tabIndex: 0,
|
|
52
|
+
className: cnSlider('Control'),
|
|
53
|
+
ref: sliderRef,
|
|
54
|
+
onClick: onSliderClick
|
|
55
|
+
};
|
|
48
56
|
var changeHovered = function (status) {
|
|
49
57
|
if (status)
|
|
50
58
|
on();
|
|
@@ -55,10 +63,10 @@ function SliderRender(props, ref) {
|
|
|
55
63
|
label && (React.createElement(FieldLabel, { className: cnSlider('Label'), size: size }, label)),
|
|
56
64
|
React.createElement("div", { className: cnSlider('Container') },
|
|
57
65
|
leftSide === 'input' && isNotRangeParams(props) && (React.createElement("div", { className: cnSlider('Side', { position: 'left' }) },
|
|
58
|
-
React.createElement(SliderInput, { value: props.value, onChange: function (params) { var _a; return isNotRangeParams(props) && ((_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, params)); }, size: size, min: min, max: max, status: status, step:
|
|
66
|
+
React.createElement(SliderInput, { value: props.value, onChange: function (params) { var _a; return isNotRangeParams(props) && ((_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, params)); }, size: size, min: min, max: max, status: status, step: step, disabled: disabled }))),
|
|
59
67
|
IconLeft && (React.createElement("div", { className: cnSlider('Side', { position: 'left' }) },
|
|
60
|
-
React.createElement(IconLeft, { size: iconSize, view: "secondary" }))),
|
|
61
|
-
React.createElement("div", {
|
|
68
|
+
React.createElement(IconLeft, { size: iconSize !== null && iconSize !== void 0 ? iconSize : undefined, view: "secondary" }))),
|
|
69
|
+
React.createElement("div", __assign({}, containerProps),
|
|
62
70
|
React.createElement(SliderLine, { hovered: isHovered || typeof activeButton === 'number', onHover: changeHovered, lines: lineSizes, disabled: disabled, view: view }),
|
|
63
71
|
currentValue.map(function (val, index) { return (React.createElement(SliderPoint, { hovered: isHovered || typeof activeButton === 'number', buttonRef: leftButtonRef, popoverPosition: popoverPosition[index], onKeyPress: onKeyPress, onFocus: onFocus, handlePress: handlePress, disabled: disabled, position: buttonPositions[index], focused: activeButton === index, buttonLabel: index, withTooltip: withTooltip, onHover: changeHovered, tooltipFormatter: tooltipFormatter, value: val, role: "slider", "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": val, tooltipZIndex: typeof (style === null || style === void 0 ? void 0 : style.zIndex) === 'number' ? style.zIndex + 1 : undefined, key: cnSlider('Point', { index: index }) })); })),
|
|
64
72
|
IconRight && (React.createElement("div", { className: cnSlider('Side', { position: 'right' }) },
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
height: var(--space-2xs);
|
|
23
23
|
background-color: var(--slider-line-color);
|
|
24
24
|
border-radius: var(--slider-line-radius);
|
|
25
|
-
-webkit-transition: background-color 0.3s
|
|
26
|
-
transition: background-color 0.3s
|
|
25
|
+
-webkit-transition: background-color 0.3s;
|
|
26
|
+
transition: background-color 0.3s;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.SliderLine-Line_active {
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
border: var(--space-3xs) solid var(--color-control-bg-primary);
|
|
20
20
|
border-radius: calc(var(--space-m) * 0.5);
|
|
21
21
|
cursor: pointer;
|
|
22
|
-
-webkit-transition: border-color 0.3s
|
|
23
|
-
transition: border-color 0.3s
|
|
22
|
+
-webkit-transition: border-color 0.3s;
|
|
23
|
+
transition: border-color 0.3s;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
.SliderPoint_hovered {
|
|
@@ -34,6 +34,4 @@
|
|
|
34
34
|
|
|
35
35
|
.SliderPoint-Tooltip {
|
|
36
36
|
pointer-events: none;
|
|
37
|
-
-webkit-transition: left 0.3s;
|
|
38
|
-
transition: left 0.3s;
|
|
39
37
|
}
|
|
@@ -16,13 +16,14 @@ export declare type UseSliderProps<RANGE extends boolean = false> = {
|
|
|
16
16
|
step?: number | number[];
|
|
17
17
|
onChange?: PropOnChange<RANGE>;
|
|
18
18
|
onAfterChange?: PropOnChange<RANGE>;
|
|
19
|
-
sliderRef: React.RefObject<HTMLDivElement>;
|
|
19
|
+
sliderRef: React.RefObject<HTMLDivElement | HTMLButtonElement>;
|
|
20
20
|
buttonRefs: React.RefObject<HTMLButtonElement>[];
|
|
21
21
|
};
|
|
22
22
|
export declare type UseSliderValues = {
|
|
23
23
|
onKeyPress: (e: React.KeyboardEvent, typeButton: ActiveButton) => void;
|
|
24
24
|
onFocus: (e: React.FocusEvent<HTMLButtonElement> | React.MouseEvent, button: ActiveButton) => void;
|
|
25
25
|
handlePress: (typeButton: ActiveButton) => void;
|
|
26
|
+
onSliderClick: React.MouseEventHandler;
|
|
26
27
|
activeButton: ActiveButton;
|
|
27
28
|
currentValue: [number] | [number, number];
|
|
28
29
|
popoverPosition: TrackPosition[];
|
|
@@ -34,6 +35,6 @@ export declare const getActiveValue: (value: number | [number, number], active:
|
|
|
34
35
|
export declare const detectActiveButton: (posittion: TrackPosition, buttons: React.RefObject<HTMLButtonElement>[]) => ActiveButton;
|
|
35
36
|
export declare const getValidValue: (value: number, min: number, max: number, step?: number | number[] | undefined) => number;
|
|
36
37
|
export declare const isValidValue: (value: number, min: number, max: number, step?: number | number[] | undefined) => boolean;
|
|
37
|
-
export declare const getValueByPosition: (position: TrackPosition, sliderRef: React.RefObject<HTMLDivElement>, min: number, max: number) => number;
|
|
38
|
+
export declare const getValueByPosition: (position: TrackPosition, sliderRef: React.RefObject<HTMLDivElement | HTMLButtonElement>, min: number, max: number, step?: number | number[] | undefined) => number;
|
|
38
39
|
export declare const getNewValue: (changedValue: number, currentValue: number | [number, number], step: number | number[], min: number, max: number, activeButton: ActiveButton) => number | [number, number];
|
|
39
40
|
export declare const analyzeDivisionValue: (value: number, step: number | number[], min: number, max: number) => number;
|
|
@@ -43,14 +43,22 @@ export var detectActiveButton = function (position, buttons) {
|
|
|
43
43
|
};
|
|
44
44
|
export var getValidValue = function (value, min, max, step) {
|
|
45
45
|
if (typeof value === 'number') {
|
|
46
|
-
if (value
|
|
46
|
+
if (value >= max)
|
|
47
47
|
return max;
|
|
48
|
-
if (value
|
|
48
|
+
if (value <= min)
|
|
49
49
|
return min;
|
|
50
50
|
if (!Array.isArray(step)) {
|
|
51
51
|
var division = step === null || step === void 0 ? void 0 : step.toString().split('.')[1];
|
|
52
52
|
var stepValue = step || 1;
|
|
53
|
-
|
|
53
|
+
if (Math.abs(value) < 1) {
|
|
54
|
+
return Number(value.toFixed(division ? division.length : 0));
|
|
55
|
+
}
|
|
56
|
+
var roundValue = Math.round(Number(value.toFixed(division ? division.length : 0)) / stepValue) * stepValue;
|
|
57
|
+
if (roundValue > max)
|
|
58
|
+
return max;
|
|
59
|
+
if (roundValue < min)
|
|
60
|
+
return min;
|
|
61
|
+
return Number(roundValue.toFixed(division ? division.length : 0));
|
|
54
62
|
}
|
|
55
63
|
var resultValue_1 = value;
|
|
56
64
|
step.forEach(function (stepPoint, index) {
|
|
@@ -83,12 +91,12 @@ export var getValidValue = function (value, min, max, step) {
|
|
|
83
91
|
export var isValidValue = function (value, min, max, step) {
|
|
84
92
|
return getValidValue(value, min, max, step) === value;
|
|
85
93
|
};
|
|
86
|
-
export var getValueByPosition = function (position, sliderRef, min, max) {
|
|
94
|
+
export var getValueByPosition = function (position, sliderRef, min, max, step) {
|
|
87
95
|
if (sliderRef.current && position) {
|
|
88
96
|
var _a = sliderRef.current.getBoundingClientRect(), x = _a.x, width = _a.width;
|
|
89
97
|
var absoluteSize = Math.abs(max - min);
|
|
90
98
|
var value = min + ((position.x - x) * absoluteSize) / width;
|
|
91
|
-
return getValidValue(value, min, max);
|
|
99
|
+
return getValidValue(value, min, max, step);
|
|
92
100
|
}
|
|
93
101
|
return 0;
|
|
94
102
|
};
|
|
@@ -111,17 +119,32 @@ export var getNewValue = function (changedValue, currentValue, step, min, max, a
|
|
|
111
119
|
return analyzedValue;
|
|
112
120
|
};
|
|
113
121
|
export var analyzeDivisionValue = function (value, step, min, max) {
|
|
114
|
-
var steps = getSteps(step, min, max);
|
|
115
122
|
var newValue = value;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
if (Array.isArray(step)) {
|
|
124
|
+
var steps = getSteps(step, min, max);
|
|
125
|
+
steps.forEach(function (stepSize) {
|
|
126
|
+
if (value && stepSize.min < value && stepSize.max >= value) {
|
|
127
|
+
if ((stepSize.max + stepSize.min) / 2 > value) {
|
|
128
|
+
newValue = stepSize.min;
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
newValue = stepSize.max;
|
|
132
|
+
}
|
|
123
133
|
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
if (value >= max)
|
|
138
|
+
return max;
|
|
139
|
+
if (value <= min)
|
|
140
|
+
return min;
|
|
141
|
+
var nearStep = (value - min) % step;
|
|
142
|
+
if (nearStep > step / 2) {
|
|
143
|
+
newValue = step - nearStep + value;
|
|
124
144
|
}
|
|
125
|
-
|
|
145
|
+
else {
|
|
146
|
+
newValue = value - nearStep;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
126
149
|
return newValue;
|
|
127
150
|
};
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
import { __read, __spread } from "tslib";
|
|
2
|
-
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { useComponentSize } from '../../../hooks/useComponentSize/useComponentSize';
|
|
4
4
|
import { useMutableRef } from '../../../hooks/useMutableRef/useMutableRef';
|
|
5
5
|
import { getActiveValue, getNewValue, getValidValue, getValueByPosition, isNotRangeParams, isRangeParams, trackPosition, } from './helper';
|
|
6
|
+
export var COUNT_STEPS = 250;
|
|
6
7
|
export function useSlider(props) {
|
|
7
8
|
var disabled = props.disabled, range = props.range, value = props.value, min = props.min, max = props.max, _a = props.step, step = _a === void 0 ? 1 : _a, onChange = props.onChange, onAfterChange = props.onAfterChange, sliderRef = props.sliderRef, buttonRefs = props.buttonRefs;
|
|
8
9
|
var minValue = max > min ? min : 0;
|
|
9
10
|
var maxValue = max > min ? max : 100;
|
|
11
|
+
var dragStepValue = useMemo(function () {
|
|
12
|
+
if (!Array.isArray(step)) {
|
|
13
|
+
if (step >= 1) {
|
|
14
|
+
var val = Math.abs((maxValue - minValue) / COUNT_STEPS);
|
|
15
|
+
if (val > step) {
|
|
16
|
+
return val - (val % step);
|
|
17
|
+
}
|
|
18
|
+
return Math.max(val, step);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return step;
|
|
22
|
+
}, [max, min, step]);
|
|
10
23
|
var _b = __read(useState(value), 2), currentValue = _b[0], setCurrentValue = _b[1];
|
|
11
24
|
var _c = __read(useState(null), 2), leftPopover = _c[0], setLeftPopover = _c[1];
|
|
12
25
|
var _d = __read(useState(null), 2), rightPopover = _d[0], setRightPopover = _d[1];
|
|
@@ -71,6 +84,20 @@ export function useSlider(props) {
|
|
|
71
84
|
}
|
|
72
85
|
}
|
|
73
86
|
}, []);
|
|
87
|
+
var onSliderClick = function (e) {
|
|
88
|
+
if (isNotRangeParams(props)) {
|
|
89
|
+
var positionValue = getValueByPosition({ x: e.pageX, y: e.pageY }, sliderRef, minValue, maxValue, step);
|
|
90
|
+
var newValue = getNewValue(positionValue, currentValue, dragStepValue, min, max, activeButton.current);
|
|
91
|
+
if (newValue !== value) {
|
|
92
|
+
setCurrentValue(newValue);
|
|
93
|
+
setTooltipPosition(getActiveValue(newValue, 0), 0);
|
|
94
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
95
|
+
e: e,
|
|
96
|
+
value: newValue
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
74
101
|
var onKeyPress = useCallback(function (event, typeButton) {
|
|
75
102
|
if (!disabled && typeof typeButton === 'number' && typeof currentValue !== 'undefined') {
|
|
76
103
|
var stepIncrement_1 = !Array.isArray(step) ? step || 1 : 1;
|
|
@@ -148,8 +175,8 @@ export function useSlider(props) {
|
|
|
148
175
|
return value;
|
|
149
176
|
}
|
|
150
177
|
var position = trackPosition(nativeEvent);
|
|
151
|
-
var positionValue = getValueByPosition(position, sliderRef, minValue, maxValue);
|
|
152
|
-
return getNewValue(positionValue, currentValue,
|
|
178
|
+
var positionValue = getValueByPosition(position, sliderRef, minValue, maxValue, step);
|
|
179
|
+
return getNewValue(positionValue, currentValue, dragStepValue, min, max, activeButton.current);
|
|
153
180
|
};
|
|
154
181
|
var onFocus = function (e, button) {
|
|
155
182
|
activeButton.current = button;
|
|
@@ -160,8 +187,8 @@ export function useSlider(props) {
|
|
|
160
187
|
var position = changePosition(event);
|
|
161
188
|
var oldValue = getActiveValue(currentValue, button);
|
|
162
189
|
var newValue = getActiveValue(position, button);
|
|
190
|
+
setCurrentValue(position);
|
|
163
191
|
if (oldValue !== newValue) {
|
|
164
|
-
setCurrentValue(position);
|
|
165
192
|
onAfterChange === null || onAfterChange === void 0 ? void 0 : onAfterChange({ e: event, value: position });
|
|
166
193
|
}
|
|
167
194
|
}
|
|
@@ -199,6 +226,7 @@ export function useSlider(props) {
|
|
|
199
226
|
onKeyPress: onKeyPress,
|
|
200
227
|
onFocus: onFocus,
|
|
201
228
|
handlePress: handlePress,
|
|
229
|
+
onSliderClick: onSliderClick,
|
|
202
230
|
activeButton: activeButton.current,
|
|
203
231
|
popoverPosition: [leftPopover, rightPopover],
|
|
204
232
|
currentValue: Array.isArray(currentValue) ? currentValue : [currentValue]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Line, PropView } from './helper';
|
|
3
|
-
declare type UseSliderStationing = (value: number | [number, number] | undefined, min: number, max: number, view: PropView, range: boolean | undefined, step: number | number[] | undefined, buttonRefs: [React.RefObject<HTMLButtonElement>, React.RefObject<HTMLButtonElement>], sliderLineRef: React.RefObject<HTMLDivElement>) => {
|
|
3
|
+
declare type UseSliderStationing = (value: number | [number, number] | undefined, min: number, max: number, view: PropView, range: boolean | undefined, step: number | number[] | undefined, buttonRefs: [React.RefObject<HTMLButtonElement>, React.RefObject<HTMLButtonElement>], sliderLineRef: React.RefObject<HTMLButtonElement | HTMLDivElement>) => {
|
|
4
4
|
lineSizes: Line[];
|
|
5
5
|
buttonPositions: number[];
|
|
6
6
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __read, __spread } from "tslib";
|
|
2
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { COUNT_STEPS } from './useSlider/useSlider';
|
|
3
4
|
export var getSteps = function (step, min, max) {
|
|
4
5
|
var stepsArray = [];
|
|
5
6
|
var size = min;
|
|
@@ -26,6 +27,16 @@ export var useSliderStationing = function (value, min, max, view, range, step, b
|
|
|
26
27
|
if (step === void 0) { step = 1; }
|
|
27
28
|
var _a = __read(useState([]), 2), lineSizes = _a[0], setLineSizes = _a[1];
|
|
28
29
|
var _b = __read(useState([]), 2), buttonPositions = _b[0], setButtonPositions = _b[1];
|
|
30
|
+
var calcualtedStep = useMemo(function () {
|
|
31
|
+
if (!Array.isArray(step)) {
|
|
32
|
+
var val = Math.abs((max - min) / COUNT_STEPS);
|
|
33
|
+
if (val > step) {
|
|
34
|
+
return val - (val % step);
|
|
35
|
+
}
|
|
36
|
+
return Math.max(val, step);
|
|
37
|
+
}
|
|
38
|
+
return step;
|
|
39
|
+
}, [max, min, step]);
|
|
29
40
|
var calculateLines = function () {
|
|
30
41
|
var sizesArray = [];
|
|
31
42
|
var absoluteSize = Math.abs(max - min);
|
|
@@ -59,8 +70,8 @@ export var useSliderStationing = function (value, min, max, view, range, step, b
|
|
|
59
70
|
});
|
|
60
71
|
}
|
|
61
72
|
}
|
|
62
|
-
else if (typeof
|
|
63
|
-
getSteps(
|
|
73
|
+
else if (typeof calcualtedStep !== 'undefined') {
|
|
74
|
+
getSteps(calcualtedStep, min, max).forEach(function (stepSize) {
|
|
64
75
|
sizesArray.push({
|
|
65
76
|
width: (Math.abs(stepSize.max - stepSize.min) * 100) / absoluteSize,
|
|
66
77
|
active: (typeof value === 'number' || Array.isArray(value)) &&
|
|
@@ -111,7 +122,7 @@ export var useSliderStationing = function (value, min, max, view, range, step, b
|
|
|
111
122
|
useEffect(function () {
|
|
112
123
|
setLineSizes(calculateLines());
|
|
113
124
|
setButtonPositions(calculateButtonPositions());
|
|
114
|
-
}, [value, min, max, range,
|
|
125
|
+
}, [value, min, max, range, calcualtedStep, view]);
|
|
115
126
|
return {
|
|
116
127
|
lineSizes: lineSizes,
|
|
117
128
|
buttonPositions: buttonPositions
|
|
@@ -24,9 +24,11 @@ export var cnTextField = cn(COMPONENT_NAME);
|
|
|
24
24
|
export function TextFieldRender(props, ref) {
|
|
25
25
|
var textFieldRef = React.useRef(null);
|
|
26
26
|
var inputRef = React.useRef(null);
|
|
27
|
-
var _a = usePropsHandler(COMPONENT_NAME, props, textFieldRef), className = _a.className, _b = _a.type, type = _b === void 0 ? 'text' : _b, value = _a.value, onChange = _a.onChange, id = _a.id, name = _a.name, rows = _a.rows, cols = _a.cols, minRows = _a.minRows, maxRows = _a.maxRows, inputRefProp = _a.inputRef, maxLength = _a.maxLength, disabled = _a.disabled, _c = _a.size, size = _c === void 0 ? textFieldPropSizeDefault : _c, _d = _a.view, view = _d === void 0 ? textFieldPropViewDefault : _d, _e = _a.form, form = _e === void 0 ? textFieldPropFormDefault : _e, state = _a.state, status = _a.status, _f = _a.width, width = _f === void 0 ? textFieldPropWidthDefault : _f, onBlur = _a.onBlur, onFocus = _a.onFocus, _g = _a.autoFocus, autoFocus = _g === void 0 ? false : _g, placeholder = _a.placeholder, leftSide = _a.leftSide, rightSide = _a.rightSide, autoComplete = _a.autoComplete, withClearButton = _a.withClearButton, max = _a.max, min = _a.min, readOnly = _a.readOnly, required = _a.required,
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
var _a = usePropsHandler(COMPONENT_NAME, props, textFieldRef), className = _a.className, _b = _a.type, type = _b === void 0 ? 'text' : _b, value = _a.value, onChange = _a.onChange, id = _a.id, name = _a.name, rows = _a.rows, cols = _a.cols, minRows = _a.minRows, maxRows = _a.maxRows, inputRefProp = _a.inputRef, maxLength = _a.maxLength, disabled = _a.disabled, _c = _a.size, size = _c === void 0 ? textFieldPropSizeDefault : _c, _d = _a.view, view = _d === void 0 ? textFieldPropViewDefault : _d, _e = _a.form, form = _e === void 0 ? textFieldPropFormDefault : _e, state = _a.state, status = _a.status, _f = _a.width, width = _f === void 0 ? textFieldPropWidthDefault : _f, onBlur = _a.onBlur, onFocus = _a.onFocus, _g = _a.autoFocus, autoFocus = _g === void 0 ? false : _g, placeholder = _a.placeholder, leftSide = _a.leftSide, rightSide = _a.rightSide, autoComplete = _a.autoComplete, withClearButton = _a.withClearButton, _h = _a.incrementButtons, incrementButtons = _h === void 0 ? true : _h, max = _a.max, min = _a.min, readOnly = _a.readOnly, required = _a.required, _j = _a.step, step = _j === void 0 ? 1 : _j, tabIndex = _a.tabIndex, ariaLabel = _a.ariaLabel, label = _a.label, inputContainerRef = _a.inputContainerRef, _k = _a.labelPosition, labelPosition = _k === void 0 ? 'top' : _k, caption = _a.caption, iconSizeProp = _a.iconSize, focused = _a.focused, onClick = _a.onClick,
|
|
28
|
+
// onkey props
|
|
29
|
+
onKeyDownProp = _a.onKeyDown, onKeyDownCapture = _a.onKeyDownCapture, onKeyPress = _a.onKeyPress, onKeyPressCapture = _a.onKeyPressCapture, onKeyUp = _a.onKeyUp, onKeyUpCapture = _a.onKeyUpCapture, otherProps = __rest(_a, ["className", "type", "value", "onChange", "id", "name", "rows", "cols", "minRows", "maxRows", "inputRef", "maxLength", "disabled", "size", "view", "form", "state", "status", "width", "onBlur", "onFocus", "autoFocus", "placeholder", "leftSide", "rightSide", "autoComplete", "withClearButton", "incrementButtons", "max", "min", "readOnly", "required", "step", "tabIndex", "ariaLabel", "label", "inputContainerRef", "labelPosition", "caption", "iconSize", "focused", "onClick", "onKeyDown", "onKeyDownCapture", "onKeyPress", "onKeyPressCapture", "onKeyUp", "onKeyUpCapture"]);
|
|
30
|
+
var _l = __read(useFlag(autoFocus), 2), focus = _l[0], setFocus = _l[1];
|
|
31
|
+
var _m = __read(useFlag(false), 2), passwordVisible = _m[0], setPasswordVisuble = _m[1];
|
|
30
32
|
var valueRef = useMutableRef(value);
|
|
31
33
|
var onClickRef = useMutableRef(onClick);
|
|
32
34
|
var onChangeRef = useMutableRef(onChange);
|
|
@@ -46,7 +48,7 @@ export function TextFieldRender(props, ref) {
|
|
|
46
48
|
var handleChange = useCallback(function (e) {
|
|
47
49
|
var _a;
|
|
48
50
|
!disabled && ((_a = onChangeRef.current) === null || _a === void 0 ? void 0 : _a.call(onChangeRef, { e: e, id: id, name: name, value: e.target.value || null }));
|
|
49
|
-
}, [id, name]);
|
|
51
|
+
}, [id, name, disabled]);
|
|
50
52
|
var handleBlur = function (e) {
|
|
51
53
|
setFocus.off();
|
|
52
54
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
@@ -69,12 +71,18 @@ export function TextFieldRender(props, ref) {
|
|
|
69
71
|
readOnly: readOnly,
|
|
70
72
|
tabIndex: tabIndex,
|
|
71
73
|
name: name,
|
|
74
|
+
onKeyDownCapture: onKeyDownCapture,
|
|
75
|
+
onKeyPress: onKeyPress,
|
|
76
|
+
onKeyPressCapture: onKeyPressCapture,
|
|
77
|
+
onKeyUp: onKeyUp,
|
|
78
|
+
onKeyUpCapture: onKeyUpCapture,
|
|
72
79
|
'id': id ? id.toString() : '',
|
|
73
80
|
'aria-label': ariaLabel
|
|
74
81
|
};
|
|
75
82
|
var Eye = passwordVisible ? IconEyeClose : IconEye;
|
|
76
83
|
var onKeyDown = function (e) {
|
|
77
84
|
var flag = getIncrementFlag(e);
|
|
85
|
+
onKeyDownProp === null || onKeyDownProp === void 0 ? void 0 : onKeyDownProp(e);
|
|
78
86
|
if (type === 'number' && typeof flag === 'boolean' && !disabled) {
|
|
79
87
|
e.preventDefault();
|
|
80
88
|
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
@@ -143,7 +151,7 @@ export function TextFieldRender(props, ref) {
|
|
|
143
151
|
type: leftSideIsString ? 'string' : 'icon'
|
|
144
152
|
}), title: typeof leftSide === 'string' ? leftSide : undefined }, leftSideIsString ? (leftSide) : (React.createElement(LeftIcon, { className: cnTextField('Icon'), size: iconSize })))),
|
|
145
153
|
textarea ? (React.createElement(TextAreaAutoSize, __assign({}, commonProps, textareaProps))) : (React.createElement("input", __assign({}, commonProps, inputProps))),
|
|
146
|
-
type === 'number' && (React.createElement("div", { className: cnTextField('Counter') },
|
|
154
|
+
type === 'number' && incrementButtons && (React.createElement("div", { className: cnTextField('Counter') },
|
|
147
155
|
React.createElement("button", { onFocus: handleFocus, onClick: function (e) { return changeNumberValue(e, true); }, type: "button", className: cnTextField('CounterButton') },
|
|
148
156
|
React.createElement(IconSelectOpen, { size: "xs" })),
|
|
149
157
|
React.createElement("button", { onFocus: handleFocus, onClick: function (e) { return changeNumberValue(e, false); }, type: "button", className: cnTextField('CounterButton') },
|
|
@@ -62,6 +62,7 @@ export declare type TextFieldProps<TYPE extends string> = PropsWithHTMLAttribute
|
|
|
62
62
|
width?: TextFieldPropWidth;
|
|
63
63
|
onFocus?: React.FocusEventHandler<HTMLElement>;
|
|
64
64
|
onBlur?: React.FocusEventHandler<HTMLElement>;
|
|
65
|
+
incrementButtons?: boolean;
|
|
65
66
|
autoFocus?: boolean;
|
|
66
67
|
placeholder?: string;
|
|
67
68
|
leftSide?: string | IconComponent;
|
|
@@ -83,5 +84,11 @@ export declare type TextFieldProps<TYPE extends string> = PropsWithHTMLAttribute
|
|
|
83
84
|
caption?: string;
|
|
84
85
|
labelPosition?: 'top' | 'left';
|
|
85
86
|
focused?: boolean;
|
|
87
|
+
onKeyDownCapture?: React.KeyboardEventHandler;
|
|
88
|
+
onKeyPress?: React.KeyboardEventHandler;
|
|
89
|
+
onKeyPressCapture?: React.KeyboardEventHandler;
|
|
90
|
+
onKeyUp?: React.KeyboardEventHandler;
|
|
91
|
+
onKeyUpCapture?: React.KeyboardEventHandler;
|
|
92
|
+
onKeyDown?: React.KeyboardEventHandler;
|
|
86
93
|
}, HTMLDivElement> & TextFieldPropsTextareaType<TYPE> & TextFieldPropRightSide<TYPE>;
|
|
87
94
|
export declare type TextFieldComponent = <TYPE extends string>(props: TextFieldProps<TYPE> & React.RefAttributes<HTMLElement>) => React.ReactElement | null;
|
package/createIcon/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@consta/uikit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.26.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"ui-kit",
|
|
6
6
|
"design-system",
|
|
@@ -279,6 +279,7 @@
|
|
|
279
279
|
"Pagination",
|
|
280
280
|
"Popover",
|
|
281
281
|
"PortalWithTheme",
|
|
282
|
+
"ProgressLine",
|
|
282
283
|
"ProgressSpin",
|
|
283
284
|
"ProgressStepBarCanary",
|
|
284
285
|
"Radio",
|
package/useDebounce/package.json
CHANGED
package/useFlag/package.json
CHANGED
package/useForkRef/package.json
CHANGED
package/useKeys/package.json
CHANGED
package/useOverflow/package.json
CHANGED
package/usePrevious/package.json
CHANGED
package/useRefs/package.json
CHANGED