@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
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import { type ComponentPropsWithoutRef, type CSSProperties, type
|
|
1
|
+
import { type ComponentPropsWithoutRef, type CSSProperties, type HTMLAttributes, type KeyboardEventHandler, type ReactNode, type Ref } from 'react';
|
|
2
|
+
import { type ValueOf } from '../../common';
|
|
2
3
|
import { Help } from '../Help/Help';
|
|
3
|
-
|
|
4
|
-
valueNode: ReactNode;
|
|
5
|
-
isLabelOverflow: boolean;
|
|
6
|
-
valueBlockRef?: Ref<HTMLDivElement> | null;
|
|
7
|
-
onFocus: FocusEventHandler<HTMLDivElement>;
|
|
8
|
-
onBlur: FocusEventHandler<HTMLDivElement>;
|
|
9
|
-
onKeyDown: KeyboardEventHandler<HTMLDivElement>;
|
|
10
|
-
onKeyUp: KeyboardEventHandler<HTMLDivElement>;
|
|
11
|
-
}
|
|
4
|
+
import type { ValueBlockContentArgs, ValueBlockProps } from './types';
|
|
12
5
|
export interface SharedLabelValueProps extends HTMLAttributes<HTMLDivElement> {
|
|
13
6
|
label: string;
|
|
14
7
|
className?: string;
|
|
@@ -19,9 +12,15 @@ export interface SharedLabelValueProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
19
12
|
helpPopupContent?: ComponentPropsWithoutRef<typeof Help>['popup'];
|
|
20
13
|
dropdownClassName?: string;
|
|
21
14
|
dropdownStyles?: CSSProperties;
|
|
15
|
+
labelRef?: Ref<HTMLElement>;
|
|
22
16
|
valueBlockContent?: (args: ValueBlockContentArgs) => ReactNode;
|
|
23
17
|
onDropdownClose?: () => void;
|
|
24
18
|
}
|
|
19
|
+
export declare const LabelValueVariant: {
|
|
20
|
+
readonly DEFAULT: "default";
|
|
21
|
+
readonly LINK: "link";
|
|
22
|
+
};
|
|
23
|
+
export type LabelValueVariantType = ValueOf<typeof LabelValueVariant>;
|
|
25
24
|
export interface LabelValueProps extends SharedLabelValueProps {
|
|
26
25
|
renderIcon?: (params: {
|
|
27
26
|
stroke?: string;
|
|
@@ -31,12 +30,17 @@ export interface LabelValueProps extends SharedLabelValueProps {
|
|
|
31
30
|
valueBlockRef?: Ref<HTMLDivElement>;
|
|
32
31
|
customDropdown?: boolean;
|
|
33
32
|
isCustomDropdownOpen?: boolean;
|
|
33
|
+
valueVariant?: LabelValueVariantType;
|
|
34
34
|
dropdownContent?: (args: {
|
|
35
35
|
closeHandler: () => void;
|
|
36
36
|
closeByKeyboardHandler: (event: KeyboardEvent | FocusEvent) => void;
|
|
37
37
|
}) => ReactNode;
|
|
38
38
|
customDropdownTrigger?: ReactNode;
|
|
39
39
|
onValueKeyUp?: KeyboardEventHandler;
|
|
40
|
+
renderCustomValueBlock?: (props: ValueBlockProps & {
|
|
41
|
+
ref?: Ref<HTMLDivElement>;
|
|
42
|
+
}) => ReactNode;
|
|
43
|
+
iconFollowsValueHover?: boolean;
|
|
40
44
|
onDropdownClose?: () => void;
|
|
41
45
|
onDropdownOpen?: () => void;
|
|
42
46
|
}
|
|
@@ -2,16 +2,27 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useRef, useState } from "react";
|
|
3
3
|
import { cn } from "../../common/index.js";
|
|
4
4
|
import { mergeRefs } from "../../common/react/mergeRefs.js";
|
|
5
|
+
import { FieldLabel } from "../_shared/FieldLabel/FieldLabel.js";
|
|
5
6
|
import { Dropdown, useDropdown } from "../Dropdown/Dropdown.js";
|
|
6
|
-
import { FieldLabel } from "../FieldLabel/FieldLabel.js";
|
|
7
7
|
import { HelpSize } from "../Help/Help.js";
|
|
8
8
|
import { TextColor, TextVariant } from "../Text/Text.js";
|
|
9
|
+
import { useIsElementOverflowing } from "../../hooks/index.js";
|
|
10
|
+
import { ValueBlock } from "./ValueBlock/ValueBlock.js";
|
|
9
11
|
import { OPEN_BUTTONS } from "./consts.js";
|
|
10
|
-
import { ValueBlock } from "./ValueBlock/index.js";
|
|
11
12
|
import LabelValue_module from "./LabelValue.module.js";
|
|
12
|
-
const
|
|
13
|
+
const LabelValueVariant = {
|
|
14
|
+
DEFAULT: 'default',
|
|
15
|
+
LINK: 'link'
|
|
16
|
+
};
|
|
17
|
+
const variantClassNameMap = {
|
|
18
|
+
[LabelValueVariant.LINK]: LabelValue_module.containerLink
|
|
19
|
+
};
|
|
20
|
+
const LabelValue = /*#__PURE__*/ forwardRef(({ isEmpty, renderIcon, label, value, disabled, error, className, required = false, testId, helpPopupContent, valueBlockRef = null, customDropdown, isCustomDropdownOpen = false, customDropdownTrigger, labelRef, valueBlockContent, dropdownContent, onFocus, onBlur, onValueKeyUp, onDropdownClose, renderCustomValueBlock, iconFollowsValueHover = true, valueVariant = LabelValueVariant.DEFAULT, onDropdownOpen, ...props }, forwardedRef)=>{
|
|
13
21
|
const valueBlockInnerRef = useRef(null);
|
|
14
22
|
const labelValueDropdown = useDropdown();
|
|
23
|
+
const labelOverflowing = useIsElementOverflowing([
|
|
24
|
+
label
|
|
25
|
+
]);
|
|
15
26
|
const [isLabelOverflowing, setIsLabelOverflowing] = useState(false);
|
|
16
27
|
const isDropdownOpen = customDropdown ? isCustomDropdownOpen : labelValueDropdown.open;
|
|
17
28
|
const openDropdown = ()=>{
|
|
@@ -44,11 +55,33 @@ const LabelValue = /*#__PURE__*/ forwardRef(({ isEmpty, renderIcon, label, value
|
|
|
44
55
|
props.onClick?.(event);
|
|
45
56
|
openDropdown();
|
|
46
57
|
};
|
|
58
|
+
const valueBlockMergedRef = mergeRefs([
|
|
59
|
+
valueBlockRef,
|
|
60
|
+
valueBlockInnerRef
|
|
61
|
+
]);
|
|
62
|
+
const valueBlockProps = {
|
|
63
|
+
ref: valueBlockMergedRef,
|
|
64
|
+
testId,
|
|
65
|
+
value,
|
|
66
|
+
label,
|
|
67
|
+
disabled,
|
|
68
|
+
error,
|
|
69
|
+
isEmpty,
|
|
70
|
+
needShowLabelTooltip: isLabelOverflowing,
|
|
71
|
+
forceHideTooltip: isDropdownOpen,
|
|
72
|
+
onBlur,
|
|
73
|
+
onFocus,
|
|
74
|
+
onValueKeyDown: handleValueKeyDown,
|
|
75
|
+
onValueKeyUp: handleValueKeyUp,
|
|
76
|
+
renderIcon,
|
|
77
|
+
valueBlockContent,
|
|
78
|
+
isNeedShowLabelTooltip: labelOverflowing.getIsOverflowing
|
|
79
|
+
};
|
|
47
80
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
48
81
|
children: [
|
|
49
82
|
/*#__PURE__*/ jsxs("div", {
|
|
50
83
|
...props,
|
|
51
|
-
className: cn(LabelValue_module.container, className, isEmpty && LabelValue_module.empty, error && LabelValue_module.error, disabled && LabelValue_module.disabled),
|
|
84
|
+
className: cn(LabelValue_module.container, variantClassNameMap[valueVariant], iconFollowsValueHover && LabelValue_module.iconFollowsValueHover, className, isEmpty && LabelValue_module.empty, error && LabelValue_module.error, disabled && LabelValue_module.disabled),
|
|
52
85
|
ref: mergeRefs([
|
|
53
86
|
labelValueDropdown.triggerRef,
|
|
54
87
|
forwardedRef
|
|
@@ -62,7 +95,11 @@ const LabelValue = /*#__PURE__*/ forwardRef(({ isEmpty, renderIcon, label, value
|
|
|
62
95
|
children: [
|
|
63
96
|
/*#__PURE__*/ jsx(FieldLabel, {
|
|
64
97
|
label: label,
|
|
65
|
-
|
|
98
|
+
labelRef: mergeRefs([
|
|
99
|
+
labelOverflowing.ref,
|
|
100
|
+
labelRef
|
|
101
|
+
]),
|
|
102
|
+
required: required && !disabled,
|
|
66
103
|
testId: testId,
|
|
67
104
|
variant: TextVariant.caption,
|
|
68
105
|
colorToken: TextColor.secondary,
|
|
@@ -70,28 +107,12 @@ const LabelValue = /*#__PURE__*/ forwardRef(({ isEmpty, renderIcon, label, value
|
|
|
70
107
|
helpProps: helpPopupContent ? {
|
|
71
108
|
popup: helpPopupContent
|
|
72
109
|
} : void 0,
|
|
110
|
+
className: LabelValue_module.fieldLabel,
|
|
73
111
|
helpButtonClassName: LabelValue_module.helpButtonContainer,
|
|
74
112
|
helpSize: HelpSize.S
|
|
75
113
|
}),
|
|
76
|
-
/*#__PURE__*/ jsx(ValueBlock, {
|
|
77
|
-
|
|
78
|
-
valueBlockRef,
|
|
79
|
-
valueBlockInnerRef
|
|
80
|
-
]),
|
|
81
|
-
testId: testId,
|
|
82
|
-
value: value,
|
|
83
|
-
label: label,
|
|
84
|
-
disabled: disabled,
|
|
85
|
-
error: error,
|
|
86
|
-
isEmpty: isEmpty,
|
|
87
|
-
needShowLabelTooltip: isLabelOverflowing,
|
|
88
|
-
forceHideTooltip: isDropdownOpen,
|
|
89
|
-
onBlur: onBlur,
|
|
90
|
-
onFocus: onFocus,
|
|
91
|
-
onValueKeyDown: handleValueKeyDown,
|
|
92
|
-
onValueKeyUp: handleValueKeyUp,
|
|
93
|
-
renderIcon: renderIcon,
|
|
94
|
-
valueBlockContent: valueBlockContent
|
|
114
|
+
renderCustomValueBlock ? renderCustomValueBlock(valueBlockProps) : /*#__PURE__*/ jsx(ValueBlock, {
|
|
115
|
+
...valueBlockProps
|
|
95
116
|
})
|
|
96
117
|
]
|
|
97
118
|
})
|
|
@@ -124,4 +145,4 @@ const LabelValue = /*#__PURE__*/ forwardRef(({ isEmpty, renderIcon, label, value
|
|
|
124
145
|
});
|
|
125
146
|
});
|
|
126
147
|
LabelValue.displayName = 'LabelValue';
|
|
127
|
-
export { LabelValue };
|
|
148
|
+
export { LabelValue, LabelValueVariant };
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import "./LabelValue_module.css";
|
|
2
2
|
const LabelValue_module = {
|
|
3
3
|
container: "container-JJ318U",
|
|
4
|
+
valueBlock: "valueBlock-UgP3Nr",
|
|
4
5
|
disabled: "disabled-OM6bi0",
|
|
6
|
+
containerLink: "containerLink-AscQ6D",
|
|
5
7
|
error: "error-3roRLg",
|
|
6
|
-
valueBlock: "valueBlock-UgP3Nr",
|
|
7
8
|
valueText: "valueText-JIWgmB",
|
|
8
|
-
iconContainer: "iconContainer-ZsK9qp",
|
|
9
9
|
helpButtonContainer: "helpButtonContainer-C1lSsU",
|
|
10
|
+
iconContainer: "iconContainer-ZsK9qp",
|
|
11
|
+
fieldLabel: "fieldLabel-lu3Dux",
|
|
12
|
+
iconFollowsValueHover: "iconFollowsValueHover-mUM_uO",
|
|
10
13
|
labelValueBlock: "labelValueBlock-pbU3kQ",
|
|
11
14
|
empty: "empty-VyYkn0",
|
|
15
|
+
labelBlock: "labelBlock-p9nrQ3",
|
|
16
|
+
textWithRequiredMark: "textWithRequiredMark-j_8oxd",
|
|
17
|
+
labelText: "labelText-g0yIDb",
|
|
12
18
|
overflowText: "overflowText-NCe0S_",
|
|
13
|
-
hint: "hint-qf0pZB",
|
|
14
|
-
hintText: "hintText-kzd4VM",
|
|
15
19
|
hintTextWrapper: "hintTextWrapper-Hna0Tg",
|
|
20
|
+
hintText: "hintText-kzd4VM",
|
|
21
|
+
hint: "hint-qf0pZB",
|
|
16
22
|
dropdown: "dropdown-vNmAaD",
|
|
17
23
|
dropdownContent: "dropdownContent-To8e0l"
|
|
18
24
|
};
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
.container-JJ318U:not(.disabled-OM6bi0, .error-3roRLg, :active) .valueBlock-UgP3Nr:hover .valueText-JIWgmB, .container-JJ318U:not(.disabled-OM6bi0, .error-3roRLg, :active) .valueBlock-UgP3Nr:hover .iconContainer-ZsK9qp {
|
|
2
|
-
color: var(--button-primary-hover, #0b7cff);
|
|
3
|
-
}
|
|
4
|
-
|
|
5
1
|
.container-JJ318U:active .valueBlock-UgP3Nr:focus {
|
|
6
2
|
outline: none;
|
|
7
3
|
}
|
|
8
4
|
|
|
9
|
-
.container-JJ318U:active:not(.disabled-OM6bi0, .error-3roRLg, :has(.helpButtonContainer-C1lSsU:active)) .valueBlock-UgP3Nr .valueText-JIWgmB, .container-JJ318U:active:not(.disabled-OM6bi0, .error-3roRLg, :has(.helpButtonContainer-C1lSsU:active)) .valueBlock-UgP3Nr .iconContainer-ZsK9qp {
|
|
10
|
-
color: var(--button-primary-pressed, #005dc9);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
5
|
.container-JJ318U.disabled-OM6bi0 {
|
|
14
6
|
cursor: default;
|
|
15
7
|
}
|
|
@@ -19,6 +11,26 @@
|
|
|
19
11
|
box-shadow: none;
|
|
20
12
|
}
|
|
21
13
|
|
|
14
|
+
.container-JJ318U:not(.containerLink-AscQ6D):not(.disabled-OM6bi0, .error-3roRLg, :active) .valueBlock-UgP3Nr:hover .valueText-JIWgmB {
|
|
15
|
+
color: var(--button-primary-hover, #0b7cff);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.container-JJ318U:not(.containerLink-AscQ6D):active:not(.disabled-OM6bi0, .error-3roRLg, :has(.helpButtonContainer-C1lSsU:active)) .valueBlock-UgP3Nr .valueText-JIWgmB, .container-JJ318U:not(.containerLink-AscQ6D):active:not(.disabled-OM6bi0, .error-3roRLg, :has(.helpButtonContainer-C1lSsU:active)) .valueBlock-UgP3Nr .iconContainer-ZsK9qp {
|
|
19
|
+
color: var(--button-primary-pressed, #005dc9);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.container-JJ318U.containerLink-AscQ6D:not(.disabled-OM6bi0, .error-3roRLg, :active) .valueText-JIWgmB:hover {
|
|
23
|
+
color: var(--button-primary-hover, #0b7cff);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.container-JJ318U.containerLink-AscQ6D:not(.disabled-OM6bi0, .error-3roRLg) .valueText-JIWgmB:active, .container-JJ318U.containerLink-AscQ6D .fieldLabel-lu3Dux:active .valueText-JIWgmB, .container-JJ318U.containerLink-AscQ6D:not(.disabled-OM6bi0, .error-3roRLg):has(.fieldLabel-lu3Dux:active) .valueText-JIWgmB {
|
|
27
|
+
color: var(--button-primary-pressed, #005dc9);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.container-JJ318U.iconFollowsValueHover-mUM_uO:not(.disabled-OM6bi0, .error-3roRLg, :active) .valueBlock-UgP3Nr:hover .iconContainer-ZsK9qp {
|
|
31
|
+
color: var(--button-primary-hover, #0b7cff);
|
|
32
|
+
}
|
|
33
|
+
|
|
22
34
|
.labelValueBlock-pbU3kQ {
|
|
23
35
|
flex-direction: column;
|
|
24
36
|
gap: 2px;
|
|
@@ -29,9 +41,10 @@
|
|
|
29
41
|
color: var(--button-primary-normal, #036ce5);
|
|
30
42
|
}
|
|
31
43
|
|
|
32
|
-
.valueBlock-UgP3Nr:focus {
|
|
44
|
+
.valueBlock-UgP3Nr:focus-visible {
|
|
33
45
|
outline: 1px solid var(--elements-hover, #091739);
|
|
34
|
-
|
|
46
|
+
outline-offset: -1px;
|
|
47
|
+
border-radius: 2px;
|
|
35
48
|
}
|
|
36
49
|
|
|
37
50
|
.valueText-JIWgmB {
|
|
@@ -48,6 +61,27 @@
|
|
|
48
61
|
line-height: 20px;
|
|
49
62
|
}
|
|
50
63
|
|
|
64
|
+
.valueText-JIWgmB:focus-visible {
|
|
65
|
+
outline: 1px solid var(--elements-hover, #091739);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.labelBlock-p9nrQ3 {
|
|
69
|
+
justify-content: flex-start;
|
|
70
|
+
align-items: center;
|
|
71
|
+
gap: 4px;
|
|
72
|
+
display: flex;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.textWithRequiredMark-j_8oxd {
|
|
76
|
+
align-items: center;
|
|
77
|
+
display: flex;
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.labelText-g0yIDb {
|
|
82
|
+
flex: 1;
|
|
83
|
+
}
|
|
84
|
+
|
|
51
85
|
.valueBlock-UgP3Nr {
|
|
52
86
|
cursor: pointer;
|
|
53
87
|
justify-content: flex-start;
|
|
@@ -77,25 +111,25 @@
|
|
|
77
111
|
display: block;
|
|
78
112
|
}
|
|
79
113
|
|
|
80
|
-
.
|
|
81
|
-
|
|
82
|
-
align-items: center;
|
|
114
|
+
.hintTextWrapper-Hna0Tg {
|
|
115
|
+
flex-direction: column;
|
|
83
116
|
gap: 4px;
|
|
84
117
|
display: flex;
|
|
85
118
|
}
|
|
86
119
|
|
|
87
|
-
.
|
|
88
|
-
box-sizing: border-box;
|
|
120
|
+
.hintText-kzd4VM {
|
|
89
121
|
overflow-wrap: break-word;
|
|
90
|
-
max-width: 300px;
|
|
91
122
|
}
|
|
92
123
|
|
|
93
|
-
.
|
|
124
|
+
.hint-qf0pZB {
|
|
125
|
+
box-sizing: border-box;
|
|
94
126
|
overflow-wrap: break-word;
|
|
127
|
+
max-width: 300px;
|
|
95
128
|
}
|
|
96
129
|
|
|
97
|
-
.
|
|
98
|
-
|
|
130
|
+
.iconContainer-ZsK9qp {
|
|
131
|
+
justify-content: center;
|
|
132
|
+
align-items: center;
|
|
99
133
|
gap: 4px;
|
|
100
134
|
display: flex;
|
|
101
135
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { getOptionalTestId } from "../../../common/index.js";
|
|
4
|
+
import { mergeRefs } from "../../../common/react/mergeRefs.js";
|
|
5
|
+
import { useValueBlock } from "../hooks/useValueBlock.js";
|
|
6
|
+
import { ValueBlockWrapper } from "../ValueBlockWrapper.js";
|
|
7
|
+
import { ValueIcon } from "../ValueIcon.js";
|
|
8
|
+
import { ValueText } from "../ValueText.js";
|
|
9
|
+
import { ValueTextWithHint } from "../ValueTextWithHint.js";
|
|
10
|
+
const getValueTextVariant = (args)=>{
|
|
11
|
+
if (args.error) return 'critical';
|
|
12
|
+
if (args.isEmpty && !args.disabled) return 'buttonPrimary';
|
|
13
|
+
return 'primary';
|
|
14
|
+
};
|
|
15
|
+
const ValueBlock = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
16
|
+
const { isValueHintForceDisplayed, valueBlockInnerRef, valueTooltip, handleBlur, handleFocus, onHintVisibilityChange, icon, isHintVisible } = useValueBlock({
|
|
17
|
+
value: props.value,
|
|
18
|
+
forceHideTooltip: props.forceHideTooltip,
|
|
19
|
+
onBlur: props.onBlur,
|
|
20
|
+
onFocus: props.onFocus,
|
|
21
|
+
error: props.error,
|
|
22
|
+
isCustomValueBlock: !!props.valueBlockContent,
|
|
23
|
+
renderIcon: props.renderIcon,
|
|
24
|
+
disabled: props.disabled
|
|
25
|
+
});
|
|
26
|
+
const valueIcon = /*#__PURE__*/ jsx(ValueIcon, {
|
|
27
|
+
children: icon ?? null
|
|
28
|
+
});
|
|
29
|
+
const valueText = /*#__PURE__*/ jsx(ValueText, {
|
|
30
|
+
as: "span",
|
|
31
|
+
ref: valueTooltip.ref,
|
|
32
|
+
colorVariant: getValueTextVariant({
|
|
33
|
+
disabled: props.disabled,
|
|
34
|
+
error: props.error,
|
|
35
|
+
isEmpty: props.isEmpty
|
|
36
|
+
}),
|
|
37
|
+
testId: props.testId,
|
|
38
|
+
value: props.value
|
|
39
|
+
});
|
|
40
|
+
const isShowLabelTooltip = ()=>(props.isNeedShowLabelTooltip?.() && isValueHintForceDisplayed) ?? false;
|
|
41
|
+
if (props.valueBlockContent) return props.valueBlockContent({
|
|
42
|
+
valueNode: /*#__PURE__*/ jsxs(Fragment, {
|
|
43
|
+
children: [
|
|
44
|
+
valueText,
|
|
45
|
+
valueIcon
|
|
46
|
+
]
|
|
47
|
+
}),
|
|
48
|
+
isLabelOverflow: props.needShowLabelTooltip ?? false,
|
|
49
|
+
valueBlockRef: forwardedRef,
|
|
50
|
+
onBlur: handleBlur,
|
|
51
|
+
onFocus: handleFocus,
|
|
52
|
+
onKeyDown: (event)=>props.onValueKeyDown?.(event),
|
|
53
|
+
onKeyUp: (event)=>props.onValueKeyUp?.(event),
|
|
54
|
+
getIsLabelOverflow: isShowLabelTooltip
|
|
55
|
+
});
|
|
56
|
+
return /*#__PURE__*/ jsxs(ValueBlockWrapper, {
|
|
57
|
+
testId: getOptionalTestId(props.testId, 'value-block'),
|
|
58
|
+
ref: mergeRefs([
|
|
59
|
+
forwardedRef,
|
|
60
|
+
valueBlockInnerRef
|
|
61
|
+
]),
|
|
62
|
+
tabIndex: props.disabled ? void 0 : 0,
|
|
63
|
+
onFocus: handleFocus,
|
|
64
|
+
onBlur: handleBlur,
|
|
65
|
+
onKeyUp: props.onValueKeyUp,
|
|
66
|
+
onKeyDown: props.onValueKeyDown,
|
|
67
|
+
children: [
|
|
68
|
+
/*#__PURE__*/ jsx(ValueTextWithHint, {
|
|
69
|
+
isHintVisible: isHintVisible,
|
|
70
|
+
label: props.label,
|
|
71
|
+
value: props.value,
|
|
72
|
+
onHintVisibilityChange: onHintVisibilityChange,
|
|
73
|
+
testId: props.testId,
|
|
74
|
+
isShowLabelTooltip: isShowLabelTooltip,
|
|
75
|
+
children: valueText
|
|
76
|
+
}),
|
|
77
|
+
valueIcon
|
|
78
|
+
]
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
ValueBlock.displayName = 'ValueBlock';
|
|
82
|
+
export { ValueBlock };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
import { type IHasTestId } from '../../common';
|
|
3
|
+
export declare const ValueBlockWrapper: import("react").ForwardRefExoticComponent<IHasTestId & HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
children?: import("react").ReactNode | undefined;
|
|
5
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cn } from "../../common/index.js";
|
|
4
|
+
import LabelValue_module from "./LabelValue.module.js";
|
|
5
|
+
const ValueBlockWrapper = /*#__PURE__*/ forwardRef(({ children, testId, className, ...rest }, ref)=>/*#__PURE__*/ jsx("div", {
|
|
6
|
+
...rest,
|
|
7
|
+
ref: ref,
|
|
8
|
+
"data-test-id": testId,
|
|
9
|
+
className: cn(LabelValue_module.valueBlock, className),
|
|
10
|
+
children: children
|
|
11
|
+
}));
|
|
12
|
+
ValueBlockWrapper.displayName = 'ValueBlockWrapper';
|
|
13
|
+
export { ValueBlockWrapper };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../common/index.js";
|
|
3
|
+
import LabelValue_module from "./LabelValue.module.js";
|
|
4
|
+
const ValueIcon = ({ children, className, ...rest })=>/*#__PURE__*/ jsx("div", {
|
|
5
|
+
...rest,
|
|
6
|
+
className: cn(LabelValue_module.iconContainer, className),
|
|
7
|
+
children: children
|
|
8
|
+
});
|
|
9
|
+
export { ValueIcon };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ElementType } from 'react';
|
|
2
|
+
import { type ColorVariant } from '../Typography/utils';
|
|
3
|
+
type Props<T extends ElementType = ElementType> = {
|
|
4
|
+
value: string | number;
|
|
5
|
+
testId?: string;
|
|
6
|
+
colorVariant?: ColorVariant;
|
|
7
|
+
as?: T;
|
|
8
|
+
} & ComponentPropsWithoutRef<T>;
|
|
9
|
+
export declare const ValueText: import("react").ForwardRefExoticComponent<Omit<Props<ElementType>, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cn } from "../../common/index.js";
|
|
4
|
+
import { getTypographyStyle } from "../Typography/utils.js";
|
|
5
|
+
import LabelValue_module from "./LabelValue.module.js";
|
|
6
|
+
const ValueText = /*#__PURE__*/ forwardRef(({ value, testId, colorVariant, as: Component = 'span', className, style, ...restProps }, ref)=>{
|
|
7
|
+
const ComponentTag = Component;
|
|
8
|
+
return /*#__PURE__*/ jsx(ComponentTag, {
|
|
9
|
+
ref: ref,
|
|
10
|
+
className: cn(LabelValue_module.valueText, LabelValue_module.overflowText, className),
|
|
11
|
+
style: {
|
|
12
|
+
...getTypographyStyle({
|
|
13
|
+
colorVariableName: '--value-text-color',
|
|
14
|
+
colorVariant
|
|
15
|
+
}),
|
|
16
|
+
...style
|
|
17
|
+
},
|
|
18
|
+
"data-test-id": testId ? `${testId}-value` : void 0,
|
|
19
|
+
...restProps,
|
|
20
|
+
children: value
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
ValueText.displayName = 'ValueText';
|
|
24
|
+
export { ValueText };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
isHintVisible: boolean;
|
|
3
|
+
onHintVisibilityChange: (isVisible: boolean) => void;
|
|
4
|
+
value: string;
|
|
5
|
+
isShowLabelTooltip?: () => boolean;
|
|
6
|
+
label: string;
|
|
7
|
+
testId?: string;
|
|
8
|
+
hintTextClassName?: string;
|
|
9
|
+
children: JSX.Element;
|
|
10
|
+
};
|
|
11
|
+
export declare const ValueTextWithHint: ({ children, isHintVisible, onHintVisibilityChange, isShowLabelTooltip, label, testId, value, hintTextClassName, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../common/css/cn.js";
|
|
3
|
+
import { Hint } from "../Hint/Hint.js";
|
|
4
|
+
import { Text, TextColor } from "../Text/Text.js";
|
|
5
|
+
import LabelValue_module from "./LabelValue.module.js";
|
|
6
|
+
const ValueTextWithHint = ({ children, isHintVisible, onHintVisibilityChange, isShowLabelTooltip, label, testId, value, hintTextClassName })=>/*#__PURE__*/ jsx(Hint, {
|
|
7
|
+
visible: isHintVisible,
|
|
8
|
+
onVisibleChange: onHintVisibilityChange,
|
|
9
|
+
overlay: /*#__PURE__*/ jsxs("div", {
|
|
10
|
+
className: LabelValue_module.hintTextWrapper,
|
|
11
|
+
children: [
|
|
12
|
+
isShowLabelTooltip?.() && /*#__PURE__*/ jsx(Text.H4, {
|
|
13
|
+
className: LabelValue_module.hintText,
|
|
14
|
+
colorToken: TextColor.invert,
|
|
15
|
+
children: label
|
|
16
|
+
}),
|
|
17
|
+
/*#__PURE__*/ jsx(Text.Body, {
|
|
18
|
+
testId: testId ? `${testId}-value-hint-text` : void 0,
|
|
19
|
+
className: cn(LabelValue_module.hintText, hintTextClassName),
|
|
20
|
+
colorToken: TextColor.invert,
|
|
21
|
+
children: value
|
|
22
|
+
})
|
|
23
|
+
]
|
|
24
|
+
}),
|
|
25
|
+
overlayClassName: LabelValue_module.hint,
|
|
26
|
+
placement: "bottom",
|
|
27
|
+
children: children
|
|
28
|
+
});
|
|
29
|
+
export { ValueTextWithHint };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type FocusEventHandler, type ReactNode, type RefObject } from 'react';
|
|
2
|
+
type Props<T extends HTMLElement> = {
|
|
3
|
+
value: string;
|
|
4
|
+
forceHideTooltip?: boolean;
|
|
5
|
+
onBlur?: FocusEventHandler<T>;
|
|
6
|
+
onFocus?: FocusEventHandler<T>;
|
|
7
|
+
renderIcon?: (params: {
|
|
8
|
+
stroke?: string;
|
|
9
|
+
}) => ReactNode;
|
|
10
|
+
error?: boolean;
|
|
11
|
+
isCustomValueBlock?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
forceHintShowRef?: RefObject<Element>;
|
|
14
|
+
};
|
|
15
|
+
export declare const useValueBlock: <T extends HTMLElement>({ value, forceHideTooltip, onBlur, onFocus, renderIcon, isCustomValueBlock, error, disabled, forceHintShowRef, }: Props<T>) => {
|
|
16
|
+
valueBlockInnerRef: RefObject<HTMLElement>;
|
|
17
|
+
valueTooltip: {
|
|
18
|
+
ref: RefObject<HTMLElement>;
|
|
19
|
+
isOverflowing: boolean;
|
|
20
|
+
getIsOverflowing: () => boolean;
|
|
21
|
+
};
|
|
22
|
+
isValueHintForceDisplayed: boolean;
|
|
23
|
+
handleBlur: FocusEventHandler<T>;
|
|
24
|
+
handleFocus: FocusEventHandler<T>;
|
|
25
|
+
onHintVisibilityChange: (isVisible: boolean) => void;
|
|
26
|
+
icon: ReactNode;
|
|
27
|
+
isHintVisible: boolean;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { useIsElementOverflowing } from "../../../hooks/useIsElementOverflowing/index.js";
|
|
3
|
+
const ERROR_ICON_STROKE = 'var(--elements-critical, rgba(229, 3, 71, 1))';
|
|
4
|
+
const DISABLED_ICON_STROKE = 'var(--elements-hover, rgb(9, 23, 57, 100%))';
|
|
5
|
+
const getIconStroke = (args)=>{
|
|
6
|
+
if (args.isCustomValueBlock) return;
|
|
7
|
+
if (args.disabled) return DISABLED_ICON_STROKE;
|
|
8
|
+
if (args.error) return ERROR_ICON_STROKE;
|
|
9
|
+
};
|
|
10
|
+
const useValueBlock = ({ value, forceHideTooltip, onBlur, onFocus, renderIcon, isCustomValueBlock = false, error = false, disabled = false, forceHintShowRef })=>{
|
|
11
|
+
const focusTooltipTimeout = useRef();
|
|
12
|
+
const valueBlockInnerRef = useRef(null);
|
|
13
|
+
const valueOverflowing = useIsElementOverflowing([
|
|
14
|
+
value
|
|
15
|
+
]);
|
|
16
|
+
const [isValueHintForceDisplayed, setIsValueHintForceDisplayed] = useState(false);
|
|
17
|
+
const [isTooltipVisible, setIsTooltipVisible] = useState(false);
|
|
18
|
+
useEffect(()=>{
|
|
19
|
+
if (forceHideTooltip) setIsTooltipVisible(false);
|
|
20
|
+
}, [
|
|
21
|
+
forceHideTooltip
|
|
22
|
+
]);
|
|
23
|
+
useEffect(()=>{
|
|
24
|
+
if (!valueOverflowing.isOverflowing) setIsTooltipVisible(false);
|
|
25
|
+
}, [
|
|
26
|
+
valueOverflowing.isOverflowing
|
|
27
|
+
]);
|
|
28
|
+
const showValueTooltipOnFocus = (options = {})=>{
|
|
29
|
+
const { isForceShow = false } = options;
|
|
30
|
+
const isValueFocused = valueBlockInnerRef.current?.matches(':focus-visible') || isForceShow;
|
|
31
|
+
if (isValueFocused && valueOverflowing.getIsOverflowing()) setIsValueHintForceDisplayed(true);
|
|
32
|
+
};
|
|
33
|
+
const handleBlur = (event)=>{
|
|
34
|
+
onBlur?.(event);
|
|
35
|
+
setIsValueHintForceDisplayed(false);
|
|
36
|
+
};
|
|
37
|
+
const handleFocus = (event)=>{
|
|
38
|
+
onFocus?.(event);
|
|
39
|
+
focusTooltipTimeout.current = setTimeout(()=>{
|
|
40
|
+
const forceShow = forceHintShowRef?.current?.matches?.(':focus-visible');
|
|
41
|
+
showValueTooltipOnFocus({
|
|
42
|
+
isForceShow: forceShow
|
|
43
|
+
});
|
|
44
|
+
}, 800);
|
|
45
|
+
};
|
|
46
|
+
useEffect(()=>()=>{
|
|
47
|
+
if (focusTooltipTimeout.current) clearTimeout(focusTooltipTimeout.current);
|
|
48
|
+
}, []);
|
|
49
|
+
const onHintVisibilityChange = (isVisible)=>{
|
|
50
|
+
if (isValueHintForceDisplayed) return void setIsTooltipVisible(false);
|
|
51
|
+
setIsTooltipVisible(valueOverflowing.getIsOverflowing() && isVisible);
|
|
52
|
+
};
|
|
53
|
+
const icon = renderIcon ? renderIcon({
|
|
54
|
+
stroke: getIconStroke({
|
|
55
|
+
error,
|
|
56
|
+
isCustomValueBlock,
|
|
57
|
+
disabled
|
|
58
|
+
})
|
|
59
|
+
}) : null;
|
|
60
|
+
const isHintVisible = isTooltipVisible || isValueHintForceDisplayed;
|
|
61
|
+
return {
|
|
62
|
+
valueBlockInnerRef,
|
|
63
|
+
valueTooltip: valueOverflowing,
|
|
64
|
+
isValueHintForceDisplayed,
|
|
65
|
+
handleBlur,
|
|
66
|
+
handleFocus,
|
|
67
|
+
onHintVisibilityChange,
|
|
68
|
+
icon,
|
|
69
|
+
isHintVisible
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
export { useValueBlock };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FocusEventHandler, KeyboardEventHandler, ReactNode, Ref } from 'react';
|
|
2
2
|
export interface ValueBlockContentArgs {
|
|
3
3
|
valueNode: ReactNode;
|
|
4
4
|
isLabelOverflow: boolean;
|
|
@@ -7,15 +7,20 @@ export interface ValueBlockContentArgs {
|
|
|
7
7
|
onBlur: FocusEventHandler<HTMLDivElement>;
|
|
8
8
|
onKeyDown: KeyboardEventHandler<HTMLDivElement>;
|
|
9
9
|
onKeyUp: KeyboardEventHandler<HTMLDivElement>;
|
|
10
|
+
getIsLabelOverflow: () => boolean;
|
|
10
11
|
}
|
|
11
|
-
interface ValueBlockProps {
|
|
12
|
+
export interface ValueBlockProps {
|
|
12
13
|
value: string;
|
|
13
14
|
error?: boolean;
|
|
14
15
|
isEmpty?: boolean;
|
|
15
16
|
disabled?: boolean;
|
|
16
17
|
testId?: string;
|
|
17
18
|
label: string;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated use isNeedShowLabelTooltip
|
|
21
|
+
*/
|
|
18
22
|
needShowLabelTooltip?: boolean;
|
|
23
|
+
isNeedShowLabelTooltip?: () => boolean;
|
|
19
24
|
forceHideTooltip: boolean;
|
|
20
25
|
onFocus?: FocusEventHandler<HTMLDivElement>;
|
|
21
26
|
onBlur?: FocusEventHandler<HTMLDivElement>;
|
|
@@ -25,6 +30,5 @@ interface ValueBlockProps {
|
|
|
25
30
|
valueBlockContent?: (args: ValueBlockContentArgs) => ReactNode;
|
|
26
31
|
onValueKeyUp?: KeyboardEventHandler<HTMLDivElement>;
|
|
27
32
|
onValueKeyDown?: KeyboardEventHandler<HTMLDivElement>;
|
|
33
|
+
isDefaultValue?: boolean;
|
|
28
34
|
}
|
|
29
|
-
export declare const ValueBlock: import("react").ForwardRefExoticComponent<ValueBlockProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
30
|
-
export {};
|
|
File without changes
|