@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
|
@@ -6,8 +6,8 @@ import { Datepicker } from "../Datepicker/Datepicker.js";
|
|
|
6
6
|
import { dateFormatter, parseSelectedDate } from "../Datepicker/utils/index.js";
|
|
7
7
|
import { useLocaleContext } from "../../context/contexts/LocaleContext.js";
|
|
8
8
|
import { Date12Icon } from "../../icon/index.js";
|
|
9
|
+
import { CustomDatepickerDropdownContent } from "../_shared/CustomDatepickerDropdownContent/CustomDatepickerDropdownContent.js";
|
|
9
10
|
import { LabelValue } from "../LabelValue/LabelValue.js";
|
|
10
|
-
import { DropdownContent } from "./DropdownContent/index.js";
|
|
11
11
|
import LabelValueDate_module from "./LabelValueDate.module.js";
|
|
12
12
|
const BasicLabelValueDate = /*#__PURE__*/ forwardRef(({ value, label, emptyText = 'Не указано', dateTimeFormatOptions, defaultTime, helperText, icon, iconPosition, id, inputClassName, isTimeRequired, placeholder, presets, setInitialDateIntoInput, presetsLabel, showIcon, showTime, showTimeText, onCalendarClose, onChange, onPick, onEnterPress, onTimeToggleChange, onDayClick, ...props }, ref)=>{
|
|
13
13
|
const { lang, locale } = useLocaleContext();
|
|
@@ -114,7 +114,7 @@ const BasicLabelValueDate = /*#__PURE__*/ forwardRef(({ value, label, emptyText
|
|
|
114
114
|
tabIndex: 0,
|
|
115
115
|
onFocus: focusOnLastElement
|
|
116
116
|
}),
|
|
117
|
-
/*#__PURE__*/ jsx(
|
|
117
|
+
/*#__PURE__*/ jsx(CustomDatepickerDropdownContent, {
|
|
118
118
|
testId: calendarTestId,
|
|
119
119
|
label: label,
|
|
120
120
|
error: props.error,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { KeyboardEventHandler, MouseEventHandler } from 'react';
|
|
2
|
+
interface DeleteButtonProps {
|
|
3
|
+
testId?: string;
|
|
4
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
5
|
+
onKeyDown?: KeyboardEventHandler<HTMLButtonElement>;
|
|
6
|
+
onKeyUp?: KeyboardEventHandler<HTMLButtonElement>;
|
|
7
|
+
}
|
|
8
|
+
export declare const DeleteButton: (props: DeleteButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "../../Button/Button.js";
|
|
3
|
+
import { Delete12Icon } from "../../../icon/components/Delete12Icon.js";
|
|
4
|
+
import LabelValueFile_module from "../LabelValueFile.module.js";
|
|
5
|
+
const DeleteButton = (props)=>/*#__PURE__*/ jsx(Button, {
|
|
6
|
+
testId: props.testId,
|
|
7
|
+
className: LabelValueFile_module.independentButton,
|
|
8
|
+
type: "button",
|
|
9
|
+
variant: "filled",
|
|
10
|
+
size: "m",
|
|
11
|
+
isIconButton: true,
|
|
12
|
+
onClick: props.onClick,
|
|
13
|
+
onKeyDown: props.onKeyDown,
|
|
14
|
+
onKeyUp: props.onKeyUp,
|
|
15
|
+
children: /*#__PURE__*/ jsx(Delete12Icon, {})
|
|
16
|
+
});
|
|
17
|
+
export { DeleteButton };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IFile } from '../../FileUploader/FileUploader';
|
|
2
|
+
interface FilePreviewIconProps {
|
|
3
|
+
testId?: string;
|
|
4
|
+
file?: IFile;
|
|
5
|
+
}
|
|
6
|
+
export declare const FilePreviewIcon: (props: FilePreviewIconProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getOptionalTestId } from "../../../common/index.js";
|
|
3
|
+
import { EmptyFile16Icon } from "../../../icon/components/EmptyFile16Icon.js";
|
|
4
|
+
import FilePreviewIcon_module from "./FilePreviewIcon.module.js";
|
|
5
|
+
const FilePreviewIcon = (props)=>{
|
|
6
|
+
if (!props.file) return null;
|
|
7
|
+
return /*#__PURE__*/ jsx("div", {
|
|
8
|
+
className: FilePreviewIcon_module.container,
|
|
9
|
+
"data-test-id": getOptionalTestId(props.testId, 'container'),
|
|
10
|
+
children: /*#__PURE__*/ jsx(EmptyFile16Icon, {
|
|
11
|
+
className: FilePreviewIcon_module.icon
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
export { FilePreviewIcon };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IFile } from '../../FileUploader/FileUploader';
|
|
2
|
+
interface ImagePreviewProps {
|
|
3
|
+
testId?: string;
|
|
4
|
+
file: IFile;
|
|
5
|
+
onVisibilityChange?: (visible: boolean) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const ImagePreview: (props: ImagePreviewProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState } from "react";
|
|
3
|
+
import { cn, getOptionalTestId } from "../../../common/index.js";
|
|
4
|
+
import { FileUploaderImagePreviewModal } from "../../FileUploader/components/index.js";
|
|
5
|
+
import LabelValueFile_module from "../LabelValueFile.module.js";
|
|
6
|
+
import ImagePreview_module from "./ImagePreview.module.js";
|
|
7
|
+
const ImagePreview = (props)=>{
|
|
8
|
+
const buttonRef = useRef(null);
|
|
9
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
10
|
+
const [isError, setIsError] = useState(false);
|
|
11
|
+
const changeVisibility = (visible)=>{
|
|
12
|
+
setIsVisible(visible);
|
|
13
|
+
props.onVisibilityChange?.(visible);
|
|
14
|
+
};
|
|
15
|
+
const handleError = ()=>{
|
|
16
|
+
setIsError(true);
|
|
17
|
+
};
|
|
18
|
+
const handleLoad = ()=>{
|
|
19
|
+
setIsError(false);
|
|
20
|
+
};
|
|
21
|
+
return /*#__PURE__*/ jsxs("button", {
|
|
22
|
+
ref: buttonRef,
|
|
23
|
+
className: cn(LabelValueFile_module.button, LabelValueFile_module.independentButton, ImagePreview_module.imagePreviewButton),
|
|
24
|
+
onClick: (event)=>{
|
|
25
|
+
event.stopPropagation();
|
|
26
|
+
event.preventDefault();
|
|
27
|
+
changeVisibility(true);
|
|
28
|
+
},
|
|
29
|
+
"data-test-id": getOptionalTestId(props.testId, 'button'),
|
|
30
|
+
children: [
|
|
31
|
+
/*#__PURE__*/ jsx("img", {
|
|
32
|
+
"data-test-id": props.testId,
|
|
33
|
+
src: props.file.tinyImage ?? props.file.preview,
|
|
34
|
+
className: isError ? void 0 : ImagePreview_module.image,
|
|
35
|
+
onError: handleError,
|
|
36
|
+
onLoad: handleLoad
|
|
37
|
+
}),
|
|
38
|
+
/*#__PURE__*/ jsx("div", {
|
|
39
|
+
onClick: (event)=>event.stopPropagation(),
|
|
40
|
+
children: /*#__PURE__*/ jsx(FileUploaderImagePreviewModal, {
|
|
41
|
+
testId: getOptionalTestId(props.testId, 'modal'),
|
|
42
|
+
isVisible: isVisible,
|
|
43
|
+
onClose: ()=>{
|
|
44
|
+
changeVisibility(false);
|
|
45
|
+
buttonRef.current?.focus();
|
|
46
|
+
},
|
|
47
|
+
imgSrc: props.file.preview
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
]
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
export { ImagePreview };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type IUseFileUploaderResult } from '../FileUploader/FileUploader';
|
|
2
|
+
import { type SharedLabelValueProps } from '../LabelValue/LabelValue';
|
|
3
|
+
export interface LabelValueFileProps extends Omit<SharedLabelValueProps, 'valueBlockContent' | 'dropdownClassName' | 'dropdownStyles' | 'onDropdownClose' | 'onChange'> {
|
|
4
|
+
fileUploader: IUseFileUploaderResult;
|
|
5
|
+
emptyText?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const LabelValueFile: ({ fileUploader, emptyText, ...props }: LabelValueFileProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useRef } from "react";
|
|
3
|
+
import { getOptionalTestId } from "../../common/index.js";
|
|
4
|
+
import { FileUploader } from "../FileUploader/FileUploader.js";
|
|
5
|
+
import { LabelValue } from "../LabelValue/LabelValue.js";
|
|
6
|
+
import { ValueBlock } from "./ValueBlock/ValueBlock.js";
|
|
7
|
+
import LabelValueFile_module from "./LabelValueFile.module.js";
|
|
8
|
+
const LabelValueFile = ({ fileUploader, emptyText = 'Загрузить', ...props })=>{
|
|
9
|
+
const uploadedFile = useMemo(()=>fileUploader.files[0], [
|
|
10
|
+
fileUploader.files
|
|
11
|
+
]);
|
|
12
|
+
const isEmpty = !uploadedFile;
|
|
13
|
+
const needOpenFileLoaderOnClick = isEmpty && !props.disabled;
|
|
14
|
+
const handleClick = (event)=>{
|
|
15
|
+
props.onClick?.(event);
|
|
16
|
+
if (needOpenFileLoaderOnClick) return void fileUploader.open();
|
|
17
|
+
downloadAnchorRef.current?.click();
|
|
18
|
+
};
|
|
19
|
+
const downloadAnchorRef = useRef(null);
|
|
20
|
+
return /*#__PURE__*/ jsx(LabelValue, {
|
|
21
|
+
...props,
|
|
22
|
+
className: LabelValueFile_module.labelValueContainer,
|
|
23
|
+
value: uploadedFile?.preview ?? emptyText,
|
|
24
|
+
onClick: handleClick,
|
|
25
|
+
renderCustomValueBlock: (valueBlockProps)=>/*#__PURE__*/ jsx(FileUploader.Trigger, {
|
|
26
|
+
...fileUploader.getInputProps(),
|
|
27
|
+
multiple: false,
|
|
28
|
+
children: /*#__PURE__*/ jsx(ValueBlock, {
|
|
29
|
+
testId: getOptionalTestId(props.testId, 'value-block'),
|
|
30
|
+
label: valueBlockProps.label,
|
|
31
|
+
fileUploader: fileUploader,
|
|
32
|
+
emptyText: emptyText,
|
|
33
|
+
file: uploadedFile,
|
|
34
|
+
disabled: valueBlockProps.disabled,
|
|
35
|
+
error: valueBlockProps.error,
|
|
36
|
+
downloadAnchorRef: downloadAnchorRef,
|
|
37
|
+
needShowLabelTooltip: valueBlockProps.isNeedShowLabelTooltip
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
export { LabelValueFile };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "./LabelValueFile_module.css";
|
|
2
|
+
const LabelValueFile_module = {
|
|
3
|
+
button: "button-Zc4UKH",
|
|
4
|
+
empty: "empty-8Hb4FL",
|
|
5
|
+
disabled: "disabled-zkmcEm",
|
|
6
|
+
default: "default-Hmk1zy",
|
|
7
|
+
labelValueContainer: "labelValueContainer-dC8M8n",
|
|
8
|
+
independentButton: "independentButton-rhTGKT",
|
|
9
|
+
error: "error-Bl2Ors",
|
|
10
|
+
buttonText: "buttonText-tgGQM3"
|
|
11
|
+
};
|
|
12
|
+
export default LabelValueFile_module;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.button-Zc4UKH {
|
|
2
|
+
all: unset;
|
|
3
|
+
cursor: pointer;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: 4px;
|
|
6
|
+
max-width: fit-content;
|
|
7
|
+
display: flex;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.empty-8Hb4FL {
|
|
12
|
+
flex: 1;
|
|
13
|
+
max-width: 100%;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.disabled-zkmcEm.empty-8Hb4FL {
|
|
17
|
+
cursor: default;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.default-Hmk1zy, .labelValueContainer-dC8M8n:active:has(.independentButton-rhTGKT:active) .default-Hmk1zy {
|
|
21
|
+
color: var(--button-primary-normal);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.button-Zc4UKH:focus-visible {
|
|
25
|
+
outline: 1px solid var(--elements-hover);
|
|
26
|
+
outline-offset: -1px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.default-Hmk1zy:hover {
|
|
30
|
+
color: var(--button-primary-hover);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.labelValueContainer-dC8M8n:active .default-Hmk1zy {
|
|
34
|
+
color: var(--button-primary-pressed);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.error-Bl2Ors {
|
|
38
|
+
color: var(--text-critical);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.disabled-zkmcEm {
|
|
42
|
+
color: var(--text-primary);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.buttonText-tgGQM3 {
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
text-overflow: ellipsis;
|
|
48
|
+
color: inherit;
|
|
49
|
+
text-decoration: none;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.buttonText-tgGQM3:after {
|
|
54
|
+
content: "";
|
|
55
|
+
display: block;
|
|
56
|
+
}
|
|
57
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Ref } from 'react';
|
|
2
|
+
import type { IFile, IUseFileUploaderResult } from '../../FileUploader/FileUploader';
|
|
3
|
+
interface ValueBlockProps {
|
|
4
|
+
fileUploader: IUseFileUploaderResult;
|
|
5
|
+
label: string;
|
|
6
|
+
emptyText: string;
|
|
7
|
+
testId?: string;
|
|
8
|
+
file?: IFile;
|
|
9
|
+
downloadAnchorRef?: Ref<HTMLAnchorElement>;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
error?: boolean;
|
|
12
|
+
needShowLabelTooltip?: () => boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const ValueBlock: (props: ValueBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import { getOptionalTestId } from "../../../common/index.js";
|
|
4
|
+
import { cn } from "../../../common/css/index.js";
|
|
5
|
+
import { mergeRefs } from "../../../common/react/mergeRefs.js";
|
|
6
|
+
import { useValueBlock } from "../../LabelValue/hooks/useValueBlock.js";
|
|
7
|
+
import { ValueBlockWrapper } from "../../LabelValue/ValueBlockWrapper.js";
|
|
8
|
+
import { ValueTextWithHint } from "../../LabelValue/ValueTextWithHint.js";
|
|
9
|
+
import { Text } from "../../Text/Text.js";
|
|
10
|
+
import { DeleteButton } from "../DeleteButton/DeleteButton.js";
|
|
11
|
+
import { FilePreviewIcon } from "../FilePreviewIcon/FilePreviewIcon.js";
|
|
12
|
+
import { ImagePreview } from "../ImagePreview/ImagePreview.js";
|
|
13
|
+
import LabelValueFile_module from "../LabelValueFile.module.js";
|
|
14
|
+
import ValueBlock_module from "./ValueBlock.module.js";
|
|
15
|
+
const isImage = (file)=>file.type.startsWith('image/');
|
|
16
|
+
const ValueBlock = (props)=>{
|
|
17
|
+
const mainButtonRef = useRef(null);
|
|
18
|
+
const valueBlock = useValueBlock({
|
|
19
|
+
value: props.file ? props.file?.name : props.emptyText
|
|
20
|
+
});
|
|
21
|
+
const isEmpty = !props.file;
|
|
22
|
+
const showDeleteButton = !props.disabled && !isEmpty;
|
|
23
|
+
const getButtonColorStyle = ()=>{
|
|
24
|
+
if (props.disabled && isEmpty) return LabelValueFile_module.disabled;
|
|
25
|
+
if (props.error) return LabelValueFile_module.error;
|
|
26
|
+
return LabelValueFile_module["default"];
|
|
27
|
+
};
|
|
28
|
+
const deleteFile = ()=>{
|
|
29
|
+
if (props.file) props.fileUploader.removeFile(props.file);
|
|
30
|
+
};
|
|
31
|
+
const deleteByKeyboard = (event)=>{
|
|
32
|
+
event.preventDefault();
|
|
33
|
+
deleteFile();
|
|
34
|
+
mainButtonRef.current?.focus();
|
|
35
|
+
};
|
|
36
|
+
const handleDeleteButtonClick = (event)=>{
|
|
37
|
+
event.stopPropagation();
|
|
38
|
+
deleteFile();
|
|
39
|
+
};
|
|
40
|
+
const handleDeleteButtonKeyUp = (event)=>{
|
|
41
|
+
if (' ' === event.key) deleteByKeyboard(event);
|
|
42
|
+
};
|
|
43
|
+
const handleDeleteButtonKeyDown = (event)=>{
|
|
44
|
+
if ('Enter' === event.key) deleteByKeyboard(event);
|
|
45
|
+
};
|
|
46
|
+
const isShowLabelTooltip = ()=>(props.needShowLabelTooltip?.() && valueBlock.isValueHintForceDisplayed) ?? false;
|
|
47
|
+
return /*#__PURE__*/ jsxs(ValueBlockWrapper, {
|
|
48
|
+
testId: props.testId,
|
|
49
|
+
className: ValueBlock_module.container,
|
|
50
|
+
children: [
|
|
51
|
+
/*#__PURE__*/ jsxs("div", {
|
|
52
|
+
className: cn(ValueBlock_module.buttonsContainer, isEmpty && LabelValueFile_module.empty),
|
|
53
|
+
children: [
|
|
54
|
+
props.file && isImage(props.file) && /*#__PURE__*/ jsx(ImagePreview, {
|
|
55
|
+
testId: getOptionalTestId(props.testId, 'image-preview'),
|
|
56
|
+
file: props.file,
|
|
57
|
+
onVisibilityChange: ()=>{
|
|
58
|
+
valueBlock.onHintVisibilityChange(false);
|
|
59
|
+
}
|
|
60
|
+
}),
|
|
61
|
+
/*#__PURE__*/ jsx(ValueTextWithHint, {
|
|
62
|
+
isHintVisible: valueBlock.isHintVisible || valueBlock.isValueHintForceDisplayed,
|
|
63
|
+
onHintVisibilityChange: valueBlock.onHintVisibilityChange,
|
|
64
|
+
value: props.file ? props.file?.name : props.emptyText,
|
|
65
|
+
isShowLabelTooltip: isShowLabelTooltip,
|
|
66
|
+
label: props.label,
|
|
67
|
+
children: /*#__PURE__*/ jsxs("button", {
|
|
68
|
+
"data-test-id": getOptionalTestId(props.testId, 'button'),
|
|
69
|
+
ref: mergeRefs([
|
|
70
|
+
mainButtonRef,
|
|
71
|
+
valueBlock.valueBlockInnerRef
|
|
72
|
+
]),
|
|
73
|
+
className: cn(LabelValueFile_module.button, getButtonColorStyle(), isEmpty && LabelValueFile_module.empty),
|
|
74
|
+
disabled: props.disabled && isEmpty,
|
|
75
|
+
onFocus: valueBlock.handleFocus,
|
|
76
|
+
onBlur: valueBlock.handleBlur,
|
|
77
|
+
onClick: ()=>{
|
|
78
|
+
valueBlock.onHintVisibilityChange(false);
|
|
79
|
+
},
|
|
80
|
+
children: [
|
|
81
|
+
props.file && !isImage(props.file) && /*#__PURE__*/ jsx(FilePreviewIcon, {
|
|
82
|
+
file: props.file,
|
|
83
|
+
testId: getOptionalTestId(props.testId, 'file-icon')
|
|
84
|
+
}),
|
|
85
|
+
props.file ? /*#__PURE__*/ jsx(Text.Body, {
|
|
86
|
+
testId: getOptionalTestId(props.testId, 'anchor'),
|
|
87
|
+
ref: mergeRefs([
|
|
88
|
+
props.downloadAnchorRef,
|
|
89
|
+
valueBlock.valueTooltip.ref
|
|
90
|
+
]),
|
|
91
|
+
as: "a",
|
|
92
|
+
tabIndex: -1,
|
|
93
|
+
className: LabelValueFile_module.buttonText,
|
|
94
|
+
href: props.file?.preview,
|
|
95
|
+
download: props.file?.name,
|
|
96
|
+
onClick: (event)=>{
|
|
97
|
+
event.stopPropagation();
|
|
98
|
+
},
|
|
99
|
+
children: props.file?.name
|
|
100
|
+
}) : /*#__PURE__*/ jsx(Text.Body, {
|
|
101
|
+
as: "span",
|
|
102
|
+
ref: mergeRefs([
|
|
103
|
+
valueBlock.valueTooltip.ref
|
|
104
|
+
]),
|
|
105
|
+
className: LabelValueFile_module.buttonText,
|
|
106
|
+
testId: getOptionalTestId(props.testId, 'empty-text'),
|
|
107
|
+
children: props.emptyText
|
|
108
|
+
})
|
|
109
|
+
]
|
|
110
|
+
})
|
|
111
|
+
}),
|
|
112
|
+
showDeleteButton && /*#__PURE__*/ jsx(DeleteButton, {
|
|
113
|
+
testId: getOptionalTestId(props.testId, 'delete-button'),
|
|
114
|
+
onClick: handleDeleteButtonClick,
|
|
115
|
+
onKeyUp: handleDeleteButtonKeyUp,
|
|
116
|
+
onKeyDown: handleDeleteButtonKeyDown
|
|
117
|
+
})
|
|
118
|
+
]
|
|
119
|
+
}),
|
|
120
|
+
showDeleteButton && /*#__PURE__*/ jsx("div", {
|
|
121
|
+
"data-test-id": getOptionalTestId(props.testId, 'click-preventer'),
|
|
122
|
+
className: ValueBlock_module.clickPreventer,
|
|
123
|
+
onClick: (event)=>{
|
|
124
|
+
event.stopPropagation();
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
]
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
export { ValueBlock };
|
|
@@ -11,9 +11,11 @@ export interface DropdownContentProps {
|
|
|
11
11
|
error?: boolean;
|
|
12
12
|
info?: string;
|
|
13
13
|
placeholder?: string;
|
|
14
|
+
clearable?: boolean;
|
|
14
15
|
inputProps?: ComponentPropsWithoutRef<typeof Input>;
|
|
15
16
|
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
16
17
|
onCloseByKeyboard: (event: KeyboardEvent | FocusEvent) => void;
|
|
17
18
|
renderActions?: (args: RenderActionsParams) => ReactNode;
|
|
19
|
+
isSelectInputValueAfterOpen?: boolean;
|
|
18
20
|
}
|
|
19
21
|
export declare const DropdownContent: import("react").ForwardRefExoticComponent<DropdownContentProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -7,6 +7,7 @@ const DropdownContent = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
|
7
7
|
const ref = useRef(null);
|
|
8
8
|
useEffect(()=>{
|
|
9
9
|
ref.current?.focus();
|
|
10
|
+
if (props.isSelectInputValueAfterOpen) return void ref.current?.setSelectionRange(0, -1);
|
|
10
11
|
ref.current?.setSelectionRange(-1, -1);
|
|
11
12
|
}, []);
|
|
12
13
|
const handleInputKeyDown = (event)=>{
|
|
@@ -35,6 +36,7 @@ const DropdownContent = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
|
35
36
|
value: props.value,
|
|
36
37
|
onChange: props.onChange,
|
|
37
38
|
error: props.error,
|
|
39
|
+
clearable: props.clearable,
|
|
38
40
|
info: props.info,
|
|
39
41
|
placeholder: props.placeholder,
|
|
40
42
|
onKeyDown: handleInputKeyDown,
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { LabelValue, LabelValueVariant } from "../LabelValue/LabelValue.js";
|
|
4
|
+
import { useIsElementOverflowing } from "../../hooks/index.js";
|
|
5
|
+
import { Edit12Icon } from "../../icon/index.js";
|
|
6
|
+
import { removeZeroWithSpace } from "../../utils/index.js";
|
|
7
|
+
import { Button, ButtonSize, ButtonVariants } from "../Button/Button.js";
|
|
8
|
+
import { DropdownContent } from "../LabelValueInput/DropdownConnent/DropdownContent.js";
|
|
9
|
+
import { LabelValueLinkValueBlock } from "./ValueBlock/LabelValueLinkValueBlock.js";
|
|
10
|
+
import { normalizeLinkValue } from "./normalizeLinkValue.js";
|
|
11
|
+
import { useLinkDropdownValue } from "./useLinkDropdownValue.js";
|
|
12
|
+
import LabelValueLink_module from "./LabelValueLink.module.js";
|
|
13
|
+
const LabelValueLink = /*#__PURE__*/ forwardRef(({ emptyText = 'Не указано', value: valueProp, label, disabled, className, error, required, name, info, inputProps, inputRef, testId, placeholder, onChange, ...props }, ref)=>{
|
|
14
|
+
const trimmedValueProp = removeZeroWithSpace(valueProp)?.trim();
|
|
15
|
+
const { dropdownValue, handleChange, submitNormalized, synchronize } = useLinkDropdownValue({
|
|
16
|
+
value: trimmedValueProp,
|
|
17
|
+
onChange
|
|
18
|
+
});
|
|
19
|
+
const labelOverflowing = useIsElementOverflowing([
|
|
20
|
+
label
|
|
21
|
+
]);
|
|
22
|
+
const value = normalizeLinkValue(trimmedValueProp) || emptyText;
|
|
23
|
+
const isEmpty = !trimmedValueProp;
|
|
24
|
+
return /*#__PURE__*/ jsx(LabelValue, {
|
|
25
|
+
...props,
|
|
26
|
+
testId: testId,
|
|
27
|
+
ref: ref,
|
|
28
|
+
label: label,
|
|
29
|
+
renderIcon: disabled || isEmpty || error ? void 0 : ()=>/*#__PURE__*/ jsx(Button, {
|
|
30
|
+
isIconButton: true,
|
|
31
|
+
size: ButtonSize.M,
|
|
32
|
+
variant: ButtonVariants.FILLED,
|
|
33
|
+
className: LabelValueLink_module.icon,
|
|
34
|
+
children: /*#__PURE__*/ jsx(Edit12Icon, {})
|
|
35
|
+
}),
|
|
36
|
+
value: value,
|
|
37
|
+
isEmpty: isEmpty,
|
|
38
|
+
className: className,
|
|
39
|
+
error: error,
|
|
40
|
+
required: required,
|
|
41
|
+
disabled: disabled,
|
|
42
|
+
iconFollowsValueHover: false,
|
|
43
|
+
valueVariant: LabelValueVariant.LINK,
|
|
44
|
+
labelRef: labelOverflowing.ref,
|
|
45
|
+
onDropdownOpen: synchronize,
|
|
46
|
+
onDropdownClose: submitNormalized,
|
|
47
|
+
renderCustomValueBlock: (props)=>/*#__PURE__*/ jsx(LabelValueLinkValueBlock, {
|
|
48
|
+
...props,
|
|
49
|
+
isDefaultValue: value === emptyText,
|
|
50
|
+
isNeedShowLabelTooltip: labelOverflowing.getIsOverflowing
|
|
51
|
+
}),
|
|
52
|
+
dropdownContent: ({ closeByKeyboardHandler })=>/*#__PURE__*/ jsx("div", {
|
|
53
|
+
className: LabelValueLink_module.dropdownContent,
|
|
54
|
+
children: /*#__PURE__*/ jsx(DropdownContent, {
|
|
55
|
+
testId: testId,
|
|
56
|
+
label: label,
|
|
57
|
+
name: name,
|
|
58
|
+
value: dropdownValue,
|
|
59
|
+
onChange: handleChange,
|
|
60
|
+
error: error,
|
|
61
|
+
info: info,
|
|
62
|
+
clearable: true,
|
|
63
|
+
inputProps: inputProps,
|
|
64
|
+
ref: inputRef,
|
|
65
|
+
placeholder: placeholder,
|
|
66
|
+
onCloseByKeyboard: (e)=>{
|
|
67
|
+
closeByKeyboardHandler(e);
|
|
68
|
+
submitNormalized();
|
|
69
|
+
},
|
|
70
|
+
isSelectInputValueAfterOpen: true
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
LabelValueLink.displayName = 'LabelValueLink';
|
|
76
|
+
export { LabelValueLink };
|