@consta/uikit 3.24.2 → 3.24.3
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 +21 -47
- 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/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/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/Combobox/helpers.d.ts +1 -1
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeDate/DatePickerFieldTypeDate.d.ts +1 -0
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeDate/DatePickerFieldTypeDate.js +29 -29
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeDate/helpers.d.ts +5 -1
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeDate/helpers.js +33 -19
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeDateRange/DatePickerFieldTypeDateRange.d.ts +2 -1
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeDateRange/DatePickerFieldTypeDateRange.js +7 -63
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeDateTime/DatePickerFieldTypeDateTime.d.ts +1 -0
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeDateTime/DatePickerFieldTypeDateTime.js +21 -18
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeDateTime/helpers.d.ts +5 -1
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeDateTime/helpers.js +21 -5
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeDateTimeRange/DatePickerFieldTypeDateTimeRange.d.ts +2 -1
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeDateTimeRange/DatePickerFieldTypeDateTimeRange.js +7 -63
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeMonth/DatePickerFieldTypeMonth.d.ts +1 -0
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeMonth/DatePickerFieldTypeMonth.js +27 -27
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeMonth/helpers.d.ts +5 -1
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeMonth/helpers.js +24 -9
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeMonthRange/DatePickerFieldTypeMonthRange.d.ts +2 -1
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeMonthRange/DatePickerFieldTypeMonthRange.js +7 -63
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeMonthRange/helpers.d.ts +2 -2
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeTime/DatePickerFieldTypeTime.d.ts +1 -0
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeTime/DatePickerFieldTypeTime.js +21 -18
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeTime/helpers.d.ts +5 -1
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeTime/helpers.js +19 -3
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeYear/DatePickerFieldTypeYear.d.ts +1 -0
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeYear/DatePickerFieldTypeYear.js +25 -25
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeYear/helpers.d.ts +1 -0
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeYearRange/DatePickerFieldTypeYearRange.d.ts +2 -1
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeYearRange/DatePickerFieldTypeYearRange.js +7 -63
- package/__internal__/cjs-src/components/DatePickerCanary/getChangeFnRange.d.ts +14 -0
- package/__internal__/cjs-src/components/DatePickerCanary/getChangeFnRange.js +40 -0
- package/__internal__/cjs-src/components/DatePickerCanary/types.d.ts +1 -0
- package/__internal__/cjs-src/components/DragNDropField/DragNDropField.css +10 -1
- package/__internal__/cjs-src/components/DragNDropField/DragNDropField.d.ts +10 -2
- package/__internal__/cjs-src/components/DragNDropField/DragNDropField.js +13 -11
- package/__internal__/cjs-src/components/DragNDropField/DragNDropFieldContent/DragNDropFieldContent.css +3 -0
- package/__internal__/cjs-src/components/DragNDropField/DragNDropFieldContent/DragNDropFieldContent.js +3 -3
- package/__internal__/cjs-src/components/DragNDropField/types.d.ts +5 -3
- package/__internal__/cjs-src/components/Popover/Popover.css +2 -36
- package/__internal__/cjs-src/components/Popover/Popover.js +41 -12
- package/__internal__/cjs-src/components/Popover/helpers.d.ts +4 -4
- package/__internal__/cjs-src/components/Popover/helpers.js +9 -11
- package/__internal__/cjs-src/components/Popover/usePopoverReposition.d.ts +2 -1
- package/__internal__/cjs-src/components/Popover/usePopoverReposition.js +12 -12
- package/__internal__/cjs-src/components/SelectComponents/SelectDropdown/SelectDropdown.js +2 -3
- package/__internal__/cjs-src/components/SliderCanary/SliderInput/SliderInput.d.ts +1 -1
- package/__internal__/cjs-src/components/Table/Table.d.ts +4 -0
- package/__internal__/cjs-src/components/Table/filtering.d.ts +1 -5
- package/__internal__/cjs-src/components/TextField/TextField.css +24 -2
- package/__internal__/cjs-src/components/TextField/TextField.d.ts +2 -2
- package/__internal__/cjs-src/components/TextField/TextField.js +51 -45
- package/__internal__/cjs-src/components/TextField/helpers.d.ts +6 -100
- package/__internal__/cjs-src/components/TextField/helpers.js +18 -30
- package/__internal__/cjs-src/components/TextField/types.d.ts +87 -0
- package/__internal__/cjs-src/components/TextField/types.js +27 -0
- package/__internal__/cjs-src/mixs/MixPopoverAnimate/MixPopoverAnimate.css +40 -4
- package/__internal__/src/components/Combobox/helpers.d.ts +1 -1
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeDate/DatePickerFieldTypeDate.d.ts +1 -0
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeDate/DatePickerFieldTypeDate.js +29 -29
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeDate/helpers.d.ts +5 -1
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeDate/helpers.js +34 -20
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeDateRange/DatePickerFieldTypeDateRange.d.ts +2 -1
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeDateRange/DatePickerFieldTypeDateRange.js +8 -64
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeDateTime/DatePickerFieldTypeDateTime.d.ts +1 -0
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeDateTime/DatePickerFieldTypeDateTime.js +21 -18
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeDateTime/helpers.d.ts +5 -1
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeDateTime/helpers.js +22 -6
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeDateTimeRange/DatePickerFieldTypeDateTimeRange.d.ts +2 -1
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeDateTimeRange/DatePickerFieldTypeDateTimeRange.js +8 -64
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeMonth/DatePickerFieldTypeMonth.d.ts +1 -0
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeMonth/DatePickerFieldTypeMonth.js +27 -27
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeMonth/helpers.d.ts +5 -1
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeMonth/helpers.js +25 -10
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeMonthRange/DatePickerFieldTypeMonthRange.d.ts +2 -1
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeMonthRange/DatePickerFieldTypeMonthRange.js +8 -64
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeMonthRange/helpers.d.ts +2 -2
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeTime/DatePickerFieldTypeTime.d.ts +1 -0
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeTime/DatePickerFieldTypeTime.js +21 -18
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeTime/helpers.d.ts +5 -1
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeTime/helpers.js +20 -4
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeYear/DatePickerFieldTypeYear.d.ts +1 -0
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeYear/DatePickerFieldTypeYear.js +25 -25
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeYear/helpers.d.ts +1 -0
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeYearRange/DatePickerFieldTypeYearRange.d.ts +2 -1
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeYearRange/DatePickerFieldTypeYearRange.js +8 -64
- package/__internal__/src/components/DatePickerCanary/getChangeFnRange.d.ts +14 -0
- package/__internal__/src/components/DatePickerCanary/getChangeFnRange.js +36 -0
- package/__internal__/src/components/DatePickerCanary/types.d.ts +1 -0
- package/__internal__/src/components/DragNDropField/DragNDropField.css +10 -1
- package/__internal__/src/components/DragNDropField/DragNDropField.d.ts +10 -2
- package/__internal__/src/components/DragNDropField/DragNDropField.js +15 -13
- package/__internal__/src/components/DragNDropField/DragNDropFieldContent/DragNDropFieldContent.css +3 -0
- package/__internal__/src/components/DragNDropField/DragNDropFieldContent/DragNDropFieldContent.js +3 -3
- package/__internal__/src/components/DragNDropField/types.d.ts +5 -3
- package/__internal__/src/components/Popover/Popover.css +2 -36
- package/__internal__/src/components/Popover/Popover.js +42 -13
- package/__internal__/src/components/Popover/helpers.d.ts +4 -4
- package/__internal__/src/components/Popover/helpers.js +8 -10
- package/__internal__/src/components/Popover/usePopoverReposition.d.ts +2 -1
- package/__internal__/src/components/Popover/usePopoverReposition.js +12 -12
- package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js +4 -5
- package/__internal__/src/components/SliderCanary/SliderInput/SliderInput.d.ts +1 -1
- package/__internal__/src/components/Table/Table.d.ts +4 -0
- package/__internal__/src/components/Table/filtering.d.ts +1 -5
- package/__internal__/src/components/TextField/TextField.css +24 -2
- package/__internal__/src/components/TextField/TextField.d.ts +2 -2
- package/__internal__/src/components/TextField/TextField.js +52 -46
- package/__internal__/src/components/TextField/helpers.d.ts +6 -100
- package/__internal__/src/components/TextField/helpers.js +17 -29
- package/__internal__/src/components/TextField/types.d.ts +87 -0
- package/__internal__/src/components/TextField/types.js +24 -0
- package/__internal__/src/mixs/MixPopoverAnimate/MixPopoverAnimate.css +40 -4
- package/createIcon/package.json +1 -1
- package/createResponsesImage/package.json +1 -1
- package/fonts/index.d.ts +1 -0
- package/fonts/index.js +1 -0
- package/package.json +4 -3
- 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
|
@@ -14,20 +14,31 @@ export var DatePickerFieldTypeTime = React.forwardRef(function (props, ref) {
|
|
|
14
14
|
var onChangeRef = useMutableRef(onChange);
|
|
15
15
|
var _f = __read(useState(value && isValid(value) ? format(value, formatProp) : null), 2), stringValue = _f[0], setStringValue = _f[1];
|
|
16
16
|
var formatParts = useMemo(function () { return getParts(formatProp, ':'); }, [formatProp, separator]);
|
|
17
|
-
var
|
|
17
|
+
var stringValueRef = useMutableRef(stringValue);
|
|
18
|
+
var valueRef = useMutableRef(value);
|
|
19
|
+
var onErrorRef = useMutableRef(onError);
|
|
20
|
+
var handleChange = useCallback(function (_a) {
|
|
21
|
+
var _b;
|
|
22
|
+
var e = _a.e, stringValue = _a.value;
|
|
23
|
+
if (stringValueRef.current === stringValue) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
18
26
|
setStringValue(stringValue);
|
|
19
27
|
var onChange = onChangeRef.current;
|
|
28
|
+
var value = valueRef.current;
|
|
20
29
|
if (onChange) {
|
|
21
30
|
if (!stringValue) {
|
|
22
|
-
|
|
31
|
+
if (value) {
|
|
32
|
+
onChange({ e: e, value: null });
|
|
33
|
+
}
|
|
23
34
|
return;
|
|
24
35
|
}
|
|
25
36
|
var partsTime = getPartsDate(stringValue, formatProp, ':', false, ['HH', 'mm', 'ss']);
|
|
26
|
-
var
|
|
37
|
+
var _c = __read(partsTime, 3), HH = _c[0], mm = _c[1], ss = _c[2];
|
|
27
38
|
if (partsTime.filter(function (item) { return !!item; }).length === formatParts.length) {
|
|
28
39
|
var date = parse(HH + ":" + mm + ":" + ss, datePickerPropFormatTypeTime, value || new Date());
|
|
29
40
|
if (!isWithinInterval(date, { start: minDate, end: maxDate })) {
|
|
30
|
-
|
|
41
|
+
(_b = onErrorRef.current) === null || _b === void 0 ? void 0 : _b.call(onErrorRef, {
|
|
31
42
|
type: datePickerErrorTypes[0],
|
|
32
43
|
stringValue: stringValue,
|
|
33
44
|
date: date,
|
|
@@ -35,17 +46,19 @@ export var DatePickerFieldTypeTime = React.forwardRef(function (props, ref) {
|
|
|
35
46
|
mm: mm,
|
|
36
47
|
ss: ss
|
|
37
48
|
});
|
|
38
|
-
|
|
49
|
+
if (value) {
|
|
50
|
+
onChange({ e: e, value: null });
|
|
51
|
+
}
|
|
39
52
|
return;
|
|
40
53
|
}
|
|
41
54
|
onChange({ e: e, value: date });
|
|
42
55
|
}
|
|
43
|
-
else {
|
|
56
|
+
else if (value) {
|
|
44
57
|
onChange({ e: e, value: null });
|
|
45
58
|
}
|
|
46
59
|
}
|
|
47
60
|
}, [minDate === null || minDate === void 0 ? void 0 : minDate.getTime(), maxDate === null || maxDate === void 0 ? void 0 : maxDate.getTime(), formatProp, separator]);
|
|
48
|
-
useImask(formatProp, separator, multiplicityHours, multiplicitySeconds, multiplicityMinutes, inputRef, stringValue, onError);
|
|
61
|
+
useImask(formatProp, separator, multiplicityHours, multiplicitySeconds, multiplicityMinutes, inputRef, stringValue, onError, handleChange);
|
|
49
62
|
// при изменении value, нужно обновить stringValue
|
|
50
63
|
useEffect(function () {
|
|
51
64
|
if (value && isValid(value)) {
|
|
@@ -59,15 +72,5 @@ export var DatePickerFieldTypeTime = React.forwardRef(function (props, ref) {
|
|
|
59
72
|
setStringValue('');
|
|
60
73
|
}
|
|
61
74
|
}, [value === null || value === void 0 ? void 0 : value.getTime()]);
|
|
62
|
-
|
|
63
|
-
// обнавляем oninput при смене handleChange
|
|
64
|
-
useEffect(function () {
|
|
65
|
-
if (inputRef.current) {
|
|
66
|
-
inputRef.current.oninput = function (e) {
|
|
67
|
-
var _a;
|
|
68
|
-
handleChange(e, ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) || '');
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
}, [handleChange]);
|
|
72
|
-
return (React.createElement(TextField, __assign({}, otherProps, { type: "text", inputContainerRef: ref, inputRef: useForkRef([inputRef, inputRefProp]), value: stringValue, placeholder: placeholder })));
|
|
75
|
+
return (React.createElement(TextField, __assign({}, otherProps, { onChange: handleChange, type: "text", inputContainerRef: ref, inputRef: useForkRef([inputRef, inputRefProp]), value: stringValue, placeholder: placeholder })));
|
|
73
76
|
});
|
|
@@ -44,6 +44,10 @@ export declare type DatePickerFieldTypeTimeProps = PropsWithHTMLAttributes<{
|
|
|
44
44
|
label?: string;
|
|
45
45
|
caption?: string;
|
|
46
46
|
labelPosition?: 'top' | 'left';
|
|
47
|
+
withClearButton?: boolean;
|
|
47
48
|
}, HTMLDivElement>;
|
|
48
|
-
export declare const useImask: (formatProp: string, separator: string, multiplicityHours: number | undefined, multiplicitySeconds: number | undefined, multiplicityMinutes: number | undefined, inputRef: React.RefObject<HTMLInputElement>, stringValue: string | null, onError: DatePickerPropOnError | undefined
|
|
49
|
+
export declare const useImask: (formatProp: string, separator: string, multiplicityHours: number | undefined, multiplicitySeconds: number | undefined, multiplicityMinutes: number | undefined, inputRef: React.RefObject<HTMLInputElement>, stringValue: string | null, onError: DatePickerPropOnError | undefined, handleChanhe: ({ e, value: stringValue }: {
|
|
50
|
+
e: Event;
|
|
51
|
+
value: string | null;
|
|
52
|
+
}) => void) => void;
|
|
49
53
|
export {};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { __read } from "tslib";
|
|
2
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
3
3
|
import { addHours, addMinutes, addSeconds, format, isValid, parse, startOfDay, startOfHour, startOfMinute, } from 'date-fns';
|
|
4
4
|
import IMask from 'imask';
|
|
5
|
+
import { useMutableRef } from '../../../hooks/useMutableRef/useMutableRef';
|
|
5
6
|
import { getLabelHours, getLabelMinutes, getLabelSeconds } from '../../DateTimeCanary/helpers';
|
|
6
7
|
import { datePickerPropFormatTypeTime, getPartsDate, getTimeEnum } from '../helpers';
|
|
7
8
|
import { datePickerErrorTypes } from '../types';
|
|
8
|
-
export var useImask = function (formatProp, separator, multiplicityHours, multiplicitySeconds, multiplicityMinutes, inputRef, stringValue, onError) {
|
|
9
|
+
export var useImask = function (formatProp, separator, multiplicityHours, multiplicitySeconds, multiplicityMinutes, inputRef, stringValue, onError, handleChanhe) {
|
|
9
10
|
var imaskRef = useRef(null);
|
|
11
|
+
var onErrorRef = useMutableRef(onError);
|
|
12
|
+
var handleChanheRef = useMutableRef(handleChanhe);
|
|
10
13
|
// задаем маску и сохраняем обьект маски в ref
|
|
11
14
|
// обнавляем при смене формата
|
|
12
15
|
useEffect(function () {
|
|
@@ -53,12 +56,13 @@ export var useImask = function (formatProp, separator, multiplicityHours, multip
|
|
|
53
56
|
format: function (date) { return format(date, formatProp); },
|
|
54
57
|
parse: function (string) { return parse(string, formatProp, new Date()); },
|
|
55
58
|
validate: function (string) {
|
|
56
|
-
var _a
|
|
59
|
+
var _a;
|
|
60
|
+
var _b = __read(getPartsDate(string, formatProp, ':', false, ['HH', 'mm', 'ss']), 3), HH = _b[0], mm = _b[1], ss = _b[2];
|
|
57
61
|
if (HH &&
|
|
58
62
|
mm &&
|
|
59
63
|
ss &&
|
|
60
64
|
!isValid(parse(HH + ":" + mm + ":" + ss, datePickerPropFormatTypeTime, new Date()))) {
|
|
61
|
-
|
|
65
|
+
(_a = onErrorRef.current) === null || _a === void 0 ? void 0 : _a.call(onErrorRef, {
|
|
62
66
|
type: datePickerErrorTypes[1],
|
|
63
67
|
stringValue: string,
|
|
64
68
|
HH: HH,
|
|
@@ -74,6 +78,18 @@ export var useImask = function (formatProp, separator, multiplicityHours, multip
|
|
|
74
78
|
// Нужно для синхранизации value c Imask,
|
|
75
79
|
// так как value мы можем задать через пропс без самого ввода,
|
|
76
80
|
// и Imask требует ручной синхронихации в этом случае
|
|
81
|
+
var onAcept = useCallback(function (e) {
|
|
82
|
+
var _a;
|
|
83
|
+
handleChanheRef.current({ e: e, value: ((_a = imaskRef.current) === null || _a === void 0 ? void 0 : _a.value) || null });
|
|
84
|
+
}, []);
|
|
85
|
+
useEffect(function () {
|
|
86
|
+
var _a;
|
|
87
|
+
(_a = imaskRef.current) === null || _a === void 0 ? void 0 : _a.on('accept', onAcept);
|
|
88
|
+
return function () {
|
|
89
|
+
var _a;
|
|
90
|
+
(_a = imaskRef.current) === null || _a === void 0 ? void 0 : _a.off('accept', onAcept);
|
|
91
|
+
};
|
|
92
|
+
}, []);
|
|
77
93
|
useEffect(function () {
|
|
78
94
|
var _a;
|
|
79
95
|
(_a = imaskRef.current) === null || _a === void 0 ? void 0 : _a.updateValue();
|
|
@@ -42,4 +42,5 @@ export declare const DatePickerFieldTypeYear: React.ForwardRefExoticComponent<{
|
|
|
42
42
|
label?: string | undefined;
|
|
43
43
|
caption?: string | undefined;
|
|
44
44
|
labelPosition?: "left" | "top" | undefined;
|
|
45
|
+
withClearButton?: boolean | undefined;
|
|
45
46
|
} & Pick<React.HTMLAttributes<HTMLDivElement>, "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "slot" | "spellCheck" | "style" | "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" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "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"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -13,31 +13,43 @@ export var DatePickerFieldTypeYear = React.forwardRef(function (props, ref) {
|
|
|
13
13
|
var inputRef = useRef(null);
|
|
14
14
|
var onChangeRef = useMutableRef(onChange);
|
|
15
15
|
var _f = __read(useState(value && isValid(value) ? format(value, formatProp) : null), 2), stringValue = _f[0], setStringValue = _f[1];
|
|
16
|
-
var
|
|
16
|
+
var stringValueRef = useMutableRef(stringValue);
|
|
17
|
+
var valueRef = useMutableRef(value);
|
|
18
|
+
var onErrorRef = useMutableRef(onError);
|
|
19
|
+
var handleChange = useCallback(function (_a) {
|
|
20
|
+
var _b;
|
|
21
|
+
var e = _a.e, stringValue = _a.value;
|
|
22
|
+
if (stringValueRef.current === stringValue) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
17
25
|
setStringValue(stringValue);
|
|
18
26
|
var onChange = onChangeRef.current;
|
|
27
|
+
var value = valueRef.current;
|
|
19
28
|
if (onChange) {
|
|
20
29
|
if (!stringValue) {
|
|
21
|
-
|
|
30
|
+
if (value) {
|
|
31
|
+
onChange({ e: e, value: null });
|
|
32
|
+
}
|
|
22
33
|
return;
|
|
23
34
|
}
|
|
24
|
-
var
|
|
35
|
+
var _c = __read(getPartsDate(stringValue, formatProp, separator, false, ['yyyy']), 1), yyyy = _c[0];
|
|
25
36
|
if (yyyy) {
|
|
26
37
|
var date = parse("" + yyyy, datePickerPropFormatTypeYear, new Date());
|
|
27
38
|
if (!isWithinInterval(date, { start: minDate, end: maxDate })) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
(_b = onErrorRef.current) === null || _b === void 0 ? void 0 : _b.call(onErrorRef, {
|
|
40
|
+
type: datePickerErrorTypes[0],
|
|
41
|
+
stringValue: stringValue,
|
|
42
|
+
yyyy: yyyy,
|
|
43
|
+
date: date
|
|
44
|
+
});
|
|
45
|
+
if (value) {
|
|
46
|
+
onChange({ e: e, value: null });
|
|
47
|
+
}
|
|
36
48
|
return;
|
|
37
49
|
}
|
|
38
50
|
onChange({ e: e, value: date });
|
|
39
51
|
}
|
|
40
|
-
else {
|
|
52
|
+
else if (value) {
|
|
41
53
|
onChange({ e: e, value: null });
|
|
42
54
|
}
|
|
43
55
|
}
|
|
@@ -56,17 +68,5 @@ export var DatePickerFieldTypeYear = React.forwardRef(function (props, ref) {
|
|
|
56
68
|
setStringValue('');
|
|
57
69
|
}
|
|
58
70
|
}, [value === null || value === void 0 ? void 0 : value.getTime()]);
|
|
59
|
-
|
|
60
|
-
// обнавляем при смене формата
|
|
61
|
-
// задаем нативный oninput, так как с маской по другому не будет работать
|
|
62
|
-
// обнавляем oninput при смене handleChange
|
|
63
|
-
useEffect(function () {
|
|
64
|
-
if (inputRef.current) {
|
|
65
|
-
inputRef.current.oninput = function (e) {
|
|
66
|
-
var _a;
|
|
67
|
-
handleChange(e, ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) || '');
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}, [handleChange]);
|
|
71
|
-
return (React.createElement(TextField, __assign({}, otherProps, { type: "text", inputContainerRef: ref, inputRef: useForkRef([inputRef, inputRefProp]), value: stringValue, placeholder: placeholder })));
|
|
71
|
+
return (React.createElement(TextField, __assign({}, otherProps, { type: "text", onChange: handleChange, inputContainerRef: ref, inputRef: useForkRef([inputRef, inputRefProp]), value: stringValue, placeholder: placeholder })));
|
|
72
72
|
});
|
|
@@ -41,6 +41,7 @@ export declare type DatePickerFieldTypeYearProps = PropsWithHTMLAttributes<{
|
|
|
41
41
|
label?: string;
|
|
42
42
|
caption?: string;
|
|
43
43
|
labelPosition?: 'top' | 'left';
|
|
44
|
+
withClearButton?: boolean;
|
|
44
45
|
}, HTMLDivElement>;
|
|
45
46
|
export declare const useImask: (formatProp: string, separator: string, inputRef: React.RefObject<HTMLInputElement>, stringValue: string | null, onError: DatePickerPropOnError | undefined) => void;
|
|
46
47
|
export {};
|
|
@@ -42,7 +42,8 @@ export declare const DatePickerFieldTypeYearRange: React.ForwardRefExoticCompone
|
|
|
42
42
|
label?: string | undefined;
|
|
43
43
|
caption?: string | undefined;
|
|
44
44
|
labelPosition?: "left" | "top" | undefined;
|
|
45
|
-
|
|
45
|
+
withClearButton?: boolean | undefined;
|
|
46
|
+
}, HTMLDivElement>, "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "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" | "onFocusCapture" | "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" | "disabled" | "view" | "size" | "caption" | "form" | "label" | "width" | "format" | "autoFocus" | "readOnly" | "required" | "status" | "focused" | "ariaLabel" | "labelPosition" | "withClearButton" | "iconSize" | "separator" | "minDate" | "maxDate"> & {
|
|
46
47
|
onChange?: ((props: {
|
|
47
48
|
e: Event;
|
|
48
49
|
value: import("../../../utils/types/Date").DateRange | null;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { __assign, __read, __rest } from "tslib";
|
|
2
|
-
import React, { forwardRef
|
|
3
|
-
import isBefore from 'date-fns/isBefore';
|
|
4
|
-
import isEqual from 'date-fns/isEqual';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
5
3
|
import { FieldCaption } from '../../FieldCaption/FieldCaption';
|
|
6
4
|
import { FieldLabel } from '../../FieldLabel/FieldLabel';
|
|
7
5
|
import { DatePickerFieldTypeYear } from '../DatePickerFieldTypeYear/DatePickerFieldTypeYear';
|
|
8
6
|
import { cnDatePickerMixRangeField } from '../DatePickerMixRangeField/DatePickerMixRangeField';
|
|
7
|
+
import { getChangeFnRange } from '../getChangeFnRange';
|
|
9
8
|
import { getFormForEnd, getFormForStart } from '../helpers';
|
|
10
|
-
import { datePickerErrorTypes } from '../types';
|
|
11
9
|
export var DatePickerFieldTypeYearRange = forwardRef(function (props, ref) {
|
|
12
|
-
var _a, _b;
|
|
13
|
-
var className = props.className, _c = props.form, form = _c === void 0 ? 'default' : _c, startFieldInputRef = props.startFieldInputRef, startFieldLeftSide = props.startFieldLeftSide, startFieldRightSide = props.startFieldRightSide, endFieldInputRef = props.endFieldInputRef, endFieldLeftSide = props.endFieldLeftSide, endFieldRightSide = props.endFieldRightSide, _d = props.value, value = _d === void 0 ? [] : _d, onChange = props.onChange, onError = props.onError, startFieldName = props.startFieldName, endFieldName = props.endFieldName, disabled = props.disabled, size = props.size, view = props.view, status = props.status, autoFocus = props.autoFocus, placeholder = props.placeholder, readOnly = props.readOnly, required = props.required, tabIndex = props.tabIndex, ariaLabel = props.ariaLabel, iconSize = props.iconSize, format = props.format, separator = props.separator, minDate = props.minDate, maxDate = props.maxDate, startFieldOnBlur = props.startFieldOnBlur, startFieldOnFocus = props.startFieldOnFocus, endFieldOnBlur = props.endFieldOnBlur, endFieldOnFocus = props.endFieldOnFocus, startFieldRef = props.startFieldRef, endFieldRef = props.endFieldRef, startFocused = props.startFocused, endFocused = props.endFocused, label = props.label, labelPosition = props.labelPosition, caption = props.caption, width = props.width, otherProps = __rest(props, ["className", "form", "startFieldInputRef", "startFieldLeftSide", "startFieldRightSide", "endFieldInputRef", "endFieldLeftSide", "endFieldRightSide", "value", "onChange", "onError", "startFieldName", "endFieldName", "disabled", "size", "view", "status", "autoFocus", "placeholder", "readOnly", "required", "tabIndex", "ariaLabel", "iconSize", "format", "separator", "minDate", "maxDate", "startFieldOnBlur", "startFieldOnFocus", "endFieldOnBlur", "endFieldOnFocus", "startFieldRef", "endFieldRef", "startFocused", "endFocused", "label", "labelPosition", "caption", "width"]);
|
|
10
|
+
var className = props.className, _a = props.form, form = _a === void 0 ? 'default' : _a, startFieldInputRef = props.startFieldInputRef, startFieldLeftSide = props.startFieldLeftSide, startFieldRightSide = props.startFieldRightSide, endFieldInputRef = props.endFieldInputRef, endFieldLeftSide = props.endFieldLeftSide, endFieldRightSide = props.endFieldRightSide, _b = props.value, value = _b === void 0 ? [] : _b, onChange = props.onChange, onError = props.onError, startFieldName = props.startFieldName, endFieldName = props.endFieldName, disabled = props.disabled, size = props.size, view = props.view, status = props.status, autoFocus = props.autoFocus, placeholder = props.placeholder, readOnly = props.readOnly, required = props.required, tabIndex = props.tabIndex, ariaLabel = props.ariaLabel, iconSize = props.iconSize, format = props.format, separator = props.separator, minDate = props.minDate, maxDate = props.maxDate, startFieldOnBlur = props.startFieldOnBlur, startFieldOnFocus = props.startFieldOnFocus, endFieldOnBlur = props.endFieldOnBlur, endFieldOnFocus = props.endFieldOnFocus, startFieldRef = props.startFieldRef, endFieldRef = props.endFieldRef, startFocused = props.startFocused, endFocused = props.endFocused, label = props.label, labelPosition = props.labelPosition, caption = props.caption, width = props.width, withClearButton = props.withClearButton, otherProps = __rest(props, ["className", "form", "startFieldInputRef", "startFieldLeftSide", "startFieldRightSide", "endFieldInputRef", "endFieldLeftSide", "endFieldRightSide", "value", "onChange", "onError", "startFieldName", "endFieldName", "disabled", "size", "view", "status", "autoFocus", "placeholder", "readOnly", "required", "tabIndex", "ariaLabel", "iconSize", "format", "separator", "minDate", "maxDate", "startFieldOnBlur", "startFieldOnFocus", "endFieldOnBlur", "endFieldOnFocus", "startFieldRef", "endFieldRef", "startFocused", "endFocused", "label", "labelPosition", "caption", "width", "withClearButton"]);
|
|
14
11
|
var commonProps = {
|
|
15
12
|
className: cnDatePickerMixRangeField('Field'),
|
|
16
13
|
disabled: disabled,
|
|
@@ -28,68 +25,15 @@ export var DatePickerFieldTypeYearRange = forwardRef(function (props, ref) {
|
|
|
28
25
|
format: format,
|
|
29
26
|
separator: separator,
|
|
30
27
|
minDate: minDate,
|
|
31
|
-
maxDate: maxDate
|
|
28
|
+
maxDate: maxDate,
|
|
29
|
+
withClearButton: withClearButton
|
|
32
30
|
};
|
|
33
|
-
var
|
|
34
|
-
var _f = __read(useState(value === null || value === void 0 ? void 0 : value[1]), 2), endDate = _f[0], setEndDate = _f[1];
|
|
35
|
-
var eventRef = useRef();
|
|
36
|
-
var handleChange = function (e, ownStartDate, ownEndDate) {
|
|
37
|
-
var start = ownStartDate || startDate;
|
|
38
|
-
var end = ownEndDate || endDate;
|
|
39
|
-
if (!onChange) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (start && end) {
|
|
43
|
-
if (isBefore(start, end) || isEqual(start, end)) {
|
|
44
|
-
onChange({ e: e, value: [start, end] });
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
onChange({ e: e, value: [start, undefined] });
|
|
48
|
-
onError && onError({ type: datePickerErrorTypes[2], date: [start, end] });
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (start) {
|
|
52
|
-
onChange({ e: e, value: [start, undefined] });
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (end) {
|
|
56
|
-
onChange({ e: e, value: [undefined, end] });
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
onChange({ e: e, value: null });
|
|
60
|
-
};
|
|
61
|
-
var handleStartDateChange = function (props) {
|
|
62
|
-
var _a;
|
|
63
|
-
if (((_a = props.value) === null || _a === void 0 ? void 0 : _a.getTime()) === (startDate === null || startDate === void 0 ? void 0 : startDate.getTime())) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
eventRef.current = props.e;
|
|
67
|
-
setStartDate(props.value);
|
|
68
|
-
};
|
|
69
|
-
var handleEndDateChange = function (props) {
|
|
70
|
-
var _a;
|
|
71
|
-
if (((_a = props.value) === null || _a === void 0 ? void 0 : _a.getTime()) === (endDate === null || endDate === void 0 ? void 0 : endDate.getTime())) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
eventRef.current = props.e;
|
|
75
|
-
setEndDate(props.value);
|
|
76
|
-
};
|
|
77
|
-
useEffect(function () {
|
|
78
|
-
if (eventRef.current) {
|
|
79
|
-
handleChange(eventRef.current, startDate, endDate);
|
|
80
|
-
}
|
|
81
|
-
}, [eventRef.current]);
|
|
82
|
-
useEffect(function () {
|
|
83
|
-
setStartDate(value === null || value === void 0 ? void 0 : value[0]);
|
|
84
|
-
}, [(_a = value === null || value === void 0 ? void 0 : value[0]) === null || _a === void 0 ? void 0 : _a.getTime()]);
|
|
85
|
-
useEffect(function () {
|
|
86
|
-
setEndDate(value === null || value === void 0 ? void 0 : value[1]);
|
|
87
|
-
}, [(_b = value === null || value === void 0 ? void 0 : value[1]) === null || _b === void 0 ? void 0 : _b.getTime()]);
|
|
31
|
+
var _c = __read(getChangeFnRange(onChange, onError, value), 2), handleStartDateChange = _c[0], handleEndDateChange = _c[1];
|
|
88
32
|
return (React.createElement("div", __assign({}, otherProps, { className: cnDatePickerMixRangeField({ view: view, labelPosition: labelPosition, width: width, size: size }, [className]), ref: ref }),
|
|
89
33
|
label && (React.createElement(FieldLabel, { required: required, className: cnDatePickerMixRangeField('Label', { labelPosition: labelPosition }), size: size }, label)),
|
|
90
34
|
React.createElement("div", { className: cnDatePickerMixRangeField('Body') },
|
|
91
35
|
React.createElement("div", { className: cnDatePickerMixRangeField('Fields') },
|
|
92
|
-
React.createElement(DatePickerFieldTypeYear, __assign({}, commonProps, { inputRef: startFieldInputRef, ref: startFieldRef, leftSide: startFieldLeftSide, rightSide: startFieldRightSide, form: getFormForStart(form), value:
|
|
93
|
-
React.createElement(DatePickerFieldTypeYear, __assign({}, commonProps, { name: endFieldName, inputRef: endFieldInputRef, ref: endFieldRef, leftSide: endFieldLeftSide, rightSide: endFieldRightSide, form: getFormForEnd(form), value:
|
|
36
|
+
React.createElement(DatePickerFieldTypeYear, __assign({}, commonProps, { inputRef: startFieldInputRef, ref: startFieldRef, leftSide: startFieldLeftSide, rightSide: startFieldRightSide, form: getFormForStart(form), value: value === null || value === void 0 ? void 0 : value[0], onChange: handleStartDateChange, onFocus: startFieldOnFocus, onBlur: startFieldOnBlur, focused: startFocused, name: startFieldName })),
|
|
37
|
+
React.createElement(DatePickerFieldTypeYear, __assign({}, commonProps, { name: endFieldName, inputRef: endFieldInputRef, ref: endFieldRef, leftSide: endFieldLeftSide, rightSide: endFieldRightSide, form: getFormForEnd(form), value: value === null || value === void 0 ? void 0 : value[1], onChange: handleEndDateChange, onFocus: endFieldOnFocus, onBlur: endFieldOnBlur, focused: endFocused }))),
|
|
94
38
|
caption && (React.createElement(FieldCaption, { className: cnDatePickerMixRangeField('Caption'), status: status }, caption)))));
|
|
95
39
|
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DateRange } from '../../utils/types/Date';
|
|
2
|
+
import { DatePickerPropOnError } from './types';
|
|
3
|
+
declare type OnChange = (props: {
|
|
4
|
+
e: Event;
|
|
5
|
+
value: DateRange | null;
|
|
6
|
+
}) => void;
|
|
7
|
+
export declare const getChangeFnRange: (onChange: OnChange | undefined, onError: DatePickerPropOnError | undefined, value: DateRange | null | undefined) => readonly [(props: {
|
|
8
|
+
e: Event;
|
|
9
|
+
value: Date | null;
|
|
10
|
+
}) => void, (props: {
|
|
11
|
+
e: Event;
|
|
12
|
+
value: Date | null;
|
|
13
|
+
}) => void];
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import isBefore from 'date-fns/isBefore';
|
|
2
|
+
import isEqual from 'date-fns/isEqual';
|
|
3
|
+
import { datePickerErrorTypes } from './types';
|
|
4
|
+
var handleChange = function (e, start, end, onChange, onError) {
|
|
5
|
+
if (!onChange) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
if (start && end) {
|
|
9
|
+
if (isBefore(start, end) || isEqual(start, end)) {
|
|
10
|
+
onChange({ e: e, value: [start, end] });
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
onChange({ e: e, value: [start, undefined] });
|
|
14
|
+
onError && onError({ type: datePickerErrorTypes[2], date: [start, end] });
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (start) {
|
|
18
|
+
onChange({ e: e, value: [start, undefined] });
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (end) {
|
|
22
|
+
onChange({ e: e, value: [undefined, end] });
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
onChange({ e: e, value: null });
|
|
26
|
+
};
|
|
27
|
+
export var getChangeFnRange = function (onChange, onError, value) {
|
|
28
|
+
return [
|
|
29
|
+
function (props) {
|
|
30
|
+
handleChange(props.e, props.value, value === null || value === void 0 ? void 0 : value[1], onChange, onError);
|
|
31
|
+
},
|
|
32
|
+
function (props) {
|
|
33
|
+
handleChange(props.e, value === null || value === void 0 ? void 0 : value[0], props.value, onChange, onError);
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
};
|
|
@@ -73,6 +73,7 @@ export declare type DatePickerProps<TYPE extends DatePickerPropType = 'date'> =
|
|
|
73
73
|
multiplicityMinutes?: number;
|
|
74
74
|
multiplicityHours?: number;
|
|
75
75
|
isMobile?: number;
|
|
76
|
+
withClearButton?: boolean;
|
|
76
77
|
}, HTMLDivElement>;
|
|
77
78
|
export declare type DatePickerComponent = <TYPE extends DatePickerPropType = 'date'>(props: DatePickerProps<TYPE>) => React.ReactElement | null;
|
|
78
79
|
export declare type DatePickerTypeComponent<TYPE extends DatePickerPropType> = (props: Omit<DatePickerProps<TYPE>, 'type'>) => React.ReactElement | null;
|
|
@@ -20,9 +20,12 @@
|
|
|
20
20
|
background: var(--color-control-bg-clear);
|
|
21
21
|
border: 2px dashed var(--color-control-bg-border-default);
|
|
22
22
|
border-radius: var(--control-radius);
|
|
23
|
-
cursor: pointer;
|
|
24
23
|
}
|
|
25
24
|
|
|
25
|
+
.DragNDropField:not(.DragNDropField_disabled) {
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
}
|
|
28
|
+
|
|
26
29
|
.DragNDropField:hover {
|
|
27
30
|
background: var(--color-control-bg-clear-hover);
|
|
28
31
|
border-color: var(--color-control-bg-border-default-hover);
|
|
@@ -32,3 +35,9 @@
|
|
|
32
35
|
background: var(--color-control-bg-clear-hover);
|
|
33
36
|
border-color: var(--color-control-bg-border-focus);
|
|
34
37
|
}
|
|
38
|
+
|
|
39
|
+
.DragNDropField_disabled,
|
|
40
|
+
.DragNDropField_disabled:hover {
|
|
41
|
+
background: var(--color-control-bg-disable);
|
|
42
|
+
border-color: transparent;
|
|
43
|
+
}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import './DragNDropField.css';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { DragNDropFieldChildrenRenderProp } from './types';
|
|
4
4
|
export declare const COMPONENT_NAME: "DragNDropField";
|
|
5
|
-
export declare const DragNDropField: React.ForwardRefExoticComponent<
|
|
5
|
+
export declare const DragNDropField: React.ForwardRefExoticComponent<{
|
|
6
|
+
accept?: string | string[] | undefined;
|
|
7
|
+
maxSize?: number | undefined;
|
|
8
|
+
multiple?: boolean | undefined;
|
|
9
|
+
onDropFiles: (files: File[]) => void;
|
|
10
|
+
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | DragNDropFieldChildrenRenderProp | null | undefined;
|
|
11
|
+
locale?: import("./locale").Locale | undefined;
|
|
12
|
+
disabled?: boolean | undefined;
|
|
13
|
+
} & Pick<React.HTMLAttributes<HTMLDivElement>, "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "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" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "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"> & React.RefAttributes<HTMLDivElement>>;
|
|
6
14
|
export * from './types';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
2
|
import './DragNDropField.css';
|
|
3
|
-
import React, { useRef } from 'react';
|
|
3
|
+
import React, { forwardRef, useRef } from 'react';
|
|
4
4
|
import { useDropzone } from 'react-dropzone';
|
|
5
5
|
import { useForkRef } from '../../hooks/useForkRef/useForkRef';
|
|
6
|
+
import { useMutableRef } from '../../hooks/useMutableRef/useMutableRef';
|
|
6
7
|
import { cn } from '../../utils/bem';
|
|
7
8
|
import { usePropsHandler } from '../EventInterceptor/usePropsHandler';
|
|
8
9
|
import { Text } from '../Text/Text';
|
|
@@ -12,29 +13,30 @@ import { getErrorsList } from './getErrorsList';
|
|
|
12
13
|
import { withdefaultLocale } from './locale';
|
|
13
14
|
var cnDragNDropField = cn('DragNDropField');
|
|
14
15
|
export var COMPONENT_NAME = 'DragNDropField';
|
|
15
|
-
export var DragNDropField =
|
|
16
|
+
export var DragNDropField = forwardRef(function (props, ref) {
|
|
16
17
|
var dragNDropFieldRef = useRef(null);
|
|
17
|
-
var _a = usePropsHandler(COMPONENT_NAME, props, dragNDropFieldRef), accept = _a.accept, maxSize = _a.maxSize, _b = _a.multiple, multiple = _b === void 0 ? false : _b, onDropFiles = _a.onDropFiles, _c = _a.children, children = _c === void 0 ? DragNDropFieldContent : _c, localeProp = _a.locale;
|
|
18
|
+
var _a = usePropsHandler(COMPONENT_NAME, props, dragNDropFieldRef), accept = _a.accept, maxSize = _a.maxSize, _b = _a.multiple, multiple = _b === void 0 ? false : _b, onDropFiles = _a.onDropFiles, _c = _a.children, children = _c === void 0 ? DragNDropFieldContent : _c, localeProp = _a.locale, disabled = _a.disabled, onClick = _a.onClick, otherProps = __rest(_a, ["accept", "maxSize", "multiple", "onDropFiles", "children", "locale", "disabled", "onClick"]);
|
|
19
|
+
var onClickRef = useMutableRef(onClick);
|
|
18
20
|
var locale = withdefaultLocale(localeProp);
|
|
19
21
|
var handleDrop = React.useCallback(function (acceptedFiles) { return acceptedFiles.length > 0 && onDropFiles(acceptedFiles); }, [onDropFiles]);
|
|
20
22
|
var _d = useDropzone({
|
|
21
23
|
accept: (accept === null || accept === void 0 ? void 0 : accept.length) ? accept : undefined,
|
|
22
24
|
maxSize: maxSize || undefined,
|
|
23
25
|
onDrop: handleDrop,
|
|
24
|
-
multiple: multiple
|
|
26
|
+
multiple: multiple,
|
|
27
|
+
disabled: disabled
|
|
25
28
|
}), fileRejections = _d.fileRejections, getRootProps = _d.getRootProps, getInputProps = _d.getInputProps, isDragActive = _d.isDragActive, rootRef = _d.rootRef, open = _d.open;
|
|
26
|
-
var handleRootClick = React.useCallback(function (
|
|
29
|
+
var handleRootClick = React.useCallback(function (e) {
|
|
30
|
+
var _a;
|
|
27
31
|
// Чтобы не открывалось окно выбора файла при клике по внутренним элементам
|
|
28
|
-
if (
|
|
29
|
-
|
|
32
|
+
if (e.target !== rootRef.current) {
|
|
33
|
+
e.stopPropagation();
|
|
30
34
|
}
|
|
35
|
+
(_a = onClickRef.current) === null || _a === void 0 ? void 0 : _a.call(onClickRef, e);
|
|
31
36
|
}, []);
|
|
32
|
-
var rootProps = getRootProps({
|
|
33
|
-
className: cnDragNDropField('', { active: isDragActive }),
|
|
34
|
-
onClick: handleRootClick
|
|
35
|
-
});
|
|
37
|
+
var rootProps = getRootProps(__assign(__assign({}, otherProps), { className: cnDragNDropField({ active: isDragActive, disabled: disabled }), onClick: handleRootClick }));
|
|
36
38
|
var content = isRenderProp(children)
|
|
37
|
-
? children({ accept: accept, maxSize: maxSize, multiple: multiple, openFileDialog: open, locale: locale })
|
|
39
|
+
? children({ accept: accept, maxSize: maxSize, multiple: multiple, openFileDialog: open, locale: locale, disabled: disabled })
|
|
38
40
|
: children;
|
|
39
41
|
var errors = React.useMemo(function () { return getErrorsList(fileRejections, { maxSize: maxSize }, locale); }, [
|
|
40
42
|
fileRejections,
|
package/__internal__/src/components/DragNDropField/DragNDropFieldContent/DragNDropFieldContent.js
CHANGED
|
@@ -8,14 +8,14 @@ import { getText } from '../locale';
|
|
|
8
8
|
import { formatFileRequirements } from './formatFileRequirements';
|
|
9
9
|
var cnDragNDropFieldContent = cn('DragNDropFieldContent');
|
|
10
10
|
export var DragNDropFieldContent = function (_a) {
|
|
11
|
-
var accept = _a.accept, maxSize = _a.maxSize, multiple = _a.multiple, openFileDialog = _a.openFileDialog, locale = _a.locale;
|
|
11
|
+
var accept = _a.accept, maxSize = _a.maxSize, multiple = _a.multiple, openFileDialog = _a.openFileDialog, locale = _a.locale, disabled = _a.disabled;
|
|
12
12
|
var requirements = formatFileRequirements(accept, maxSize);
|
|
13
13
|
var fileText = multiple ? locale.files : locale.file;
|
|
14
14
|
return (React.createElement(React.Fragment, null,
|
|
15
|
-
React.createElement(Text, { view: "secondary", size: "s", lineHeight: "s", align: "center" },
|
|
15
|
+
React.createElement(Text, { className: cnDragNDropFieldContent('Text', { disabled: disabled }), view: "secondary", size: "s", lineHeight: "s", align: "center" },
|
|
16
16
|
getText(locale['call-to-action'], { fileText: fileText }),
|
|
17
17
|
requirements && (React.createElement(React.Fragment, null,
|
|
18
18
|
React.createElement("br", null),
|
|
19
19
|
requirements))),
|
|
20
|
-
React.createElement(Button, { className: cnDragNDropFieldContent('Button'), label: getText(locale['action-button'], { fileText: fileText }), iconLeft: IconAttach, view: "ghost", size: "s", onClick: openFileDialog })));
|
|
20
|
+
React.createElement(Button, { className: cnDragNDropFieldContent('Button'), label: getText(locale['action-button'], { fileText: fileText }), iconLeft: IconAttach, view: "ghost", size: "s", onClick: openFileDialog, disabled: disabled })));
|
|
21
21
|
};
|