@moysklad/uikit 30.4.0 → 31.20.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/README.md +9 -4
- package/dist/colorVariables.css +23 -1
- package/dist/components/AutoComplete/AutoComplete.js +2 -2
- package/dist/components/BentoBlock/BentoBlock.d.ts +15 -0
- package/dist/components/BentoBlock/BentoBlock.js +20 -0
- package/dist/components/BentoBlock/BentoBlock.module.js +9 -0
- package/dist/components/BentoBlock/BentoBlock_module.css +50 -0
- package/dist/components/BentoBlock/consts.d.ts +14 -0
- package/dist/components/BentoBlock/consts.js +15 -0
- package/dist/components/Button/Button.d.ts +5 -2
- package/dist/components/Button/Button.js +28 -19
- package/dist/components/Button/Button_module.css +16 -14
- package/dist/components/Checkbox/Checkbox.js +1 -1
- package/dist/components/DateRange/ArrowButton/ArrowButton.module.js +6 -0
- package/dist/components/DateRange/ArrowButton/ArrowButton_module.css +26 -0
- package/dist/components/DateRange/ArrowButton/index.d.ts +8 -0
- package/dist/components/DateRange/ArrowButton/index.js +23 -0
- package/dist/components/DateRange/Calendar/index.d.ts +12 -0
- package/dist/components/DateRange/Calendar/index.js +22 -0
- package/dist/components/DateRange/DateRange.d.ts +6 -0
- package/dist/components/DateRange/DateRange.js +51 -0
- package/dist/components/DateRange/DateRangeDefaultTrigger/DateRangeDefaultTrigger.d.ts +44 -0
- package/dist/components/DateRange/DateRangeDefaultTrigger/DateRangeDefaultTrigger.js +128 -0
- package/dist/components/DateRange/DateRangeDefaultTrigger/DateRangeDefaultTrigger.module.js +19 -0
- package/dist/components/DateRange/DateRangeDefaultTrigger/DateRangeDefaultTrigger_module.css +170 -0
- package/dist/components/DateRange/DateRangeDefaultTrigger.module.js +12 -0
- package/dist/components/DateRange/DateRangeDefaultTrigger_module.css +43 -0
- package/dist/components/DateRange/DateRangeInput/DateRangeInput.d.ts +4 -0
- package/dist/components/DateRange/DateRangeInput/DateRangeInput.js +69 -0
- package/dist/components/DateRange/Day/Day.module.js +16 -0
- package/dist/components/DateRange/Day/Day_module.css +80 -0
- package/dist/components/DateRange/Day/index.d.ts +12 -0
- package/dist/components/DateRange/Day/index.js +39 -0
- package/dist/components/DateRange/DropdownContent/DropdownContent.module.js +10 -0
- package/dist/components/DateRange/DropdownContent/DropdownContent_module.css +34 -0
- package/dist/components/DateRange/DropdownContent/index.d.ts +24 -0
- package/dist/components/DateRange/DropdownContent/index.js +132 -0
- package/dist/components/DateRange/InputContent/InputContent.module.js +9 -0
- package/dist/components/DateRange/InputContent/InputContent_module.css +31 -0
- package/dist/components/DateRange/InputContent/index.d.ts +12 -0
- package/dist/components/DateRange/InputContent/index.js +59 -0
- package/dist/components/DateRange/Month/Month.module.js +7 -0
- package/dist/components/DateRange/Month/Month_module.css +17 -0
- package/dist/components/DateRange/Month/index.d.ts +15 -0
- package/dist/components/DateRange/Month/index.js +158 -0
- package/dist/components/DateRange/Month/utils.d.ts +2 -0
- package/dist/components/DateRange/Month/utils.js +8 -0
- package/dist/components/DateRange/MonthHeader/MonthHeader.module.js +5 -0
- package/dist/components/DateRange/MonthHeader/MonthHeader_module.css +10 -0
- package/dist/components/DateRange/MonthHeader/index.d.ts +5 -0
- package/dist/components/DateRange/MonthHeader/index.js +26 -0
- package/dist/components/DateRange/MonthList/MonthList.module.js +7 -0
- package/dist/components/DateRange/MonthList/MonthList_module.css +25 -0
- package/dist/components/DateRange/MonthList/index.d.ts +11 -0
- package/dist/components/DateRange/MonthList/index.js +91 -0
- package/dist/components/DateRange/PeriodVariantList/PeriodVariantList.module.js +9 -0
- package/dist/components/DateRange/PeriodVariantList/PeriodVariantList_module.css +18 -0
- package/dist/components/DateRange/PeriodVariantList/index.d.ts +18 -0
- package/dist/components/DateRange/PeriodVariantList/index.js +83 -0
- package/dist/components/DateRange/SideMenu/SideMenu.module.js +6 -0
- package/dist/components/DateRange/SideMenu/SideMenu_module.css +18 -0
- package/dist/components/DateRange/SideMenu/index.d.ts +13 -0
- package/dist/components/DateRange/SideMenu/index.js +73 -0
- package/dist/components/DateRange/TooltipedText/index.d.ts +8 -0
- package/dist/components/DateRange/TooltipedText/index.js +30 -0
- package/dist/components/DateRange/Year/Year.module.js +11 -0
- package/dist/components/DateRange/Year/Year_module.css +60 -0
- package/dist/components/DateRange/Year/index.d.ts +8 -0
- package/dist/components/DateRange/Year/index.js +47 -0
- package/dist/components/DateRange/YearsList/YearsList.module.js +5 -0
- package/dist/components/DateRange/YearsList/YearsList_module.css +15 -0
- package/dist/components/DateRange/YearsList/index.d.ts +12 -0
- package/dist/components/DateRange/YearsList/index.js +47 -0
- package/dist/components/DateRange/consts.d.ts +20 -0
- package/dist/components/DateRange/consts.js +81 -0
- package/dist/components/DateRange/formatDateRangeValue.d.ts +24 -0
- package/dist/components/DateRange/formatDateRangeValue.js +116 -0
- package/dist/components/DateRange/hooks/useCalendar.d.ts +13 -0
- package/dist/components/DateRange/hooks/useCalendar.js +88 -0
- package/dist/components/DateRange/hooks/useDateRange.d.ts +392 -0
- package/dist/components/DateRange/hooks/useDateRange.js +36 -0
- package/dist/components/DateRange/hooks/useDateRangeDropdown.d.ts +47 -0
- package/dist/components/DateRange/hooks/useDateRangeDropdown.js +117 -0
- package/dist/components/DateRange/hooks/useDateRangeValue.d.ts +56 -0
- package/dist/components/DateRange/hooks/useDateRangeValue.js +173 -0
- package/dist/components/DateRange/hooks/useMaskInput.d.ts +18 -0
- package/dist/components/DateRange/hooks/useMaskInput.js +169 -0
- package/dist/components/DateRange/hooks/useMonthList.d.ts +12 -0
- package/dist/components/DateRange/hooks/useMonthList.js +80 -0
- package/dist/components/DateRange/hooks/useSideMenu.d.ts +14 -0
- package/dist/components/DateRange/hooks/useSideMenu.js +113 -0
- package/dist/components/DateRange/index.d.ts +1 -0
- package/dist/components/DateRange/index.js +1 -0
- package/dist/components/DateRange/locale/en-US.d.ts +2 -0
- package/dist/components/DateRange/locale/en-US.js +82 -0
- package/dist/components/DateRange/locale/index.d.ts +4 -0
- package/dist/components/DateRange/locale/index.js +3 -0
- package/dist/components/DateRange/locale/ru-RU.d.ts +2 -0
- package/dist/components/DateRange/locale/ru-RU.js +82 -0
- package/dist/components/DateRange/locale/types.d.ts +9 -0
- package/dist/components/DateRange/locale/types.js +7 -0
- package/dist/components/DateRange/locale/useLocale.d.ts +8 -0
- package/dist/components/DateRange/locale/useLocale.js +31 -0
- package/dist/components/DateRange/props.d.ts +39 -0
- package/dist/components/DateRange/props.js +0 -0
- package/dist/components/DateRange/types.d.ts +126 -0
- package/dist/components/DateRange/types.js +13 -0
- package/dist/components/DateRange/utils.d.ts +33 -0
- package/dist/components/DateRange/utils.js +105 -0
- package/dist/components/Datepicker/Datepicker.d.ts +3 -1
- package/dist/components/Datepicker/Datepicker.js +4 -2
- package/dist/components/EditableDate/DropdownContent/DropdownContent.d.ts +9 -0
- package/dist/components/EditableDate/DropdownContent/DropdownContent.js +36 -0
- package/dist/components/EditableDate/EditableDate.d.ts +9 -0
- package/dist/components/EditableDate/EditableDate.js +142 -0
- package/dist/components/EditableDate/EditableDate.module.js +7 -0
- package/dist/components/EditableDate/EditableDate_module.css +32 -0
- package/dist/components/EditableTitle/EditableTitle.d.ts +7 -2
- package/dist/components/EditableTitle/EditableTitle.js +63 -31
- package/dist/components/EditableTitle/EditableTitle.module.js +1 -0
- package/dist/components/EditableTitle/EditableTitle_module.css +6 -0
- package/dist/components/EmptyState/EmptyState.d.ts +1 -1
- package/dist/components/EmptyStateLarge/EmptyStateLarge_module.css +2 -2
- package/dist/components/Help/Help_module.css +1 -1
- package/dist/components/Informer/Informer.d.ts +37 -0
- package/dist/components/Informer/Informer.js +36 -0
- package/dist/components/Informer/Informer.module.js +7 -0
- package/dist/components/Informer/Informer_module.css +24 -0
- package/dist/components/Input/Input.js +10 -5
- package/dist/components/Input/components/InfoBlock.d.ts +3 -1
- package/dist/components/Input/components/InfoBlock.js +7 -4
- package/dist/components/InputUnit/InputUnit.js +4 -4
- package/dist/components/LabelValue/LabelValue.d.ts +14 -10
- package/dist/components/LabelValue/LabelValue.js +46 -25
- package/dist/components/LabelValue/LabelValue.module.js +10 -4
- package/dist/components/LabelValue/LabelValue_module.css +53 -19
- package/dist/components/LabelValue/ValueBlock/ValueBlock.d.ts +2 -0
- package/dist/components/LabelValue/ValueBlock/ValueBlock.js +82 -0
- package/dist/components/LabelValue/ValueBlockWrapper.d.ts +5 -0
- package/dist/components/LabelValue/ValueBlockWrapper.js +13 -0
- package/dist/components/LabelValue/ValueIcon.d.ts +4 -0
- package/dist/components/LabelValue/ValueIcon.js +9 -0
- package/dist/components/LabelValue/ValueText.d.ts +10 -0
- package/dist/components/LabelValue/ValueText.js +24 -0
- package/dist/components/LabelValue/ValueTextWithHint.d.ts +12 -0
- package/dist/components/LabelValue/ValueTextWithHint.js +29 -0
- package/dist/components/LabelValue/hooks/useValueBlock.d.ts +29 -0
- package/dist/components/LabelValue/hooks/useValueBlock.js +72 -0
- package/dist/components/LabelValue/{ValueBlock/index.d.ts → types.d.ts} +8 -4
- package/dist/components/LabelValue/types.js +0 -0
- package/dist/components/LabelValueDate/LabelValueDate.js +2 -2
- package/dist/components/LabelValueFile/DeleteButton/DeleteButton.d.ts +9 -0
- package/dist/components/LabelValueFile/DeleteButton/DeleteButton.js +17 -0
- package/dist/components/LabelValueFile/FilePreviewIcon/FilePreviewIcon.d.ts +7 -0
- package/dist/components/LabelValueFile/FilePreviewIcon/FilePreviewIcon.js +15 -0
- package/dist/components/LabelValueFile/FilePreviewIcon/FilePreviewIcon.module.js +6 -0
- package/dist/components/LabelValueFile/FilePreviewIcon/FilePreviewIcon_module.css +10 -0
- package/dist/components/LabelValueFile/ImagePreview/ImagePreview.d.ts +8 -0
- package/dist/components/LabelValueFile/ImagePreview/ImagePreview.js +53 -0
- package/dist/components/LabelValueFile/ImagePreview/ImagePreview.module.js +6 -0
- package/dist/components/LabelValueFile/ImagePreview/ImagePreview_module.css +13 -0
- package/dist/components/LabelValueFile/LabelValueFile.d.ts +7 -0
- package/dist/components/LabelValueFile/LabelValueFile.js +42 -0
- package/dist/components/LabelValueFile/LabelValueFile.module.js +12 -0
- package/dist/components/LabelValueFile/LabelValueFile_module.css +57 -0
- package/dist/components/LabelValueFile/ValueBlock/ValueBlock.d.ts +15 -0
- package/dist/components/LabelValueFile/ValueBlock/ValueBlock.js +130 -0
- package/dist/components/LabelValueFile/ValueBlock/ValueBlock.module.js +7 -0
- package/dist/components/LabelValueFile/ValueBlock/ValueBlock_module.css +17 -0
- package/dist/components/LabelValueInput/DropdownConnent/DropdownContent.d.ts +2 -0
- package/dist/components/LabelValueInput/DropdownConnent/DropdownContent.js +2 -0
- package/dist/components/LabelValueLink/LabelValueLink.d.ts +2 -0
- package/dist/components/LabelValueLink/LabelValueLink.js +76 -0
- package/dist/components/LabelValueLink/LabelValueLink.module.js +6 -0
- package/dist/components/LabelValueLink/LabelValueLink_module.css +11 -0
- package/dist/components/LabelValueLink/ValueBlock/LabelValueLinkValueBlock.d.ts +2 -0
- package/dist/components/LabelValueLink/ValueBlock/LabelValueLinkValueBlock.js +117 -0
- package/dist/components/LabelValueLink/ValueBlock/LabelValueLinkValueBlock.module.js +6 -0
- package/dist/components/LabelValueLink/ValueBlock/LabelValueLinkValueBlock_module.css +8 -0
- package/dist/components/LabelValueLink/normalizeLinkValue.d.ts +1 -0
- package/dist/components/LabelValueLink/normalizeLinkValue.js +10 -0
- package/dist/components/LabelValueLink/useLinkDropdownValue.d.ts +15 -0
- package/dist/components/LabelValueLink/useLinkDropdownValue.js +26 -0
- package/dist/components/LabelValueSelect/Input/index.js +1 -1
- package/dist/components/LabelValueSelect/LabelValueSelect.d.ts +4 -2
- package/dist/components/Layout/Layout.d.ts +13 -0
- package/dist/components/Layout/Layout.js +41 -0
- package/dist/components/Layout/Layout.module.js +15 -0
- package/dist/components/Layout/Layout_module.css +77 -0
- package/dist/components/Link/Link.d.ts +5 -6
- package/dist/components/Link/Link.js +35 -9
- package/dist/components/Link/Link.module.js +1 -0
- package/dist/components/Link/Link_module.css +9 -0
- package/dist/components/MentionsTextfield/Mentions/style.css +2 -6
- package/dist/components/MentionsTextfield/MentionsTextfield.js +2 -1
- package/dist/components/Multiselect/AllSelectedChip/AllSelectedChip.d.ts +8 -0
- package/dist/components/Multiselect/AllSelectedChip/AllSelectedChip.js +13 -0
- package/dist/components/Multiselect/AllSelectedChip/AllSelectedChip.module.js +5 -0
- package/dist/components/Multiselect/AllSelectedChip/AllSelectedChip_module.css +9 -0
- package/dist/components/Multiselect/DropdownContent/MultiselectDropdownContent.d.ts +12 -1
- package/dist/components/Multiselect/DropdownContent/MultiselectDropdownContent.js +20 -15
- package/dist/components/Multiselect/Input/Input.d.ts +6 -2
- package/dist/components/Multiselect/Input/Input.js +18 -4
- package/dist/components/Multiselect/Multiselect.d.ts +4 -2
- package/dist/components/Multiselect/Multiselect.js +14 -2
- package/dist/components/Multiselect/ShortDropdownContent/ShortDropdownContent.js +2 -1
- package/dist/components/Multiselect/TextField/MultiselectTextField.d.ts +5 -1
- package/dist/components/Multiselect/TextField/MultiselectTextField.js +15 -2
- package/dist/components/Multiselect/lib/consts.d.ts +1 -1
- package/dist/components/Multiselect/lib/consts.js +1 -1
- package/dist/components/Multiselect/lib/helpers.d.ts +24 -0
- package/dist/components/Multiselect/lib/helpers.js +15 -0
- package/dist/components/Multiselect/types.d.ts +2 -0
- package/dist/components/Panel/Panel.d.ts +34 -0
- package/dist/components/Panel/Panel.js +39 -0
- package/dist/components/Panel/Panel.module.js +6 -0
- package/dist/components/Panel/Panel_module.css +17 -0
- package/dist/components/Radiobutton/Radiobutton.js +1 -1
- package/dist/components/Radiobutton/Radiobutton_module.css +5 -0
- package/dist/components/SearchInput/SearchInput_module.css +1 -1
- package/dist/components/Select/ArchivedInputValue/ArchivedInputValue.d.ts +3 -4
- package/dist/components/Select/ArchivedInputValue/ArchivedInputValue.js +19 -24
- package/dist/components/Select/ArchivedInputValue/ArchivedInputValue.module.js +1 -2
- package/dist/components/Select/ArchivedInputValue/ArchivedInputValue_module.css +5 -12
- package/dist/components/Select/Combobox/Combobox.d.ts +3 -1
- package/dist/components/Select/Combobox/Combobox.js +19 -8
- package/dist/components/Select/Combobox/Combobox.module.js +4 -3
- package/dist/components/Select/Combobox/Combobox_module.css +15 -9
- package/dist/components/Select/OptionsList/OptionsList.d.ts +3 -1
- package/dist/components/Select/OptionsList/OptionsList.js +37 -21
- package/dist/components/Select/OptionsList/OptionsList.module.js +2 -0
- package/dist/components/Select/OptionsList/OptionsList_module.css +15 -0
- package/dist/components/Select/Select.d.ts +2 -3
- package/dist/components/Select/Select.js +17 -7
- package/dist/components/Select/Select_module.css +5 -0
- package/dist/components/Select/ShortVariant/ShortVariant.js +1 -1
- package/dist/components/StatusBadge/StatusBadge.d.ts +28 -0
- package/dist/components/StatusBadge/StatusBadge.js +167 -0
- package/dist/components/StatusBadge/StatusBadge.module.js +37 -0
- package/dist/components/StatusBadge/StatusBadge_module.css +149 -0
- package/dist/components/StatusBadge/utils/StatusBadgeColor.d.ts +21 -0
- package/dist/components/StatusBadge/utils/StatusBadgeColor.js +20 -0
- package/dist/components/StatusBadge/utils/getStatusBadgeColor.d.ts +2 -0
- package/dist/components/StatusBadge/utils/getStatusBadgeColor.js +8 -0
- package/dist/components/Textfield/Textfield.d.ts +7 -2
- package/dist/components/Textfield/Textfield.js +2 -1
- package/dist/components/Textfield/components/Container/Container.d.ts +2 -0
- package/dist/components/Textfield/components/Container/Container.js +17 -6
- package/dist/components/Textfield/components/Container/Container.module.js +2 -1
- package/dist/components/Textfield/components/Container/Container_module.css +4 -0
- package/dist/components/Toggle/Toggle.js +1 -1
- package/dist/components/ViewersStack/ViewersStack.js +5 -3
- package/dist/components/_shared/CustomDatepickerDropdownContent/CustomDatepickerDropdownContent.d.ts +12 -0
- package/dist/components/{LabelValueDate/DropdownContent/index.js → _shared/CustomDatepickerDropdownContent/CustomDatepickerDropdownContent.js} +10 -10
- package/dist/components/_shared/CustomDatepickerDropdownContent/CustomDatepickerDropdownContent.module.js +9 -0
- package/dist/components/{LabelValueDate/DropdownContent/DropdownContent_module.css → _shared/CustomDatepickerDropdownContent/CustomDatepickerDropdownContent_module.css} +6 -6
- package/dist/components/_shared/FieldLabel/FieldLabel.d.ts +18 -0
- package/dist/components/{FieldLabel → _shared/FieldLabel}/FieldLabel.js +19 -12
- package/dist/components/_shared/FieldLabel/FieldLabel.module.js +11 -0
- package/dist/components/{FieldLabel → _shared/FieldLabel}/FieldLabel_module.css +8 -8
- package/dist/components/{FieldLabel → _shared/FieldLabel}/components/HelpButton.d.ts +1 -1
- package/dist/components/{FieldLabel → _shared/FieldLabel}/components/HelpButton.js +2 -2
- package/dist/components/{FieldLabel → _shared/FieldLabel}/components/HelpButton.module.js +1 -1
- package/dist/components/{FieldLabel → _shared/FieldLabel}/components/HelpButton_module.css +1 -1
- package/dist/components/{FieldRow → _shared/FieldRow}/FieldRow.d.ts +1 -1
- package/dist/components/{FieldRow → _shared/FieldRow}/FieldRow.js +1 -1
- package/dist/components/{FieldRow → _shared/FieldRow}/FieldRow.module.js +3 -3
- package/dist/components/{FieldRow → _shared/FieldRow}/FieldRow_module.css +3 -3
- package/dist/components/{Info → _shared/Info}/Info.d.ts +3 -1
- package/dist/components/{Info → _shared/Info}/Info.js +9 -6
- package/dist/components/_shared/Info/Info.module.js +9 -0
- package/dist/components/{Info → _shared/Info}/Info_module.css +6 -6
- package/dist/components/_shared/Info/types/index.d.ts +6 -0
- package/dist/components/_shared/Info/types/index.js +5 -0
- package/dist/components/{InputClear → _shared/InputClear}/InputClear.d.ts +1 -1
- package/dist/components/{InputClear → _shared/InputClear}/InputClear.js +2 -2
- package/dist/components/{InputClear → _shared/InputClear}/InputClear.module.js +3 -3
- package/dist/components/{InputClear → _shared/InputClear}/InputClear_module.css +5 -5
- package/dist/components/_shared/utils/polymorphicClickableTypes.d.ts +17 -0
- package/dist/components/_shared/utils/polymorphicClickableTypes.js +7 -0
- package/dist/data-grid/Filters/DateRangeFilter/DropdownContent/index.js +3 -3
- package/dist/data-grid/Filters/DateRangeFilter/InputContent/index.js +29 -26
- package/dist/data-grid/Filters/DateRangeFilter/PeriodVariantList/index.js +5 -3
- package/dist/data-grid/Filters/DateRangeFilter/Year/index.js +3 -3
- package/dist/data-grid/Filters/DateRangeFilter/consts.js +6 -6
- package/dist/data-grid/Filters/DateRangeFilter/hooks/useMaskInput.js +6 -6
- package/dist/data-grid/Filters/DateRangeFilter/hooks/useSideMenu.js +1 -4
- package/dist/data-grid/Filters/DateRangeFilter/types.d.ts +68 -56
- package/dist/data-grid/Filters/FiltersContainer/FiltersContainer.js +2 -1
- package/dist/data-grid/Filters/FiltersContainer/utils/useRenderParams.d.ts +1 -0
- package/dist/data-grid/Filters/FiltersContainer/utils/useRenderParams.js +14 -6
- package/dist/data-grid/Filters/MultiselectFilter/MultiselectFilter.js +2 -2
- package/dist/data-grid/Filters/OutlineInput/OutlineInput.js +2 -2
- package/dist/data-grid/Filters/OutlineInput/OutlineInput_module.css +1 -1
- package/dist/data-grid/Table/Table_module.css +0 -1
- package/dist/data-grid/cells/ImageCell/ImageMiniature/ImageMiniature_module.css +1 -1
- package/dist/data-grid/cells/components/TableNumberInput/TableNumberInput.d.ts +1 -0
- package/dist/data-grid/cells/components/TableNumberInput/TableNumberInput.js +17 -5
- package/dist/data-grid/cells/components/TableSelect/TableSelect.js +3 -2
- package/dist/data-grid/headers/components/Dropdown/Dropdown.d.ts +3 -0
- package/dist/data-grid/headers/components/HeaderBuilder/HeaderBuilder.js +1 -0
- package/dist/data-grid/index.d.ts +0 -4
- package/dist/data-grid/locale/en-US.js +68 -56
- package/dist/data-grid/locale/ru-RU.js +68 -56
- package/dist/data-grid/locale/useLocale.d.ts +6 -1
- package/dist/data-grid/locale/useLocale.js +14 -5
- package/dist/hooks/useIsElementOverflowing/index.d.ts +1 -0
- package/dist/hooks/useIsElementOverflowing/index.js +8 -2
- package/dist/hooks/useOverflowHint/index.d.ts +7 -0
- package/dist/hooks/useOverflowHint/index.js +16 -0
- package/dist/hooks/useTextField/useTextField.d.ts +1 -1
- package/dist/icon/components/MsLogo12Icon.d.ts +8 -0
- package/dist/icon/components/MsLogo12Icon.js +28 -0
- package/dist/icon/components/MsLogo16Icon.d.ts +8 -0
- package/dist/icon/components/MsLogo16Icon.js +26 -0
- package/dist/icon/components/MsLogo20Icon.d.ts +8 -0
- package/dist/icon/components/MsLogo20Icon.js +28 -0
- package/dist/icon/components/Phone12Icon.d.ts +8 -0
- package/dist/icon/components/Phone12Icon.js +18 -0
- package/dist/icon/components/Phone16Icon.d.ts +8 -0
- package/dist/icon/components/Phone16Icon.js +17 -0
- package/dist/icon/components/Phone20Icon.d.ts +8 -0
- package/dist/icon/components/Phone20Icon.js +18 -0
- package/dist/icon/index.d.ts +6 -0
- package/dist/icon/index.js +6 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +8 -0
- package/dist/utils/checkIsArchivedValue.d.ts +2 -0
- package/dist/utils/checkIsArchivedValue.js +5 -0
- package/dist/utils/utils.d.ts +1 -0
- package/dist/utils/utils.js +1 -0
- package/package.json +70 -13
- package/dist/components/FieldLabel/FieldLabel.d.ts +0 -17
- package/dist/components/FieldLabel/FieldLabel.module.js +0 -11
- package/dist/components/Info/Info.module.js +0 -9
- package/dist/components/LabelValue/ValueBlock/index.js +0 -138
- package/dist/components/LabelValue/hooks/useTooltip.d.ts +0 -8
- package/dist/components/LabelValue/hooks/useTooltip.js +0 -16
- package/dist/components/LabelValueDate/DropdownContent/DropdownContent.module.js +0 -9
- package/dist/components/LabelValueDate/DropdownContent/index.d.ts +0 -12
- package/dist/components/MentionsTextfield/OptionForStory/OptionForStory.d.ts +0 -7
- package/dist/components/MentionsTextfield/OptionForStory/OptionForStory.js +0 -27
- package/dist/components/MentionsTextfield/OptionForStory/OptionForStory.module.js +0 -8
- package/dist/components/MentionsTextfield/OptionForStory/OptionForStory_module.css +0 -25
- package/dist/components/MentionsTextfield/OptionForStory/index.d.ts +0 -1
- package/dist/components/MentionsTextfield/OptionForStory/index.js +0 -1
- package/dist/components/Textfield/components/Label/Label.d.ts +0 -11
- package/dist/components/Textfield/components/Label/Label.js +0 -38
- package/dist/components/Textfield/components/Label/Label.module.js +0 -7
- package/dist/components/Textfield/components/Label/Label_module.css +0 -17
- package/dist/components/Textfield/components/Label/index.d.ts +0 -1
- package/dist/components/Textfield/components/Label/index.js +0 -1
- /package/dist/components/{FieldLabel → _shared/FieldLabel}/FieldLabel.constants.d.ts +0 -0
- /package/dist/components/{FieldLabel → _shared/FieldLabel}/FieldLabel.constants.js +0 -0
- /package/dist/components/{FieldLabel → _shared/FieldLabel}/components/index.d.ts +0 -0
- /package/dist/components/{FieldLabel → _shared/FieldLabel}/components/index.js +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
const ruLocaleValues = {
|
|
2
|
+
DateRange: {
|
|
3
|
+
translate: {
|
|
4
|
+
radiobuttons: {
|
|
5
|
+
period: 'Период',
|
|
6
|
+
day: 'День',
|
|
7
|
+
week: 'Неделя',
|
|
8
|
+
month: 'Месяц',
|
|
9
|
+
anyDate: 'Указана любая дата',
|
|
10
|
+
noDate: 'Дата не указана'
|
|
11
|
+
},
|
|
12
|
+
dayQuickFilters: {
|
|
13
|
+
yesterday: 'Вчера',
|
|
14
|
+
today: 'Сегодня',
|
|
15
|
+
tomorrow: 'Завтра'
|
|
16
|
+
},
|
|
17
|
+
footer: {
|
|
18
|
+
timeSelectionToggle: 'Указать время',
|
|
19
|
+
timeSelectionToggleHint: 'Указать время можно только для\u00A0периода',
|
|
20
|
+
clearFilterButton: 'Сбросить фильтр'
|
|
21
|
+
},
|
|
22
|
+
slider: {
|
|
23
|
+
day: {
|
|
24
|
+
title: 'День',
|
|
25
|
+
placeholder: 'Выберите день'
|
|
26
|
+
},
|
|
27
|
+
week: {
|
|
28
|
+
title: 'Неделя',
|
|
29
|
+
placeholder: 'Выберите неделю'
|
|
30
|
+
},
|
|
31
|
+
month: {
|
|
32
|
+
title: 'Месяц',
|
|
33
|
+
placeholder: 'Выберите месяц'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
format: {
|
|
38
|
+
slider: {
|
|
39
|
+
day: {
|
|
40
|
+
dateFormat: 'd MMMM yyyy'
|
|
41
|
+
},
|
|
42
|
+
week: {
|
|
43
|
+
dateFormat: {
|
|
44
|
+
sameMonth: {
|
|
45
|
+
firstDate: 'd',
|
|
46
|
+
endDate: 'd MMMM yyyy'
|
|
47
|
+
},
|
|
48
|
+
differentMonth: {
|
|
49
|
+
firstDate: 'd MMM',
|
|
50
|
+
endDate: 'd MMM yyyy'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
tooltipDateFormat: {
|
|
54
|
+
sameMonth: {
|
|
55
|
+
firstDate: 'd',
|
|
56
|
+
endDate: 'd MMMM yyyy'
|
|
57
|
+
},
|
|
58
|
+
differentMonth: {
|
|
59
|
+
firstDate: 'd MMMM',
|
|
60
|
+
endDate: 'd MMMM yyyy'
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
month: {
|
|
65
|
+
dateFormat: 'LLLL yyyy'
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
monthCalendarFormat: 'LLLL',
|
|
69
|
+
dateFormat: 'dd.MM.yyyy',
|
|
70
|
+
dateWithTimeFormat: 'dd.MM.yyyy HH:mm',
|
|
71
|
+
emptyDate: {
|
|
72
|
+
withTime: '__.__.____ __:__',
|
|
73
|
+
withoutTime: '__.__.____'
|
|
74
|
+
},
|
|
75
|
+
inputMask: {
|
|
76
|
+
withTime: '99.99.9999 99:99',
|
|
77
|
+
withoutTime: '99.99.9999'
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
export { ruLocaleValues };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DateRangeLocale } from '../types';
|
|
2
|
+
export interface Locale {
|
|
3
|
+
DateRange: DateRangeLocale;
|
|
4
|
+
}
|
|
5
|
+
export type TranslateValues = {
|
|
6
|
+
[K in keyof Locale]?: Partial<Locale[K]>;
|
|
7
|
+
};
|
|
8
|
+
export declare const isTranslateValues: (value: unknown) => value is TranslateValues;
|
|
9
|
+
export declare const toTranslateValues: (value: unknown) => TranslateValues | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const isPlainObject = (value)=>!!value && 'object' == typeof value && !Array.isArray(value);
|
|
2
|
+
const isTranslateValues = (value)=>{
|
|
3
|
+
if (!isPlainObject(value)) return false;
|
|
4
|
+
return Object.entries(value).every(([key, componentValue])=>'DateRange' === key && isPlainObject(componentValue));
|
|
5
|
+
};
|
|
6
|
+
const toTranslateValues = (value)=>isTranslateValues(value) ? value : void 0;
|
|
7
|
+
export { isTranslateValues, toTranslateValues };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ValueOf } from '../../../common';
|
|
2
|
+
import { type Locale } from './types';
|
|
3
|
+
export type LocaleComponentName = keyof Locale;
|
|
4
|
+
export declare const LocaleKey: {
|
|
5
|
+
readonly Locale: "locale";
|
|
6
|
+
readonly Lang: "lang";
|
|
7
|
+
};
|
|
8
|
+
export declare function useLocale<T extends LocaleComponentName>(componentName: T, getBy?: ValueOf<typeof LocaleKey>): Locale[T];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useContext, useMemo } from "react";
|
|
2
|
+
import { ELanguages, LocaleContext } from "../../../context/index.js";
|
|
3
|
+
import { enLocaleValues } from "./en-US.js";
|
|
4
|
+
import { ruLocaleValues } from "./ru-RU.js";
|
|
5
|
+
import { toTranslateValues } from "./types.js";
|
|
6
|
+
const isEnLocale = (lang)=>lang === ELanguages.EN;
|
|
7
|
+
const LocaleKey = {
|
|
8
|
+
Locale: 'locale',
|
|
9
|
+
Lang: 'lang'
|
|
10
|
+
};
|
|
11
|
+
function useLocale(componentName, getBy = LocaleKey.Lang) {
|
|
12
|
+
const { lang, locale, translateValues: contextTranslations } = useContext(LocaleContext);
|
|
13
|
+
const languageValue = useMemo(()=>getBy === LocaleKey.Lang ? lang : locale, [
|
|
14
|
+
getBy,
|
|
15
|
+
lang,
|
|
16
|
+
locale
|
|
17
|
+
]);
|
|
18
|
+
return useMemo(()=>{
|
|
19
|
+
const result = isEnLocale(languageValue) ? enLocaleValues : ruLocaleValues;
|
|
20
|
+
const componentContextTranslations = toTranslateValues(contextTranslations)?.[componentName] ?? {};
|
|
21
|
+
return {
|
|
22
|
+
...result[componentName],
|
|
23
|
+
...componentContextTranslations
|
|
24
|
+
};
|
|
25
|
+
}, [
|
|
26
|
+
componentName,
|
|
27
|
+
languageValue,
|
|
28
|
+
contextTranslations
|
|
29
|
+
]);
|
|
30
|
+
}
|
|
31
|
+
export { LocaleKey, useLocale };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { AriaAttributes, KeyboardEventHandler } from 'react';
|
|
2
|
+
import type { MutableRefObject, ReactNode, Ref } from 'react';
|
|
3
|
+
import type { IHasTestId } from '../../common/types';
|
|
4
|
+
import type { DateRangeDefaultTriggerProps } from './DateRangeDefaultTrigger/DateRangeDefaultTrigger';
|
|
5
|
+
import type { DateRangeFeatureProps, DateRangeValue } from './types';
|
|
6
|
+
export type DateRangeRenderInputOptions = {
|
|
7
|
+
triggerRef: MutableRefObject<HTMLElement | null>;
|
|
8
|
+
triggerAriaProps: Pick<AriaAttributes, 'aria-controls' | 'aria-expanded' | 'aria-haspopup'>;
|
|
9
|
+
open: boolean;
|
|
10
|
+
onOpen: () => void;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
onKeyDown: KeyboardEventHandler<HTMLElement>;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
testId?: string;
|
|
15
|
+
value: DateRangeValue;
|
|
16
|
+
formattedValue?: string;
|
|
17
|
+
displayValue?: string;
|
|
18
|
+
periodName?: string;
|
|
19
|
+
onPrev?: () => void;
|
|
20
|
+
onNext?: () => void;
|
|
21
|
+
isNavigationDisabled?: boolean;
|
|
22
|
+
};
|
|
23
|
+
type OmitedDefaultTriggerProps = Omit<DateRangeDefaultTriggerProps, 'value' | 'onChange' | 'onMouseDown' | 'focusedWidth' | 'inputContent' | 'renderCustomInput' | 'focusedState'>;
|
|
24
|
+
export interface DateRangeProps extends Omit<OmitedDefaultTriggerProps, 'label'>, DateRangeFeatureProps, IHasTestId {
|
|
25
|
+
label?: string;
|
|
26
|
+
minDate?: Date;
|
|
27
|
+
maxDate?: Date;
|
|
28
|
+
value?: DateRangeValue;
|
|
29
|
+
onChange?: (value: DateRangeValue) => void;
|
|
30
|
+
dropdownZIndex?: number;
|
|
31
|
+
renderInput?: (options: DateRangeRenderInputOptions) => ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* @default DEFAULT_HINT_Z_INDEX (3)
|
|
34
|
+
*/
|
|
35
|
+
hintZIndex?: number;
|
|
36
|
+
requiredDate?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export type DateRangeRef = Ref<HTMLDivElement>;
|
|
39
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
export type DateSelectVariant = 'period' | 'day' | 'week' | 'month' | 'anyDate' | 'noDate';
|
|
2
|
+
export type DayQuickFilter = 'yesterday' | 'today' | 'tomorrow';
|
|
3
|
+
export declare const DEFAULT_QUICK_FILTER: DayQuickFilter[];
|
|
4
|
+
export type DatesPeriod = [Date | null | undefined, Date | null | undefined];
|
|
5
|
+
export interface DateRangeValue {
|
|
6
|
+
type: DateSelectVariant;
|
|
7
|
+
value: Date | DatesPeriod | null;
|
|
8
|
+
}
|
|
9
|
+
export interface DateRangeRangeValue extends DateRangeValue {
|
|
10
|
+
type: 'period';
|
|
11
|
+
value: DatesPeriod;
|
|
12
|
+
}
|
|
13
|
+
export interface DateRangeDayValue extends DateRangeValue {
|
|
14
|
+
type: 'day';
|
|
15
|
+
value: Date | null;
|
|
16
|
+
}
|
|
17
|
+
export interface DateRangeWeekValue extends DateRangeValue {
|
|
18
|
+
type: 'week';
|
|
19
|
+
value: DatesPeriod;
|
|
20
|
+
}
|
|
21
|
+
export interface DateRangeMonthValue extends DateRangeValue {
|
|
22
|
+
type: 'month';
|
|
23
|
+
value: DatesPeriod;
|
|
24
|
+
}
|
|
25
|
+
export interface DateRangeAnyDateValue extends DateRangeValue {
|
|
26
|
+
type: 'anyDate';
|
|
27
|
+
value: null;
|
|
28
|
+
}
|
|
29
|
+
export interface DateRangeNoDateValue extends DateRangeValue {
|
|
30
|
+
type: 'noDate';
|
|
31
|
+
value: null;
|
|
32
|
+
}
|
|
33
|
+
export interface DateRangeLocale {
|
|
34
|
+
translate: {
|
|
35
|
+
radiobuttons: {
|
|
36
|
+
period: string;
|
|
37
|
+
day: string;
|
|
38
|
+
week: string;
|
|
39
|
+
month: string;
|
|
40
|
+
anyDate: string;
|
|
41
|
+
noDate: string;
|
|
42
|
+
};
|
|
43
|
+
dayQuickFilters: {
|
|
44
|
+
yesterday: string;
|
|
45
|
+
today: string;
|
|
46
|
+
tomorrow: string;
|
|
47
|
+
};
|
|
48
|
+
footer: {
|
|
49
|
+
timeSelectionToggle: string;
|
|
50
|
+
timeSelectionToggleHint: string;
|
|
51
|
+
clearFilterButton: string;
|
|
52
|
+
};
|
|
53
|
+
slider: {
|
|
54
|
+
day: {
|
|
55
|
+
title: string;
|
|
56
|
+
placeholder: string;
|
|
57
|
+
};
|
|
58
|
+
week: {
|
|
59
|
+
title: string;
|
|
60
|
+
placeholder: string;
|
|
61
|
+
};
|
|
62
|
+
month: {
|
|
63
|
+
title: string;
|
|
64
|
+
placeholder: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
format: {
|
|
69
|
+
slider: {
|
|
70
|
+
day: {
|
|
71
|
+
dateFormat: string;
|
|
72
|
+
};
|
|
73
|
+
week: {
|
|
74
|
+
dateFormat: {
|
|
75
|
+
sameMonth: {
|
|
76
|
+
firstDate: string;
|
|
77
|
+
endDate: string;
|
|
78
|
+
};
|
|
79
|
+
differentMonth: {
|
|
80
|
+
firstDate: string;
|
|
81
|
+
endDate: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
tooltipDateFormat: {
|
|
85
|
+
sameMonth: {
|
|
86
|
+
firstDate: string;
|
|
87
|
+
endDate: string;
|
|
88
|
+
};
|
|
89
|
+
differentMonth: {
|
|
90
|
+
firstDate: string;
|
|
91
|
+
endDate: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
month: {
|
|
96
|
+
dateFormat: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
inputMask: {
|
|
100
|
+
withTime: string;
|
|
101
|
+
withoutTime: string;
|
|
102
|
+
};
|
|
103
|
+
emptyDate: {
|
|
104
|
+
withTime: string;
|
|
105
|
+
withoutTime: string;
|
|
106
|
+
};
|
|
107
|
+
dateFormat: string;
|
|
108
|
+
dateWithTimeFormat: string;
|
|
109
|
+
monthCalendarFormat: string;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
export interface DateRangeFeatureProps {
|
|
113
|
+
/** @default true */
|
|
114
|
+
withPeriod?: boolean;
|
|
115
|
+
/** @default true */
|
|
116
|
+
withAnyDate?: boolean;
|
|
117
|
+
/** @default true */
|
|
118
|
+
withNoDate?: boolean;
|
|
119
|
+
/** @default true */
|
|
120
|
+
withTimeSelection?: boolean;
|
|
121
|
+
/** @default true */
|
|
122
|
+
withClearButton?: boolean;
|
|
123
|
+
/** @default ['yesterday', 'today'] */
|
|
124
|
+
quickFilter?: DayQuickFilter[];
|
|
125
|
+
}
|
|
126
|
+
export declare const DEFAULT_DATE_RANGE_FEATURES: Required<DateRangeFeatureProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const DEFAULT_QUICK_FILTER = [
|
|
2
|
+
'yesterday',
|
|
3
|
+
'today'
|
|
4
|
+
];
|
|
5
|
+
const DEFAULT_DATE_RANGE_FEATURES = {
|
|
6
|
+
withPeriod: true,
|
|
7
|
+
withAnyDate: true,
|
|
8
|
+
withNoDate: true,
|
|
9
|
+
withTimeSelection: true,
|
|
10
|
+
withClearButton: true,
|
|
11
|
+
quickFilter: DEFAULT_QUICK_FILTER
|
|
12
|
+
};
|
|
13
|
+
export { DEFAULT_DATE_RANGE_FEATURES, DEFAULT_QUICK_FILTER };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type FormatOptions } from 'date-fns';
|
|
2
|
+
import { type LanguageValue } from '../../context/constants';
|
|
3
|
+
import type { DateRangeAnyDateValue, DateRangeDayValue, DateRangeFeatureProps, DateRangeMonthValue, DateRangeNoDateValue, DateRangeRangeValue, DateRangeValue, DateRangeWeekValue, DatesPeriod } from './types';
|
|
4
|
+
export declare const isTimeDefault: (value: DatesPeriod) => boolean;
|
|
5
|
+
export declare const normalizeValue: (value: DateRangeValue, features: DateRangeFeatureProps) => DateRangeValue;
|
|
6
|
+
export declare const getCorrectInterval: (firstDate: Date, secondDate: Date) => [Date, Date];
|
|
7
|
+
export declare const isValuePeriod: (value: DateRangeValue["value"]) => value is DatesPeriod;
|
|
8
|
+
export declare const getPeriodValue: (value: DatesPeriod) => {
|
|
9
|
+
startDate: Date | null | undefined;
|
|
10
|
+
endDate: Date | null | undefined;
|
|
11
|
+
};
|
|
12
|
+
export declare const isRangeValue: (options: DateRangeValue) => options is DateRangeRangeValue;
|
|
13
|
+
export declare const getRangeDates: (options: DateRangeRangeValue | DateRangeWeekValue | DateRangeMonthValue) => {
|
|
14
|
+
startDate: Date | null | undefined;
|
|
15
|
+
endDate: Date | null | undefined;
|
|
16
|
+
};
|
|
17
|
+
export declare const isDayValue: (options: DateRangeValue) => options is DateRangeDayValue;
|
|
18
|
+
export declare const isWeekValue: (options: DateRangeValue) => options is DateRangeWeekValue;
|
|
19
|
+
export declare const isMonthValue: (options: DateRangeValue) => options is DateRangeMonthValue;
|
|
20
|
+
export declare const isAnyDateValue: (options: DateRangeValue) => options is DateRangeAnyDateValue;
|
|
21
|
+
export declare const isNoDateValue: (options: DateRangeValue) => options is DateRangeNoDateValue;
|
|
22
|
+
export declare const getFormatOptions: (lang: LanguageValue) => FormatOptions | undefined;
|
|
23
|
+
export declare const capitalizeFirstLetter: (value: string) => string;
|
|
24
|
+
export declare const isValueNullable: (options: DateRangeValue) => boolean;
|
|
25
|
+
export declare const isTimeEqual: (date: Date, timeToCompare: {
|
|
26
|
+
hours: number;
|
|
27
|
+
minutes: number;
|
|
28
|
+
}) => boolean;
|
|
29
|
+
export declare const getStartOfDay: (date: Date | null | undefined) => Date | null | undefined;
|
|
30
|
+
export declare const getFirstDayOfMonth: (year: number, month: number) => Date;
|
|
31
|
+
export declare const mapYearMonths: <T>(year: number, renderMonth: (monthStartDate: Date) => T) => T[];
|
|
32
|
+
export declare const getEndOfDay: (date: Date | null | undefined) => Date | null | undefined;
|
|
33
|
+
export declare const getRequiredDateRangeValue: (value: DateRangeValue, referenceDate?: Date) => DateRangeValue | null;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { endOfDay, endOfMonth, endOfWeek, getHours, getMinutes, isBefore, startOfDay, startOfMonth, startOfWeek } from "date-fns";
|
|
2
|
+
import { ru } from "date-fns/locale";
|
|
3
|
+
import { ELanguages } from "../../context/constants/index.js";
|
|
4
|
+
import { CalendarVariant, getDefaultVariant } from "./consts.js";
|
|
5
|
+
const isTimeDefault = (value)=>{
|
|
6
|
+
const { startDate, endDate } = getPeriodValue(value);
|
|
7
|
+
const isStartTimeDefault = !startDate || isTimeEqual(startDate, {
|
|
8
|
+
hours: 0,
|
|
9
|
+
minutes: 0
|
|
10
|
+
});
|
|
11
|
+
const isEndTimeDefault = !endDate || isTimeEqual(endDate, {
|
|
12
|
+
hours: 23,
|
|
13
|
+
minutes: 59
|
|
14
|
+
});
|
|
15
|
+
return isStartTimeDefault && isEndTimeDefault;
|
|
16
|
+
};
|
|
17
|
+
const normalizeValue = (value, features)=>{
|
|
18
|
+
if (value.type === CalendarVariant.period && false === features.withPeriod) return {
|
|
19
|
+
type: CalendarVariant.day,
|
|
20
|
+
value: null
|
|
21
|
+
};
|
|
22
|
+
if (value.type === CalendarVariant.anyDate && false === features.withAnyDate) return {
|
|
23
|
+
type: getDefaultVariant(features),
|
|
24
|
+
value: null
|
|
25
|
+
};
|
|
26
|
+
if (value.type === CalendarVariant.noDate && false === features.withNoDate) return {
|
|
27
|
+
type: getDefaultVariant(features),
|
|
28
|
+
value: null
|
|
29
|
+
};
|
|
30
|
+
return value;
|
|
31
|
+
};
|
|
32
|
+
const getCorrectInterval = (firstDate, secondDate)=>{
|
|
33
|
+
if (isBefore(firstDate, secondDate)) return [
|
|
34
|
+
firstDate,
|
|
35
|
+
secondDate
|
|
36
|
+
];
|
|
37
|
+
return [
|
|
38
|
+
secondDate,
|
|
39
|
+
firstDate
|
|
40
|
+
];
|
|
41
|
+
};
|
|
42
|
+
const isValuePeriod = (value)=>Array.isArray(value) && 2 === value.length;
|
|
43
|
+
const getPeriodValue = (value)=>{
|
|
44
|
+
const [startDate, endDate] = value;
|
|
45
|
+
return {
|
|
46
|
+
startDate,
|
|
47
|
+
endDate
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const isRangeValue = (options)=>options.type === CalendarVariant.period && isValuePeriod(options.value);
|
|
51
|
+
const getRangeDates = (options)=>getPeriodValue(options.value);
|
|
52
|
+
const isDayValue = (options)=>options.type === CalendarVariant.day && (options.value instanceof Date || !options.value);
|
|
53
|
+
const isWeekValue = (options)=>options.type === CalendarVariant.week && isValuePeriod(options.value);
|
|
54
|
+
const isMonthValue = (options)=>options.type === CalendarVariant.month && isValuePeriod(options.value);
|
|
55
|
+
const isAnyDateValue = (options)=>options.type === CalendarVariant.anyDate && !options.value;
|
|
56
|
+
const isNoDateValue = (options)=>options.type === CalendarVariant.noDate && !options.value;
|
|
57
|
+
const getFormatOptions = (lang)=>lang === ELanguages.EN ? void 0 : {
|
|
58
|
+
locale: ru
|
|
59
|
+
};
|
|
60
|
+
const capitalizeFirstLetter = (value)=>`${value.charAt(0).toUpperCase()}${value.slice(1)}`;
|
|
61
|
+
const isValueNullable = (options)=>{
|
|
62
|
+
if (isValuePeriod(options.value)) {
|
|
63
|
+
const { startDate, endDate } = getPeriodValue(options.value);
|
|
64
|
+
return !startDate && !endDate;
|
|
65
|
+
}
|
|
66
|
+
return !options.value;
|
|
67
|
+
};
|
|
68
|
+
const isTimeEqual = (date, timeToCompare)=>getHours(date) === timeToCompare.hours && getMinutes(date) === timeToCompare.minutes;
|
|
69
|
+
const getStartOfDay = (date)=>date ? startOfDay(date) : date;
|
|
70
|
+
const getFirstDayOfMonth = (year, month)=>startOfDay(new Date(year, month - 1, 1));
|
|
71
|
+
const MONTHS_IN_YEAR = 12;
|
|
72
|
+
const mapYearMonths = (year, renderMonth)=>Array.from({
|
|
73
|
+
length: MONTHS_IN_YEAR
|
|
74
|
+
}, (_, monthIndex)=>renderMonth(getFirstDayOfMonth(year, monthIndex + 1)));
|
|
75
|
+
const getEndOfDay = (date)=>date ? endOfDay(date) : date;
|
|
76
|
+
const getRequiredDateRangeValue = (value, referenceDate = new Date())=>{
|
|
77
|
+
const today = startOfDay(referenceDate);
|
|
78
|
+
if (isDayValue(value)) return {
|
|
79
|
+
type: CalendarVariant.day,
|
|
80
|
+
value: today
|
|
81
|
+
};
|
|
82
|
+
if (isWeekValue(value)) return {
|
|
83
|
+
type: CalendarVariant.week,
|
|
84
|
+
value: [
|
|
85
|
+
startOfWeek(today, {
|
|
86
|
+
weekStartsOn: 1
|
|
87
|
+
}),
|
|
88
|
+
endOfWeek(today, {
|
|
89
|
+
weekStartsOn: 1
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
};
|
|
93
|
+
if (isMonthValue(value)) {
|
|
94
|
+
const startDate = startOfMonth(today);
|
|
95
|
+
return {
|
|
96
|
+
type: CalendarVariant.month,
|
|
97
|
+
value: [
|
|
98
|
+
startDate,
|
|
99
|
+
endOfMonth(startDate)
|
|
100
|
+
]
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
};
|
|
105
|
+
export { capitalizeFirstLetter, getCorrectInterval, getEndOfDay, getFirstDayOfMonth, getFormatOptions, getPeriodValue, getRangeDates, getRequiredDateRangeValue, getStartOfDay, isAnyDateValue, isDayValue, isMonthValue, isNoDateValue, isRangeValue, isTimeDefault, isTimeEqual, isValueNullable, isValuePeriod, isWeekValue, mapYearMonths, normalizeValue };
|
|
@@ -50,6 +50,7 @@ export interface DatepickerProps extends IHasTestId {
|
|
|
50
50
|
lastElementRef?: Ref<HTMLElement>;
|
|
51
51
|
fitInput?: boolean;
|
|
52
52
|
showTimeText?: string;
|
|
53
|
+
nullableValueWhenTimeIncomplete?: boolean;
|
|
53
54
|
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
54
55
|
onFocus?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
55
56
|
onCalendarClose?: () => void;
|
|
@@ -62,6 +63,7 @@ export interface DatepickerProps extends IHasTestId {
|
|
|
62
63
|
}) => ReactNode;
|
|
63
64
|
onTimeToggleChange?: (selectTime: boolean) => void;
|
|
64
65
|
onInputKeyUp?: KeyboardEventHandler<HTMLInputElement>;
|
|
66
|
+
onInputKeyDown?: KeyboardEventHandler<HTMLInputElement>;
|
|
65
67
|
onDayClick?: (date: Date) => void;
|
|
66
68
|
}
|
|
67
69
|
export type ReactInputMaskInnerRefProps = {
|
|
@@ -72,4 +74,4 @@ export type ReactInputMaskInnerRefProps = {
|
|
|
72
74
|
setCursorToEnd: () => void;
|
|
73
75
|
onChange: (evt: unknown) => void;
|
|
74
76
|
};
|
|
75
|
-
export declare const Datepicker: ({ id, localeFormat, lang, dateTimeFormatOptions, testId, selectedDate, setInitialDateIntoInput, showIcon, inputClassName: inputClassNameProp, popperClassName, portalId, blurAfterChange, blurAfterPick, showTime, isTimeRequired, defaultTime, disabled, presets, presetsLabel, label, required, helperText, error, placeholder, icon, iconPosition, inputRef: parentInputRef, inline, frameless, blurInputOnEsc, blurInputOnEnter, lastElementRef, fitInput, showTimeText, customRender, onBlur, onFocus, onCalendarClose, onDateChanged, onEnterPress, onPick, onTimeToggleChange, onInputKeyUp, onDayClick, }: DatepickerProps) => string | number | boolean | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
77
|
+
export declare const Datepicker: ({ id, localeFormat, lang, dateTimeFormatOptions, testId, selectedDate, setInitialDateIntoInput, showIcon, inputClassName: inputClassNameProp, popperClassName, portalId, blurAfterChange, blurAfterPick, showTime, isTimeRequired, defaultTime, disabled, presets, presetsLabel, label, required, helperText, error, placeholder, icon, iconPosition, inputRef: parentInputRef, inline, frameless, blurInputOnEsc, blurInputOnEnter, lastElementRef, fitInput, showTimeText, nullableValueWhenTimeIncomplete, customRender, onBlur, onFocus, onCalendarClose, onDateChanged, onEnterPress, onPick, onTimeToggleChange, onInputKeyUp, onInputKeyDown, onDayClick, }: DatepickerProps) => string | number | boolean | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
@@ -32,7 +32,7 @@ const FocusableElement = {
|
|
|
32
32
|
TimeToggle: 'TimeToggle',
|
|
33
33
|
RightArrow: 'RightArrow'
|
|
34
34
|
};
|
|
35
|
-
const Datepicker = ({ id, localeFormat, lang, dateTimeFormatOptions, testId, selectedDate, setInitialDateIntoInput = false, showIcon = true, inputClassName: inputClassNameProp, popperClassName, portalId, blurAfterChange = true, blurAfterPick = true, showTime = false, isTimeRequired = false, defaultTime = DEFAULT_TIME, disabled, presets = [], presetsLabel, label = '', required = false, helperText = '', error = false, placeholder, icon = /*#__PURE__*/ jsx(Date12Icon, {}), iconPosition = 'start', inputRef: parentInputRef, inline, frameless, blurInputOnEsc = true, blurInputOnEnter = true, lastElementRef, fitInput, showTimeText = 'Указать время', customRender, onBlur, onFocus, onCalendarClose, onDateChanged, onEnterPress, onPick, onTimeToggleChange, onInputKeyUp, onDayClick })=>{
|
|
35
|
+
const Datepicker = ({ id, localeFormat, lang, dateTimeFormatOptions, testId, selectedDate, setInitialDateIntoInput = false, showIcon = true, inputClassName: inputClassNameProp, popperClassName, portalId, blurAfterChange = true, blurAfterPick = true, showTime = false, isTimeRequired = false, defaultTime = DEFAULT_TIME, disabled, presets = [], presetsLabel, label = '', required = false, helperText = '', error = false, placeholder, icon = /*#__PURE__*/ jsx(Date12Icon, {}), iconPosition = 'start', inputRef: parentInputRef, inline, frameless, blurInputOnEsc = true, blurInputOnEnter = true, lastElementRef, fitInput, showTimeText = 'Указать время', nullableValueWhenTimeIncomplete = false, customRender, onBlur, onFocus, onCalendarClose, onDateChanged, onEnterPress, onPick, onTimeToggleChange, onInputKeyUp, onInputKeyDown, onDayClick })=>{
|
|
36
36
|
const formatter = dateFormatter.getFormatter(localeFormat, dateTimeFormatOptions);
|
|
37
37
|
const parsedSelectedDate = useMemo(()=>'string' == typeof selectedDate ? parseSelectedDate(selectedDate, formatter) : selectedDate, [
|
|
38
38
|
selectedDate,
|
|
@@ -130,7 +130,8 @@ const Datepicker = ({ id, localeFormat, lang, dateTimeFormatOptions, testId, sel
|
|
|
130
130
|
onPick
|
|
131
131
|
]);
|
|
132
132
|
const updateParsedDate = useCallback((parsed, time)=>{
|
|
133
|
-
|
|
133
|
+
const isTimeNotFilled = !parsed?.time && timeInputEnabled;
|
|
134
|
+
if (!parsed || isTimeNotFilled && nullableValueWhenTimeIncomplete) {
|
|
134
135
|
onDateChanged(null, {
|
|
135
136
|
dateString: '',
|
|
136
137
|
formatter
|
|
@@ -256,6 +257,7 @@ const Datepicker = ({ id, localeFormat, lang, dateTimeFormatOptions, testId, sel
|
|
|
256
257
|
onFocus
|
|
257
258
|
]);
|
|
258
259
|
const handleInputKeyDown = useCallback((e)=>{
|
|
260
|
+
onInputKeyDown?.(e);
|
|
259
261
|
const input = inputRef.current?.getInputDOMNode();
|
|
260
262
|
if (e.key === ESCAPE_KEY && blurInputOnEsc) {
|
|
261
263
|
input?.blur();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode, type RefObject } from 'react';
|
|
2
|
+
export interface DropdownContentProps {
|
|
3
|
+
calendar: ReactNode;
|
|
4
|
+
input: ReactNode;
|
|
5
|
+
inputRef: RefObject<HTMLInputElement>;
|
|
6
|
+
lastDropdownElementRef: RefObject<HTMLElement>;
|
|
7
|
+
testId?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const DropdownContent: import("react").ForwardRefExoticComponent<DropdownContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { getOptionalTestId } from "../../../common/testId/getTestId.js";
|
|
4
|
+
import { CustomDatepickerDropdownContent } from "../../_shared/CustomDatepickerDropdownContent/CustomDatepickerDropdownContent.js";
|
|
5
|
+
const DropdownContent = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
6
|
+
const focusOnInput = ()=>{
|
|
7
|
+
props.inputRef.current?.focus();
|
|
8
|
+
};
|
|
9
|
+
const focusOnLastElement = ()=>{
|
|
10
|
+
(props.lastDropdownElementRef.current ?? props.inputRef.current)?.focus();
|
|
11
|
+
};
|
|
12
|
+
const handleOpen = ()=>{
|
|
13
|
+
focusOnInput();
|
|
14
|
+
};
|
|
15
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
16
|
+
"data-test-id": getOptionalTestId(props.testId, 'dropdown-content'),
|
|
17
|
+
ref: ref,
|
|
18
|
+
children: [
|
|
19
|
+
/*#__PURE__*/ jsx("div", {
|
|
20
|
+
tabIndex: 0,
|
|
21
|
+
onFocus: focusOnLastElement
|
|
22
|
+
}),
|
|
23
|
+
/*#__PURE__*/ jsx(CustomDatepickerDropdownContent, {
|
|
24
|
+
calendar: props.calendar,
|
|
25
|
+
input: props.input,
|
|
26
|
+
onOpen: handleOpen
|
|
27
|
+
}),
|
|
28
|
+
/*#__PURE__*/ jsx("div", {
|
|
29
|
+
tabIndex: 0,
|
|
30
|
+
onFocus: focusOnInput
|
|
31
|
+
})
|
|
32
|
+
]
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
DropdownContent.displayName = 'DropdownContent';
|
|
36
|
+
export { DropdownContent };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type DatepickerProps } from '../Datepicker/Datepicker';
|
|
2
|
+
export declare const omitedDatepickerProps: ("error" | "label" | "inline" | "required" | "placeholder" | "helperText" | "frameless" | "setInitialDateIntoInput" | "blurAfterChange" | "blurAfterPick" | "showTime" | "isTimeRequired" | "blurInputOnEsc" | "blurInputOnEnter" | "fitInput" | "nullableValueWhenTimeIncomplete" | "customRender" | "onTimeToggleChange")[];
|
|
3
|
+
type OmitedDatepickerProps = Omit<DatepickerProps, (typeof omitedDatepickerProps)[number]>;
|
|
4
|
+
export interface EditableDateProps extends OmitedDatepickerProps {
|
|
5
|
+
prefix?: string;
|
|
6
|
+
selectedDate: Date | string;
|
|
7
|
+
}
|
|
8
|
+
export declare const EditableDate: ({ prefix, selectedDate, localeFormat, dateTimeFormatOptions, disabled, iconPosition, onDayClick, ...props }: EditableDateProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|