@consta/uikit 3.21.0 → 3.22.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 +22 -44
- 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/ChoiceGroup/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/FileIconPtt/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/Switch/package.json +1 -1
- package/SwitchGroup/package.json +1 -1
- package/Table/package.json +1 -1
- package/Tabs/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/Combobox.js +1 -1
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerCanary.js +5 -1
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeMonth/DatePickerFieldTypeMonth.d.ts +45 -0
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeMonth/DatePickerFieldTypeMonth.js +76 -0
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeMonth/helpers.d.ts +46 -0
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeMonth/helpers.js +61 -0
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeMonthRange/DatePickerFieldTypeMonthRange.d.ts +82 -0
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeMonthRange/DatePickerFieldTypeMonthRange.js +98 -0
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeMonthRange/helpers.d.ts +32 -0
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeMonthRange/helpers.js +2 -0
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerTypeDateTimeRange/DatePickerTypeDateTimeRange.js +2 -2
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerTypeMonth/DatePickerTypeMonth.d.ts +2 -0
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerTypeMonth/DatePickerTypeMonth.js +61 -0
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerTypeMonthRange/DatePickerTypeMonthRange.d.ts +2 -0
- package/__internal__/cjs-src/components/DatePickerCanary/DatePickerTypeMonthRange/DatePickerTypeMonthRange.js +107 -0
- package/__internal__/cjs-src/components/DatePickerCanary/helpers.d.ts +2 -0
- package/__internal__/cjs-src/components/DatePickerCanary/helpers.js +3 -1
- package/__internal__/cjs-src/components/DatePickerCanary/types.d.ts +2 -2
- package/__internal__/cjs-src/components/DatePickerCanary/types.js +2 -0
- package/__internal__/cjs-src/components/SelectComponents/Select.css +50 -1
- package/__internal__/cjs-src/components/SelectComponents/SelectContainer/SelectContainer.d.ts +3 -1
- package/__internal__/cjs-src/components/SelectComponents/SelectContainer/SelectContainer.js +2 -2
- package/__internal__/cjs-src/components/UserSelect/UserSelect.js +1 -1
- package/__internal__/src/components/Combobox/Combobox.js +1 -1
- package/__internal__/src/components/DatePickerCanary/DatePickerCanary.js +5 -1
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeMonth/DatePickerFieldTypeMonth.d.ts +45 -0
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeMonth/DatePickerFieldTypeMonth.js +73 -0
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeMonth/helpers.d.ts +46 -0
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeMonth/helpers.js +58 -0
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeMonthRange/DatePickerFieldTypeMonthRange.d.ts +82 -0
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeMonthRange/DatePickerFieldTypeMonthRange.js +95 -0
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeMonthRange/helpers.d.ts +32 -0
- package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeMonthRange/helpers.js +0 -0
- package/__internal__/src/components/DatePickerCanary/DatePickerTypeDateTimeRange/DatePickerTypeDateTimeRange.js +2 -2
- package/__internal__/src/components/DatePickerCanary/DatePickerTypeMonth/DatePickerTypeMonth.d.ts +2 -0
- package/__internal__/src/components/DatePickerCanary/DatePickerTypeMonth/DatePickerTypeMonth.js +58 -0
- package/__internal__/src/components/DatePickerCanary/DatePickerTypeMonthRange/DatePickerTypeMonthRange.d.ts +2 -0
- package/__internal__/src/components/DatePickerCanary/DatePickerTypeMonthRange/DatePickerTypeMonthRange.js +104 -0
- package/__internal__/src/components/DatePickerCanary/helpers.d.ts +2 -0
- package/__internal__/src/components/DatePickerCanary/helpers.js +2 -0
- package/__internal__/src/components/DatePickerCanary/types.d.ts +2 -2
- package/__internal__/src/components/DatePickerCanary/types.js +2 -0
- package/__internal__/src/components/SelectComponents/Select.css +50 -1
- package/__internal__/src/components/SelectComponents/SelectContainer/SelectContainer.d.ts +3 -1
- package/__internal__/src/components/SelectComponents/SelectContainer/SelectContainer.js +2 -2
- package/__internal__/src/components/UserSelect/UserSelect.js +1 -1
- package/createIcon/package.json +1 -1
- package/createResponsesImage/package.json +1 -1
- package/package.json +1 -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
package/__internal__/cjs-src/components/SelectComponents/SelectContainer/SelectContainer.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare type SelectContainerProps = PropsWithHTMLAttributesAndRef<{
|
|
|
11
11
|
required?: boolean;
|
|
12
12
|
status?: PropStatus;
|
|
13
13
|
label?: string;
|
|
14
|
+
type?: 'select' | 'combobox' | 'userselect';
|
|
14
15
|
labelPosition?: 'top' | 'left';
|
|
15
16
|
caption?: string;
|
|
16
17
|
}, HTMLDivElement>;
|
|
@@ -24,6 +25,7 @@ export declare const SelectContainer: React.ForwardRefExoticComponent<Pick<Props
|
|
|
24
25
|
required?: boolean | undefined;
|
|
25
26
|
status?: "alert" | "success" | "warning" | undefined;
|
|
26
27
|
label?: string | undefined;
|
|
28
|
+
type?: "select" | "combobox" | "userselect" | undefined;
|
|
27
29
|
labelPosition?: "left" | "top" | undefined;
|
|
28
30
|
caption?: string | undefined;
|
|
29
|
-
}, 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" | "children" | "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" | "disabled" | "view" | "size" | "key" | "caption" | "form" | "label" | "multiple" | "required" | "status" | "focused" | "labelPosition"> & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
}, 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" | "children" | "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" | "disabled" | "view" | "size" | "key" | "caption" | "form" | "label" | "type" | "multiple" | "required" | "status" | "focused" | "labelPosition"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -8,8 +8,8 @@ var FieldLabel_1 = require("../../FieldLabel/FieldLabel");
|
|
|
8
8
|
var cnSelect_1 = require("../cnSelect");
|
|
9
9
|
var types_1 = require("../types");
|
|
10
10
|
exports.SelectContainer = react_1.forwardRef(function (props, ref) {
|
|
11
|
-
var _a = props.size, size = _a === void 0 ? types_1.defaultPropSize : _a, _b = props.form, form = _b === void 0 ? types_1.defaultPropForm : _b, _c = props.view, view = _c === void 0 ? types_1.defaultPropView : _c, className = props.className, disabled = props.disabled, required = props.required, children = props.children, status = props.status, focused = props.focused, multiple = props.multiple, _d = props.labelPosition, labelPosition =
|
|
12
|
-
return (react_1["default"].createElement("div", tslib_1.__assign({ className: cnSelect_1.cnSelect({ labelPosition: labelPosition, size: size, view: view }, [className]) }, otherProps),
|
|
11
|
+
var _a = props.size, size = _a === void 0 ? types_1.defaultPropSize : _a, _b = props.form, form = _b === void 0 ? types_1.defaultPropForm : _b, _c = props.view, view = _c === void 0 ? types_1.defaultPropView : _c, className = props.className, disabled = props.disabled, required = props.required, children = props.children, status = props.status, focused = props.focused, multiple = props.multiple, _d = props.type, type = _d === void 0 ? 'select' : _d, _e = props.labelPosition, labelPosition = _e === void 0 ? 'top' : _e, label = props.label, caption = props.caption, otherProps = tslib_1.__rest(props, ["size", "form", "view", "className", "disabled", "required", "children", "status", "focused", "multiple", "type", "labelPosition", "label", "caption"]);
|
|
12
|
+
return (react_1["default"].createElement("div", tslib_1.__assign({ className: cnSelect_1.cnSelect({ labelPosition: labelPosition, size: size, view: view, type: type }, [className]) }, otherProps),
|
|
13
13
|
label && (react_1["default"].createElement(FieldLabel_1.FieldLabel, { required: required, className: cnSelect_1.cnSelect('Label', { labelPosition: labelPosition }), size: size }, label)),
|
|
14
14
|
react_1["default"].createElement("div", { className: cnSelect_1.cnSelect('Body') },
|
|
15
15
|
react_1["default"].createElement("div", { className: cnSelect_1.cnSelect('SelectContainer', {
|
|
@@ -79,7 +79,7 @@ function UserSelectRender(props, ref) {
|
|
|
79
79
|
isUserSelect: true
|
|
80
80
|
}), value: searchValue, style: { width: width } }))));
|
|
81
81
|
};
|
|
82
|
-
return (react_1["default"].createElement(SelectContainer_1.SelectContainer, tslib_1.__assign({ focused: isFocused, disabled: disabled, size: size, required: required, view: view, form: form, multiple: true, ref: ref, style: style }, restProps),
|
|
82
|
+
return (react_1["default"].createElement(SelectContainer_1.SelectContainer, tslib_1.__assign({ focused: isFocused, disabled: disabled, size: size, required: required, view: view, type: "userselect", form: form, multiple: true, ref: ref, style: style }, restProps),
|
|
83
83
|
react_1["default"].createElement("div", { className: cnSelect_1.cnSelect('Control', { hasInput: true }), ref: controlRef, "aria-expanded": isOpen, "aria-haspopup": "listbox", id: id },
|
|
84
84
|
react_1["default"].createElement("div", { className: cnSelect_1.cnSelect('ControlInner'), onClick: handleInputClick, role: "button", ref: controlInnerRef, "aria-hidden": "true" },
|
|
85
85
|
react_1["default"].createElement("div", { className: cnSelect_1.cnSelect('ControlValueContainer') }, multiple ? (react_1["default"].createElement("div", { className: cnSelect_1.cnSelect('ControlValue', { isUserSelect: true }) }, renderControlValue())) : (renderControlValue()))),
|
|
@@ -73,7 +73,7 @@ function ComboboxRender(props, ref) {
|
|
|
73
73
|
(!value || (Array.isArray(value) && value.length === 0)) && !searchValue && placeholder && (React.createElement("span", { className: cnSelect('Placeholder'), title: "placeholder" }, placeholder)),
|
|
74
74
|
React.createElement("input", __assign({}, getKeyProps(), { type: "text", name: name, onFocus: handleInputFocus, onBlur: handleInputBlur, "aria-label": ariaLabel, onChange: handleChangeValue, ref: inputRefForRender, className: cnSelect('Input', { size: size, hide: !multiple && !!value, multiple: multiple }), value: searchValue, style: { width: width } }))));
|
|
75
75
|
};
|
|
76
|
-
return (React.createElement(SelectContainer, __assign({ focused: isFocused, disabled: disabled, size: size, view: view, required: required, form: form, multiple: multiple, ref: ref, style: style }, otherProps),
|
|
76
|
+
return (React.createElement(SelectContainer, __assign({ focused: isFocused, disabled: disabled, size: size, view: view, required: required, form: form, multiple: multiple, ref: ref, type: "combobox", style: style }, otherProps),
|
|
77
77
|
React.createElement("div", { className: cnSelect('Control', { hasInput: true }), ref: controlRef, "aria-expanded": isOpen, "aria-haspopup": "listbox", id: id },
|
|
78
78
|
React.createElement("div", { className: cnSelect('ControlInner'), onClick: handleInputClick, role: "button", ref: controlInnerRef, "aria-hidden": "true" },
|
|
79
79
|
React.createElement("div", { className: cnSelect('ControlValueContainer') }, multiple ? (React.createElement("div", { className: cnSelect('ControlValue') }, renderControlValue())) : (renderControlValue()))),
|
|
@@ -8,6 +8,8 @@ import { DatePickerTypeDate } from './DatePickerTypeDate/DatePickerTypeDate';
|
|
|
8
8
|
import { DatePickerTypeDateRange } from './DatePickerTypeDateRange/DatePickerTypeDateRange';
|
|
9
9
|
import { DatePickerTypeDateTime } from './DatePickerTypeDateTime/DatePickerTypeDateTime';
|
|
10
10
|
import { DatePickerTypeDateTimeRange } from './DatePickerTypeDateTimeRange/DatePickerTypeDateTimeRange';
|
|
11
|
+
import { DatePickerTypeMonth } from './DatePickerTypeMonth/DatePickerTypeMonth';
|
|
12
|
+
import { DatePickerTypeMonthRange } from './DatePickerTypeMonthRange/DatePickerTypeMonthRange';
|
|
11
13
|
import { DatePickerTypeTime } from './DatePickerTypeTime/DatePickerTypeTime';
|
|
12
14
|
import { DatePickerTypeYear } from './DatePickerTypeYear/DatePickerTypeYear';
|
|
13
15
|
import { DatePickerTypeYearRange } from './DatePickerTypeYearRange/DatePickerTypeYearRange';
|
|
@@ -20,7 +22,9 @@ var typeMap = {
|
|
|
20
22
|
'date-time-range': DatePickerTypeDateTimeRange,
|
|
21
23
|
'time': DatePickerTypeTime,
|
|
22
24
|
'year': DatePickerTypeYear,
|
|
23
|
-
'year-range': DatePickerTypeYearRange
|
|
25
|
+
'year-range': DatePickerTypeYearRange,
|
|
26
|
+
'month': DatePickerTypeMonth,
|
|
27
|
+
'month-range': DatePickerTypeMonthRange
|
|
24
28
|
};
|
|
25
29
|
export var COMPONENT_NAME = 'DatePicker';
|
|
26
30
|
export var DatePicker = forwardRef(function (props, ref) {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const DatePickerFieldTypeMonth: React.ForwardRefExoticComponent<{
|
|
3
|
+
className?: string | undefined;
|
|
4
|
+
value?: Date | null | undefined;
|
|
5
|
+
onChange?: ((props: {
|
|
6
|
+
e: Event;
|
|
7
|
+
value: Date | null;
|
|
8
|
+
}) => void) | undefined;
|
|
9
|
+
onError?: import("../types").DatePickerPropOnError | undefined;
|
|
10
|
+
id?: string | undefined;
|
|
11
|
+
name?: string | undefined;
|
|
12
|
+
disabled?: boolean | undefined;
|
|
13
|
+
size?: "xs" | "s" | "m" | "l" | undefined;
|
|
14
|
+
view?: "default" | "clear" | undefined;
|
|
15
|
+
form?: "default" | "round" | "brick" | "brickRound" | "roundBrick" | "brickDefault" | "defaultBrick" | "clearRound" | "roundClear" | "clearDefault" | "defaultClear" | "brickClear" | "clearBrick" | "clearClear" | undefined;
|
|
16
|
+
status?: "alert" | "success" | "warning" | undefined;
|
|
17
|
+
width?: "default" | "full" | undefined;
|
|
18
|
+
onFocus?: ((event: React.FocusEvent<HTMLElement>) => void) | undefined;
|
|
19
|
+
onBlur?: ((event: React.FocusEvent<HTMLElement>) => void) | undefined;
|
|
20
|
+
autoFocus?: boolean | undefined;
|
|
21
|
+
placeholder?: string | undefined;
|
|
22
|
+
leftSide?: string | React.FC<import("../../../utils/types/PropsWithHTMLAttributes").PropsWithHTMLAttributesAndRef<{
|
|
23
|
+
view?: "link" | "alert" | "brand" | "ghost" | "primary" | "secondary" | "success" | "warning" | "disabled" | undefined;
|
|
24
|
+
size?: "xs" | "s" | "m" | undefined;
|
|
25
|
+
}, HTMLSpanElement>> | undefined;
|
|
26
|
+
rightSide?: string | React.FC<import("../../../utils/types/PropsWithHTMLAttributes").PropsWithHTMLAttributesAndRef<{
|
|
27
|
+
view?: "link" | "alert" | "brand" | "ghost" | "primary" | "secondary" | "success" | "warning" | "disabled" | undefined;
|
|
28
|
+
size?: "xs" | "s" | "m" | undefined;
|
|
29
|
+
}, HTMLSpanElement>> | undefined;
|
|
30
|
+
readOnly?: boolean | undefined;
|
|
31
|
+
required?: boolean | undefined;
|
|
32
|
+
tabIndex?: number | undefined;
|
|
33
|
+
inputRef?: ((instance: HTMLInputElement | HTMLTextAreaElement | null) => void) | React.RefObject<HTMLInputElement | HTMLTextAreaElement> | null | undefined;
|
|
34
|
+
ariaLabel?: string | undefined;
|
|
35
|
+
iconSize?: "xs" | "s" | "m" | undefined;
|
|
36
|
+
children?: undefined;
|
|
37
|
+
format?: string | undefined;
|
|
38
|
+
separator?: string | undefined;
|
|
39
|
+
minDate?: Date | undefined;
|
|
40
|
+
maxDate?: Date | undefined;
|
|
41
|
+
focused?: boolean | undefined;
|
|
42
|
+
label?: string | undefined;
|
|
43
|
+
caption?: string | undefined;
|
|
44
|
+
labelPosition?: "left" | "top" | undefined;
|
|
45
|
+
} & 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>>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { __assign, __read, __rest } from "tslib";
|
|
2
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { format, isValid, isWithinInterval, parse } from 'date-fns';
|
|
4
|
+
import { useForkRef } from '../../../hooks/useForkRef/useForkRef';
|
|
5
|
+
import { useMutableRef } from '../../../hooks/useMutableRef/useMutableRef';
|
|
6
|
+
import { maxDateDefault, minDateDefault } from '../../../utils/date';
|
|
7
|
+
import { TextField } from '../../TextField/TextField';
|
|
8
|
+
import { datePickerPropFormatTypeMonth, datePickerPropPlaceholderTypeMonth, datePickerPropSeparatorDefault, getPartsDate, } from '../helpers';
|
|
9
|
+
import { datePickerErrorTypes } from '../types';
|
|
10
|
+
import { useImask } from './helpers';
|
|
11
|
+
export var DatePickerFieldTypeMonth = React.forwardRef(function (props, ref) {
|
|
12
|
+
var _a = props.format, formatProp = _a === void 0 ? datePickerPropFormatTypeMonth : _a, _b = props.separator, separator = _b === void 0 ? datePickerPropSeparatorDefault : _b, _c = props.placeholder, placeholder = _c === void 0 ? datePickerPropPlaceholderTypeMonth : _c, onChange = props.onChange, onError = props.onError, _d = props.minDate, minDate = _d === void 0 ? minDateDefault : _d, _e = props.maxDate, maxDate = _e === void 0 ? maxDateDefault : _e, value = props.value, inputRefProp = props.inputRef, otherProps = __rest(props, ["format", "separator", "placeholder", "onChange", "onError", "minDate", "maxDate", "value", "inputRef"]);
|
|
13
|
+
var inputRef = useRef(null);
|
|
14
|
+
var onChangeRef = useMutableRef(onChange);
|
|
15
|
+
var _f = __read(useState(value && isValid(value) ? format(value, formatProp) : null), 2), stringValue = _f[0], setStringValue = _f[1];
|
|
16
|
+
var handleChange = useCallback(function (e, stringValue) {
|
|
17
|
+
setStringValue(stringValue);
|
|
18
|
+
var onChange = onChangeRef.current;
|
|
19
|
+
if (onChange) {
|
|
20
|
+
if (!stringValue) {
|
|
21
|
+
onChange({ e: e, value: null });
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
var _a = __read(getPartsDate(stringValue, formatProp, separator, false, ['MM', 'yyyy']), 2), MM = _a[0], yyyy = _a[1];
|
|
25
|
+
if (MM && yyyy) {
|
|
26
|
+
var date = parse("" + MM + datePickerPropSeparatorDefault + yyyy, datePickerPropFormatTypeMonth, new Date());
|
|
27
|
+
if (!isWithinInterval(date, { start: minDate, end: maxDate })) {
|
|
28
|
+
onError &&
|
|
29
|
+
onError({
|
|
30
|
+
type: datePickerErrorTypes[0],
|
|
31
|
+
stringValue: stringValue,
|
|
32
|
+
MM: MM,
|
|
33
|
+
yyyy: yyyy,
|
|
34
|
+
date: date
|
|
35
|
+
});
|
|
36
|
+
onChange({ e: e, value: null });
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
onChange({ e: e, value: date });
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
onChange({ e: e, value: null });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}, [minDate === null || minDate === void 0 ? void 0 : minDate.getTime(), maxDate === null || maxDate === void 0 ? void 0 : maxDate.getTime(), formatProp, separator]);
|
|
46
|
+
useImask(formatProp, separator, inputRef, stringValue, onError);
|
|
47
|
+
// при изменении value, нужно обновить stringValue
|
|
48
|
+
useEffect(function () {
|
|
49
|
+
if (value && isValid(value)) {
|
|
50
|
+
setStringValue(format(value, formatProp));
|
|
51
|
+
}
|
|
52
|
+
else if ((stringValue === null || stringValue === void 0 ? void 0 : stringValue.length) === formatProp.length) {
|
|
53
|
+
// если количество введенных символов меньше чем в формате маски
|
|
54
|
+
// то не нужно мешать вводу с клавиатуры
|
|
55
|
+
// если дата была введена полностью и value пришел null,
|
|
56
|
+
// то можно считать что поле нуждается в очистке
|
|
57
|
+
setStringValue('');
|
|
58
|
+
}
|
|
59
|
+
}, [value === null || value === void 0 ? void 0 : value.getTime()]);
|
|
60
|
+
// задаем маску и сохраняем обьект маски в ref
|
|
61
|
+
// обнавляем при смене формата
|
|
62
|
+
// задаем нативный oninput, так как с маской по другому не будет работать
|
|
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 })));
|
|
73
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IconComponent, IconPropSize } from '../../../icons/Icon/Icon';
|
|
3
|
+
import { PropsWithHTMLAttributes } from '../../../utils/types/PropsWithHTMLAttributes';
|
|
4
|
+
import { TextFieldPropForm, TextFieldPropSize, TextFieldPropStatus, TextFieldPropView, TextFieldPropWidth } from '../../TextField/TextField';
|
|
5
|
+
import { DatePickerPropOnError } from '../types';
|
|
6
|
+
declare type DatePickerFieldTypeMonthPropOnChange = (props: {
|
|
7
|
+
e: Event;
|
|
8
|
+
value: Date | null;
|
|
9
|
+
}) => void;
|
|
10
|
+
export declare type DatePickerFieldTypeMonthProps = PropsWithHTMLAttributes<{
|
|
11
|
+
className?: string;
|
|
12
|
+
value?: Date | null;
|
|
13
|
+
onChange?: DatePickerFieldTypeMonthPropOnChange;
|
|
14
|
+
onError?: DatePickerPropOnError;
|
|
15
|
+
id?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
size?: TextFieldPropSize;
|
|
19
|
+
view?: TextFieldPropView;
|
|
20
|
+
form?: TextFieldPropForm;
|
|
21
|
+
status?: TextFieldPropStatus;
|
|
22
|
+
width?: TextFieldPropWidth;
|
|
23
|
+
onFocus?: React.FocusEventHandler<HTMLElement>;
|
|
24
|
+
onBlur?: React.FocusEventHandler<HTMLElement>;
|
|
25
|
+
autoFocus?: boolean;
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
leftSide?: string | IconComponent;
|
|
28
|
+
rightSide?: string | IconComponent;
|
|
29
|
+
readOnly?: boolean;
|
|
30
|
+
required?: boolean;
|
|
31
|
+
tabIndex?: number;
|
|
32
|
+
inputRef?: React.Ref<HTMLTextAreaElement | HTMLInputElement>;
|
|
33
|
+
ariaLabel?: string;
|
|
34
|
+
iconSize?: IconPropSize;
|
|
35
|
+
children?: never;
|
|
36
|
+
format?: string;
|
|
37
|
+
separator?: string;
|
|
38
|
+
minDate?: Date;
|
|
39
|
+
maxDate?: Date;
|
|
40
|
+
focused?: boolean;
|
|
41
|
+
label?: string;
|
|
42
|
+
caption?: string;
|
|
43
|
+
labelPosition?: 'top' | 'left';
|
|
44
|
+
}, HTMLDivElement>;
|
|
45
|
+
export declare const useImask: (formatProp: string, separator: string, inputRef: React.RefObject<HTMLInputElement>, stringValue: string | null, onError: DatePickerPropOnError | undefined) => void;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import { format, isValid, parse } from 'date-fns';
|
|
4
|
+
import IMask from 'imask';
|
|
5
|
+
import { datePickerPropFormatTypeMonth, datePickerPropSeparatorDefault, getPartsDate, } from '../helpers';
|
|
6
|
+
import { datePickerErrorTypes } from '../types';
|
|
7
|
+
export var useImask = function (formatProp, separator, inputRef, stringValue, onError) {
|
|
8
|
+
var imaskRef = useRef(null);
|
|
9
|
+
// задаем маску и сохраняем обьект маски в ref
|
|
10
|
+
// обнавляем при смене формата
|
|
11
|
+
useEffect(function () {
|
|
12
|
+
if (inputRef.current) {
|
|
13
|
+
imaskRef.current = IMask(inputRef.current, {
|
|
14
|
+
mask: Date,
|
|
15
|
+
pattern: formatProp,
|
|
16
|
+
blocks: {
|
|
17
|
+
yyyy: {
|
|
18
|
+
mask: IMask.MaskedRange,
|
|
19
|
+
from: 1,
|
|
20
|
+
to: 9999
|
|
21
|
+
},
|
|
22
|
+
MM: {
|
|
23
|
+
mask: IMask.MaskedRange,
|
|
24
|
+
from: 1,
|
|
25
|
+
to: 12
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
lazy: true,
|
|
29
|
+
autofix: true,
|
|
30
|
+
format: function (date) { return format(date, formatProp); },
|
|
31
|
+
parse: function (string) { return parse(string, formatProp, new Date()); },
|
|
32
|
+
validate: function (string) {
|
|
33
|
+
var _a = __read(getPartsDate(string, formatProp, separator, false, ['MM', 'yyyy']), 2), MM = _a[0], yyyy = _a[1];
|
|
34
|
+
if (MM &&
|
|
35
|
+
yyyy &&
|
|
36
|
+
!isValid(parse("" + MM + datePickerPropSeparatorDefault + yyyy, datePickerPropFormatTypeMonth, new Date()))) {
|
|
37
|
+
onError &&
|
|
38
|
+
onError({
|
|
39
|
+
type: datePickerErrorTypes[1],
|
|
40
|
+
stringValue: string,
|
|
41
|
+
MM: MM,
|
|
42
|
+
yyyy: yyyy
|
|
43
|
+
});
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}, [formatProp, separator]);
|
|
51
|
+
// Нужно для синхранизации value c Imask,
|
|
52
|
+
// так как value мы можем задать через пропс без самого ввода,
|
|
53
|
+
// и Imask требует ручной синхронихации в этом случае
|
|
54
|
+
useEffect(function () {
|
|
55
|
+
var _a;
|
|
56
|
+
(_a = imaskRef.current) === null || _a === void 0 ? void 0 : _a.updateValue();
|
|
57
|
+
}, [stringValue]);
|
|
58
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const DatePickerFieldTypeMonthRange: React.ForwardRefExoticComponent<Pick<import("../../../utils/types/PropsWithHTMLAttributes").PropsWithHTMLAttributes<{
|
|
3
|
+
className?: string | undefined;
|
|
4
|
+
value?: Date | null | undefined;
|
|
5
|
+
onChange?: ((props: {
|
|
6
|
+
e: Event;
|
|
7
|
+
value: Date | null;
|
|
8
|
+
}) => void) | undefined;
|
|
9
|
+
onError?: import("../types").DatePickerPropOnError | undefined;
|
|
10
|
+
id?: string | undefined;
|
|
11
|
+
name?: string | undefined;
|
|
12
|
+
disabled?: boolean | undefined;
|
|
13
|
+
size?: "xs" | "s" | "m" | "l" | undefined;
|
|
14
|
+
view?: "default" | "clear" | undefined;
|
|
15
|
+
form?: "default" | "round" | "brick" | "brickRound" | "roundBrick" | "brickDefault" | "defaultBrick" | "clearRound" | "roundClear" | "clearDefault" | "defaultClear" | "brickClear" | "clearBrick" | "clearClear" | undefined;
|
|
16
|
+
status?: "alert" | "success" | "warning" | undefined;
|
|
17
|
+
width?: "default" | "full" | undefined;
|
|
18
|
+
onFocus?: ((event: React.FocusEvent<HTMLElement>) => void) | undefined;
|
|
19
|
+
onBlur?: ((event: React.FocusEvent<HTMLElement>) => void) | undefined;
|
|
20
|
+
autoFocus?: boolean | undefined;
|
|
21
|
+
placeholder?: string | undefined;
|
|
22
|
+
leftSide?: string | React.FC<import("../../../utils/types/PropsWithHTMLAttributes").PropsWithHTMLAttributesAndRef<{
|
|
23
|
+
view?: "link" | "alert" | "brand" | "ghost" | "primary" | "secondary" | "success" | "warning" | "disabled" | undefined;
|
|
24
|
+
size?: "xs" | "s" | "m" | undefined;
|
|
25
|
+
}, HTMLSpanElement>> | undefined;
|
|
26
|
+
rightSide?: string | React.FC<import("../../../utils/types/PropsWithHTMLAttributes").PropsWithHTMLAttributesAndRef<{
|
|
27
|
+
view?: "link" | "alert" | "brand" | "ghost" | "primary" | "secondary" | "success" | "warning" | "disabled" | undefined;
|
|
28
|
+
size?: "xs" | "s" | "m" | undefined;
|
|
29
|
+
}, HTMLSpanElement>> | undefined;
|
|
30
|
+
readOnly?: boolean | undefined;
|
|
31
|
+
required?: boolean | undefined;
|
|
32
|
+
tabIndex?: number | undefined;
|
|
33
|
+
inputRef?: ((instance: HTMLInputElement | HTMLTextAreaElement | null) => void) | React.RefObject<HTMLInputElement | HTMLTextAreaElement> | null | undefined;
|
|
34
|
+
ariaLabel?: string | undefined;
|
|
35
|
+
iconSize?: "xs" | "s" | "m" | undefined;
|
|
36
|
+
children?: undefined;
|
|
37
|
+
format?: string | undefined;
|
|
38
|
+
separator?: string | undefined;
|
|
39
|
+
minDate?: Date | undefined;
|
|
40
|
+
maxDate?: Date | undefined;
|
|
41
|
+
focused?: boolean | undefined;
|
|
42
|
+
label?: string | undefined;
|
|
43
|
+
caption?: string | undefined;
|
|
44
|
+
labelPosition?: "left" | "top" | undefined;
|
|
45
|
+
}, 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" | "iconSize" | "separator" | "minDate" | "maxDate"> & {
|
|
46
|
+
onChange?: ((props: {
|
|
47
|
+
e: Event;
|
|
48
|
+
value: import("../../../utils/types/Date").DateRange | null;
|
|
49
|
+
}) => void) | undefined;
|
|
50
|
+
value?: import("../../../utils/types/Date").DateRange | null | undefined;
|
|
51
|
+
startFieldInputRef?: ((instance: HTMLInputElement | null) => void) | React.RefObject<HTMLInputElement> | null | undefined;
|
|
52
|
+
endFieldInputRef?: ((instance: HTMLInputElement | null) => void) | React.RefObject<HTMLInputElement> | null | undefined;
|
|
53
|
+
startFieldLeftSide?: string | React.FC<import("../../../utils/types/PropsWithHTMLAttributes").PropsWithHTMLAttributesAndRef<{
|
|
54
|
+
view?: "link" | "alert" | "brand" | "ghost" | "primary" | "secondary" | "success" | "warning" | "disabled" | undefined;
|
|
55
|
+
size?: "xs" | "s" | "m" | undefined;
|
|
56
|
+
}, HTMLSpanElement>> | undefined;
|
|
57
|
+
startFieldRightSide?: string | React.FC<import("../../../utils/types/PropsWithHTMLAttributes").PropsWithHTMLAttributesAndRef<{
|
|
58
|
+
view?: "link" | "alert" | "brand" | "ghost" | "primary" | "secondary" | "success" | "warning" | "disabled" | undefined;
|
|
59
|
+
size?: "xs" | "s" | "m" | undefined;
|
|
60
|
+
}, HTMLSpanElement>> | undefined;
|
|
61
|
+
endFieldLeftSide?: string | React.FC<import("../../../utils/types/PropsWithHTMLAttributes").PropsWithHTMLAttributesAndRef<{
|
|
62
|
+
view?: "link" | "alert" | "brand" | "ghost" | "primary" | "secondary" | "success" | "warning" | "disabled" | undefined;
|
|
63
|
+
size?: "xs" | "s" | "m" | undefined;
|
|
64
|
+
}, HTMLSpanElement>> | undefined;
|
|
65
|
+
endFieldRightSide?: string | React.FC<import("../../../utils/types/PropsWithHTMLAttributes").PropsWithHTMLAttributesAndRef<{
|
|
66
|
+
view?: "link" | "alert" | "brand" | "ghost" | "primary" | "secondary" | "success" | "warning" | "disabled" | undefined;
|
|
67
|
+
size?: "xs" | "s" | "m" | undefined;
|
|
68
|
+
}, HTMLSpanElement>> | undefined;
|
|
69
|
+
startFieldRef?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
70
|
+
endFieldRef?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
71
|
+
startFieldOnFocus?: ((event: React.FocusEvent<HTMLElement>) => void) | undefined;
|
|
72
|
+
endFieldOnFocus?: ((event: React.FocusEvent<HTMLElement>) => void) | undefined;
|
|
73
|
+
startFieldOnBlur?: ((event: React.FocusEvent<HTMLElement>) => void) | undefined;
|
|
74
|
+
endFieldOnBlur?: ((event: React.FocusEvent<HTMLElement>) => void) | undefined;
|
|
75
|
+
startFocused?: boolean | undefined;
|
|
76
|
+
endFocused?: boolean | undefined;
|
|
77
|
+
id?: string | undefined;
|
|
78
|
+
onChangeCurrentVisibleDate?: ((date: Date) => void) | undefined;
|
|
79
|
+
currentVisibleDate?: Date | undefined;
|
|
80
|
+
startFieldName?: string | undefined;
|
|
81
|
+
endFieldName?: string | undefined;
|
|
82
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { __assign, __read, __rest } from "tslib";
|
|
2
|
+
import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import isBefore from 'date-fns/isBefore';
|
|
4
|
+
import isEqual from 'date-fns/isEqual';
|
|
5
|
+
import { FieldCaption } from '../../FieldCaption/FieldCaption';
|
|
6
|
+
import { FieldLabel } from '../../FieldLabel/FieldLabel';
|
|
7
|
+
import { DatePickerFieldTypeMonth } from '../DatePickerFieldTypeMonth/DatePickerFieldTypeMonth';
|
|
8
|
+
import { cnDatePickerMixRangeField } from '../DatePickerMixRangeField/DatePickerMixRangeField';
|
|
9
|
+
import { getFormForEnd, getFormForStart } from '../helpers';
|
|
10
|
+
import { datePickerErrorTypes } from '../types';
|
|
11
|
+
export var DatePickerFieldTypeMonthRange = 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"]);
|
|
14
|
+
var commonProps = {
|
|
15
|
+
className: cnDatePickerMixRangeField('Field'),
|
|
16
|
+
disabled: disabled,
|
|
17
|
+
onError: onError,
|
|
18
|
+
size: size,
|
|
19
|
+
view: view,
|
|
20
|
+
status: status,
|
|
21
|
+
autoFocus: autoFocus,
|
|
22
|
+
placeholder: placeholder,
|
|
23
|
+
readOnly: readOnly,
|
|
24
|
+
required: required,
|
|
25
|
+
tabIndex: tabIndex,
|
|
26
|
+
ariaLabel: ariaLabel,
|
|
27
|
+
iconSize: iconSize,
|
|
28
|
+
format: format,
|
|
29
|
+
separator: separator,
|
|
30
|
+
minDate: minDate,
|
|
31
|
+
maxDate: maxDate
|
|
32
|
+
};
|
|
33
|
+
var _e = __read(useState(value === null || value === void 0 ? void 0 : value[0]), 2), startDate = _e[0], setStartDate = _e[1];
|
|
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()]);
|
|
88
|
+
return (React.createElement("div", __assign({}, otherProps, { className: cnDatePickerMixRangeField({ view: view, labelPosition: labelPosition, width: width, size: size }, [className]), ref: ref }),
|
|
89
|
+
label && (React.createElement(FieldLabel, { required: required, className: cnDatePickerMixRangeField('Label', { labelPosition: labelPosition }), size: size }, label)),
|
|
90
|
+
React.createElement("div", { className: cnDatePickerMixRangeField('Body') },
|
|
91
|
+
React.createElement("div", { className: cnDatePickerMixRangeField('Fields') },
|
|
92
|
+
React.createElement(DatePickerFieldTypeMonth, __assign({}, commonProps, { inputRef: startFieldInputRef, ref: startFieldRef, leftSide: startFieldLeftSide, rightSide: startFieldRightSide, form: getFormForStart(form), value: startDate, onChange: handleStartDateChange, onFocus: startFieldOnFocus, onBlur: startFieldOnBlur, focused: startFocused, name: startFieldName })),
|
|
93
|
+
React.createElement(DatePickerFieldTypeMonth, __assign({}, commonProps, { name: endFieldName, inputRef: endFieldInputRef, ref: endFieldRef, leftSide: endFieldLeftSide, rightSide: endFieldRightSide, form: getFormForEnd(form), value: endDate, onChange: handleEndDateChange, onFocus: endFieldOnFocus, onBlur: endFieldOnBlur, focused: endFocused }))),
|
|
94
|
+
caption && (React.createElement(FieldCaption, { className: cnDatePickerMixRangeField('Caption'), status: status }, caption)))));
|
|
95
|
+
});
|
package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeMonthRange/helpers.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IconComponent } from '../../../icons/Icon/Icon';
|
|
3
|
+
import { DateRange } from '../../../utils/types/Date';
|
|
4
|
+
import { DatePickerFieldTypeYearProps } from '../DatePickerFieldTypeYear/helpers';
|
|
5
|
+
declare type DatePickerFieldTypeMonthRangePropOnChange = (props: {
|
|
6
|
+
e: Event;
|
|
7
|
+
value: DateRange | null;
|
|
8
|
+
}) => void;
|
|
9
|
+
export declare type DatePickerFieldTypeMonthRangeProps = Omit<DatePickerFieldTypeYearProps, 'onChange' | 'value' | 'inputRef' | 'leftSide' | 'rightSide' | 'id' | 'onFocus' | 'onBlur' | 'name'> & {
|
|
10
|
+
onChange?: DatePickerFieldTypeMonthRangePropOnChange;
|
|
11
|
+
value?: DateRange | null;
|
|
12
|
+
startFieldInputRef?: React.Ref<HTMLInputElement>;
|
|
13
|
+
endFieldInputRef?: React.Ref<HTMLInputElement>;
|
|
14
|
+
startFieldLeftSide?: string | IconComponent;
|
|
15
|
+
startFieldRightSide?: string | IconComponent;
|
|
16
|
+
endFieldLeftSide?: string | IconComponent;
|
|
17
|
+
endFieldRightSide?: string | IconComponent;
|
|
18
|
+
startFieldRef?: React.Ref<HTMLDivElement>;
|
|
19
|
+
endFieldRef?: React.Ref<HTMLDivElement>;
|
|
20
|
+
startFieldOnFocus?: React.FocusEventHandler<HTMLElement>;
|
|
21
|
+
endFieldOnFocus?: React.FocusEventHandler<HTMLElement>;
|
|
22
|
+
startFieldOnBlur?: React.FocusEventHandler<HTMLElement>;
|
|
23
|
+
endFieldOnBlur?: React.FocusEventHandler<HTMLElement>;
|
|
24
|
+
startFocused?: boolean;
|
|
25
|
+
endFocused?: boolean;
|
|
26
|
+
id?: string;
|
|
27
|
+
onChangeCurrentVisibleDate?: (date: Date) => void;
|
|
28
|
+
currentVisibleDate?: Date;
|
|
29
|
+
startFieldName?: string;
|
|
30
|
+
endFieldName?: string;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
|
File without changes
|
|
@@ -10,7 +10,7 @@ import { getFieldName, normalizeRangeValue } from '../helpers';
|
|
|
10
10
|
import { useCurrentVisibleDate } from '../useCurrentVisibleDate';
|
|
11
11
|
export var DatePickerTypeDateTimeRange = forwardRef(function (props, ref) {
|
|
12
12
|
var _a, _b, _c, _d;
|
|
13
|
-
var events = props.events, dateTimeView = props.dateTimeView, locale = props.locale, dropdownForm = props.dropdownForm, onFocus = props.onFocus, onBlur = props.onBlur, leftSide = props.leftSide, rightSide = props.rightSide, style = props.style, currentVisibleDateProp = props.currentVisibleDate, onChangeCurrentVisibleDateProp = props.onChangeCurrentVisibleDate, renderAdditionalControls = props.renderAdditionalControls, inputRef = props.inputRef, name = props.name, fieldProps = __rest(props, ["events", "dateTimeView", "locale", "dropdownForm", "onFocus", "onBlur", "leftSide", "rightSide", "style", "currentVisibleDate", "onChangeCurrentVisibleDate", "renderAdditionalControls", "inputRef", "name"]);
|
|
13
|
+
var events = props.events, dateTimeView = props.dateTimeView, locale = props.locale, dropdownForm = props.dropdownForm, onFocus = props.onFocus, onBlur = props.onBlur, leftSide = props.leftSide, rightSide = props.rightSide, style = props.style, currentVisibleDateProp = props.currentVisibleDate, onChangeCurrentVisibleDateProp = props.onChangeCurrentVisibleDate, renderAdditionalControls = props.renderAdditionalControls, inputRef = props.inputRef, name = props.name, multiplicityMinutes = props.multiplicityMinutes, multiplicitySeconds = props.multiplicitySeconds, multiplicityHours = props.multiplicityHours, fieldProps = __rest(props, ["events", "dateTimeView", "locale", "dropdownForm", "onFocus", "onBlur", "leftSide", "rightSide", "style", "currentVisibleDate", "onChangeCurrentVisibleDate", "renderAdditionalControls", "inputRef", "name", "multiplicityMinutes", "multiplicitySeconds", "multiplicityHours"]);
|
|
14
14
|
var startFieldRef = useRef(null);
|
|
15
15
|
var endFieldRef = useRef(null);
|
|
16
16
|
var startFieldInputRef = useRef(null);
|
|
@@ -82,5 +82,5 @@ export var DatePickerTypeDateTimeRange = forwardRef(function (props, ref) {
|
|
|
82
82
|
});
|
|
83
83
|
return (React.createElement(React.Fragment, null,
|
|
84
84
|
React.createElement(DatePickerFieldTypeDateTimeRange, __assign({}, fieldProps, { style: style, ref: ref, startFieldRef: startFieldRef, endFieldRef: endFieldRef, startFieldInputRef: useForkRef([startFieldInputRef, inputRef === null || inputRef === void 0 ? void 0 : inputRef[0]]), endFieldInputRef: useForkRef([endFieldInputRef, inputRef === null || inputRef === void 0 ? void 0 : inputRef[1]]), startFieldOnFocus: startFieldOnFocusHandler, endFieldOnFocus: endFieldOnFocusHandler, startFieldLeftSide: Array.isArray(leftSide) ? leftSide === null || leftSide === void 0 ? void 0 : leftSide[0] : leftSide, startFieldRightSide: Array.isArray(rightSide) ? rightSide === null || rightSide === void 0 ? void 0 : rightSide[0] : undefined, endFieldLeftSide: Array.isArray(leftSide) ? leftSide === null || leftSide === void 0 ? void 0 : leftSide[1] : undefined, endFieldRightSide: Array.isArray(rightSide) ? rightSide === null || rightSide === void 0 ? void 0 : rightSide[1] : rightSide, startFieldOnBlur: startFieldOnBlurHandler, endFieldOnBlur: endFieldOnBlurHandler, startFocused: startFocused, endFocused: endFocused, startFieldName: getFieldName(name, 0), endFieldName: getFieldName(name, 1) })),
|
|
85
|
-
React.createElement(DatePickerDropdown, { type: "date-time", ref: calendarRef, anchorRef: startFieldRef, isOpen: calendarVisible, onChangeCurrentVisibleDate: setCurrentVisibleDate, currentVisibleDate: currentVisibleDate, value: props.value || undefined, timeFor: fieldFocused || undefined, view: dateTimeView, events: events, locale: locale, minDate: props.minDate, maxDate: props.maxDate, form: dropdownForm, onChange: hadleChange, renderAdditionalControls: renderAdditionalControls, zIndex: typeof (style === null || style === void 0 ? void 0 : style.zIndex) === 'number' ? style.zIndex + 1 : undefined })));
|
|
85
|
+
React.createElement(DatePickerDropdown, { type: "date-time", ref: calendarRef, anchorRef: startFieldRef, isOpen: calendarVisible, onChangeCurrentVisibleDate: setCurrentVisibleDate, currentVisibleDate: currentVisibleDate, value: props.value || undefined, timeFor: fieldFocused || undefined, view: dateTimeView, events: events, locale: locale, minDate: props.minDate, maxDate: props.maxDate, form: dropdownForm, onChange: hadleChange, renderAdditionalControls: renderAdditionalControls, multiplicityMinutes: multiplicityMinutes, multiplicitySeconds: multiplicitySeconds, multiplicityHours: multiplicityHours, zIndex: typeof (style === null || style === void 0 ? void 0 : style.zIndex) === 'number' ? style.zIndex + 1 : undefined })));
|
|
86
86
|
});
|