@sberbusiness/triplex-next 1.45.0 → 1.47.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/chunks/{AlertProcessSpoiler-54gQMEAr.js → AlertProcessSpoiler-Bws9nhT_.js} +17 -17
- package/chunks/{AlertProcessSpoiler-54gQMEAr.js.map → AlertProcessSpoiler-Bws9nhT_.js.map} +1 -1
- package/chunks/{CalendarViewItem-cQjxsIMh.js → CalendarViewItem-Bikp6svb.js} +21 -21
- package/chunks/{CalendarViewItem-cQjxsIMh.js.map → CalendarViewItem-Bikp6svb.js.map} +1 -1
- package/chunks/Card.module-BX03G_qX.js +32 -0
- package/chunks/Card.module-BX03G_qX.js.map +1 -0
- package/chunks/Carousel.module-Doem7_zb.js +30 -0
- package/chunks/Carousel.module-Doem7_zb.js.map +1 -0
- package/chunks/CheckboxTreeExtended.module-Bn7_t4on.js +24 -0
- package/chunks/CheckboxTreeExtended.module-Bn7_t4on.js.map +1 -0
- package/chunks/{Chip-CWaqKk62.js → Chip-DNn2jKWv.js} +17 -17
- package/chunks/{Chip-CWaqKk62.js.map → Chip-DNn2jKWv.js.map} +1 -1
- package/chunks/Confirm.module-Cu7K98Sg.js +24 -0
- package/chunks/Confirm.module-Cu7K98Sg.js.map +1 -0
- package/chunks/{DropdownListItem-kMroiHoh.js → DropdownListItem-B9cIx_8A.js} +11 -11
- package/chunks/{DropdownListItem-kMroiHoh.js.map → DropdownListItem-B9cIx_8A.js.map} +1 -1
- package/chunks/DropdownMobile.module-DnkRPsic.js +40 -0
- package/chunks/DropdownMobile.module-DnkRPsic.js.map +1 -0
- package/chunks/Footer.module-_S9ZcA7b.js +12 -0
- package/chunks/Footer.module-_S9ZcA7b.js.map +1 -0
- package/chunks/{HeaderLayoutSidebar.module-k_1rIXs0.js → HeaderLayoutSidebar.module-CNgPkokh.js} +4 -4
- package/chunks/HeaderLayoutSidebar.module-CNgPkokh.js.map +1 -0
- package/chunks/HeaderTabs.module-2XAHGidd.js +12 -0
- package/chunks/HeaderTabs.module-2XAHGidd.js.map +1 -0
- package/chunks/{HeaderTitle.module-BbIcVzwx.js → HeaderTitle.module-CFABp2sW.js} +4 -4
- package/chunks/HeaderTitle.module-CFABp2sW.js.map +1 -0
- package/chunks/ImageGalleryExtendedMain.module-DfFkrw4n.js +28 -0
- package/chunks/ImageGalleryExtendedMain.module-DfFkrw4n.js.map +1 -0
- package/chunks/{ImageGalleryExtendedThumb-DlJrbeiX.js → ImageGalleryExtendedThumb-Bm2vFDwB.js} +6 -6
- package/chunks/{ImageGalleryExtendedThumb-DlJrbeiX.js.map → ImageGalleryExtendedThumb-Bm2vFDwB.js.map} +1 -1
- package/chunks/IslandAccordion.module-CARpAvhk.js +44 -0
- package/chunks/IslandAccordion.module-CARpAvhk.js.map +1 -0
- package/chunks/IslandWidgetFooter.module-E0IBRK6A.js +18 -0
- package/chunks/IslandWidgetFooter.module-E0IBRK6A.js.map +1 -0
- package/chunks/IslandWidgetHeader.module-DgysHiDv.js +28 -0
- package/chunks/IslandWidgetHeader.module-DgysHiDv.js.map +1 -0
- package/chunks/{LightBoxContent-DDevHCAQ.js → LightBoxContent-b3ATzdz4.js} +17 -17
- package/chunks/{LightBoxContent-DDevHCAQ.js.map → LightBoxContent-b3ATzdz4.js.map} +1 -1
- package/chunks/LightBoxControls.module-CFiw2WEe.js +26 -0
- package/chunks/LightBoxControls.module-CFiw2WEe.js.map +1 -0
- package/chunks/{LightBoxSideOverlayClose.module-B_RmH_Zj.js → LightBoxSideOverlayClose.module-rUoDHQx6.js} +4 -4
- package/chunks/LightBoxSideOverlayClose.module-rUoDHQx6.js.map +1 -0
- package/chunks/{ListItemControlsButton-BGHyQIXE.js → ListItemControlsButton-DATlwch8.js} +10 -10
- package/chunks/{ListItemControlsButton-BGHyQIXE.js.map → ListItemControlsButton-DATlwch8.js.map} +1 -1
- package/chunks/ListItemTail.module-DEbIYD0x.js +18 -0
- package/chunks/ListItemTail.module-DEbIYD0x.js.map +1 -0
- package/chunks/ListMasterFooter.module-Dw_g_Hqv.js +14 -0
- package/chunks/ListMasterFooter.module-Dw_g_Hqv.js.map +1 -0
- package/chunks/ModalWindow.module-BIeL2Dm9.js +28 -0
- package/chunks/ModalWindow.module-BIeL2Dm9.js.map +1 -0
- package/chunks/Notification.module-CAVClo9k.js +34 -0
- package/chunks/Notification.module-CAVClo9k.js.map +1 -0
- package/chunks/Overlay.module-dRFf4RgK.js +30 -0
- package/chunks/Overlay.module-dRFf4RgK.js.map +1 -0
- package/chunks/Page.module-Bq4qHw4a.js +17 -0
- package/chunks/Page.module-Bq4qHw4a.js.map +1 -0
- package/chunks/SMSField.module-BFaDeCmy.js +30 -0
- package/chunks/SMSField.module-BFaDeCmy.js.map +1 -0
- package/chunks/SliderExtendedMarks.module-I5oq_ntW.js +24 -0
- package/chunks/SliderExtendedMarks.module-I5oq_ntW.js.map +1 -0
- package/chunks/{SliderExtendedRail-VEYm3CWM.js → SliderExtendedRail-CQjM0BDm.js} +7 -7
- package/chunks/SliderExtendedRail-CQjM0BDm.js.map +1 -0
- package/chunks/StatusTracker.module-CLL7XYcX.js +44 -0
- package/chunks/StatusTracker.module-CLL7XYcX.js.map +1 -0
- package/chunks/{StepperStepArrowBorder-B8OziF77.js → StepperStepArrowBorder-DDMmOSKy.js} +16 -16
- package/chunks/{StepperStepArrowBorder-B8OziF77.js.map → StepperStepArrowBorder-DDMmOSKy.js.map} +1 -1
- package/chunks/{SuggestFieldMobileDropdownHint-CEHlClB5.js → SuggestFieldMobileDropdownHint-BESIIDZs.js} +3 -3
- package/chunks/{SuggestFieldMobileDropdownHint-CEHlClB5.js.map → SuggestFieldMobileDropdownHint-BESIIDZs.js.map} +1 -1
- package/chunks/TableFooter.module-DyFW1z3j.js +22 -0
- package/chunks/TableFooter.module-DyFW1z3j.js.map +1 -0
- package/chunks/TabsExtended.module-DPptPKmZ.js +26 -0
- package/chunks/TabsExtended.module-DPptPKmZ.js.map +1 -0
- package/chunks/TabsLine.module-BOD6aGpU.js +36 -0
- package/chunks/TabsLine.module-BOD6aGpU.js.map +1 -0
- package/chunks/TooltipDesktop.module-_lk-8WZV.js +32 -0
- package/chunks/TooltipDesktop.module-_lk-8WZV.js.map +1 -0
- package/chunks/TreeView.module-mCVJ7u_z.js +12 -0
- package/chunks/TreeView.module-mCVJ7u_z.js.map +1 -0
- package/chunks/{UploadZoneInput-DW4bcKms.js → UploadZoneInput-1DuaS4IR.js} +6 -6
- package/chunks/{UploadZoneInput-DW4bcKms.js.map → UploadZoneInput-1DuaS4IR.js.map} +1 -1
- package/chunks/{constants-C-g_SxPw.js → constants-DUgeKsf9.js} +27 -27
- package/chunks/{constants-C-g_SxPw.js.map → constants-DUgeKsf9.js.map} +1 -1
- package/chunks/{utils-vSmFPvz4.js → utils-CvDoNsRH.js} +10 -10
- package/chunks/{utils-vSmFPvz4.js.map → utils-CvDoNsRH.js.map} +1 -1
- package/chunks/{utils-oLO5Fak1.js → utils-DhEse9-I.js} +6 -6
- package/chunks/{utils-oLO5Fak1.js.map → utils-DhEse9-I.js.map} +1 -1
- package/chunks/{utils-CRgskx0c.js → utils-c0Fgm-SD.js} +27 -27
- package/chunks/{utils-CRgskx0c.js.map → utils-c0Fgm-SD.js.map} +1 -1
- package/chunks/{utils-DogucNlz.js → utils-tt7vKg1E.js} +11 -11
- package/chunks/{utils-DogucNlz.js.map → utils-tt7vKg1E.js.map} +1 -1
- package/chunks/{vendor-D4wvHis9.js → vendor-CUIykw0y.js} +10 -5517
- package/chunks/vendor-CUIykw0y.js.map +1 -0
- package/components/AbstractTree/AbstractTreeNode.js +1 -1
- package/components/AccordionBase/protected/AccordionBase.js +1 -1
- package/components/Alert/AlertContext/AlertContext.js +8 -8
- package/components/Alert/AlertProcess/AlertProcess.js +3 -3
- package/components/Alert/AlertProcess/components/AlertProcessSpoiler.js +2 -2
- package/components/Amount/Amount.js +3 -3
- package/components/AmountField/AmountBaseInputCore.js +2 -2
- package/components/AmountField/AmountBaseInputCore.js.map +1 -1
- package/components/AmountField/AmountBaseInputFormatter.js +7 -10
- package/components/AmountField/AmountBaseInputFormatter.js.map +1 -1
- package/components/AmountField/AmountBaseInputParser.js +9 -13
- package/components/AmountField/AmountBaseInputParser.js.map +1 -1
- package/components/AmountField/AmountField.js +38 -55
- package/components/AmountField/AmountField.js.map +1 -1
- package/components/AmountField/utils.js +12 -2
- package/components/AmountField/utils.js.map +1 -1
- package/components/Avatar/Avatar.js +14 -14
- package/components/Avatar/Avatar.js.map +1 -1
- package/components/Avatar/enums.js.map +1 -1
- package/components/Badge/Badge.js +5 -5
- package/components/Badge/BadgeDot.js +5 -5
- package/components/Badge/components/BadgeContent.js +7 -7
- package/components/Badge/components/BadgePostfix.js +2 -2
- package/components/Badge/components/BadgePrefix.js +2 -2
- package/components/Body/Body.js +4 -4
- package/components/Button/Button.js +21 -21
- package/components/Button/ButtonBase.js +1 -1
- package/components/Button/ButtonDropdown.js +9 -9
- package/components/Button/ButtonDropdownExtended.js +3 -3
- package/components/Button/ButtonIcon.js +4 -4
- package/components/Calendar/Calendar.js +5 -5
- package/components/Calendar/components/CalendarControls.js +1 -1
- package/components/Calendar/components/CalendarFooter.js +2 -2
- package/components/Calendar/components/CalendarViewDays.js +2 -2
- package/components/Calendar/components/CalendarViewItem.js +2 -2
- package/components/Calendar/components/CalendarViewMonths.js +1 -1
- package/components/Calendar/components/CalendarViewYears.js +1 -1
- package/components/Card/CardAction.js +24 -10
- package/components/Card/CardAction.js.map +1 -1
- package/components/Card/CardStatic.js +26 -26
- package/components/Card/CardStatic.js.map +1 -1
- package/components/Card/components/CardContent/CardContent.js +2 -2
- package/components/Card/components/CardContent/CardContent.js.map +1 -1
- package/components/Card/components/CardContent/components/CardContentBody.js +2 -2
- package/components/Card/components/CardContent/components/CardContentFooter.js +2 -2
- package/components/Card/components/CardContent/components/CardContentHeader.js +2 -2
- package/components/Card/components/CardMedia.js +2 -2
- package/components/Card/utils.js +1 -1
- package/components/Carousel/Carousel.js +2 -2
- package/components/Carousel/CarouselButton.js +2 -2
- package/components/Carousel/CarouselIndicators.js +65 -30
- package/components/Carousel/CarouselIndicators.js.map +1 -1
- package/components/Carousel/CarouselItem.js +2 -2
- package/components/Carousel/CarouselTrack.js +2 -2
- package/components/Carousel/CarouselViewport.js +2 -2
- package/components/CarouselExtended/CarouselExtended.js +2 -2
- package/components/Checkbox/Checkbox.js +11 -11
- package/components/Checkbox/CheckboxXGroup.js +9 -9
- package/components/Checkbox/CheckboxYGroup.js +2 -2
- package/components/CheckboxTree/CheckboxTree.js +34 -35
- package/components/CheckboxTree/CheckboxTree.js.map +1 -1
- package/components/CheckboxTree/utils.js +18 -11
- package/components/CheckboxTree/utils.js.map +1 -1
- package/components/CheckboxTreeExtended/CheckboxTreeExtended.js +22 -9
- package/components/CheckboxTreeExtended/CheckboxTreeExtended.js.map +1 -1
- package/components/CheckboxTreeExtended/components/CheckboxTreeExtendedArrow.js +1 -1
- package/components/CheckboxTreeExtended/components/CheckboxTreeExtendedCheckbox.js +2 -2
- package/components/CheckboxTreeExtended/components/CheckboxTreeExtendedNode.js +2 -2
- package/components/Chip/Chip.js +2 -2
- package/components/Chip/ChipClearButton.js +2 -2
- package/components/Chip/ChipDatePicker/ChipDatePicker.js +1 -1
- package/components/Chip/ChipDatePicker/ChipDatePickerTarget.js +1 -1
- package/components/Chip/ChipDropdownArrow.js +3 -3
- package/components/Chip/ChipIcon.js +1 -1
- package/components/Chip/ChipMonthYearPicker/ChipMonthYearPicker.js +70 -0
- package/components/Chip/ChipMonthYearPicker/ChipMonthYearPicker.js.map +1 -0
- package/components/Chip/ChipMonthYearPicker/ChipMonthYearPickerTarget.js +72 -0
- package/components/Chip/ChipMonthYearPicker/ChipMonthYearPickerTarget.js.map +1 -0
- package/components/Chip/ChipMonthYearPicker/index.js +7 -0
- package/components/Chip/ChipMonthYearPicker/index.js.map +1 -0
- package/components/Chip/ChipMultiselect.js +15 -12
- package/components/Chip/ChipMultiselect.js.map +1 -1
- package/components/Chip/ChipOptions.js +29 -7
- package/components/Chip/ChipOptions.js.map +1 -1
- package/components/Chip/ChipSelect/ChipSelect.js +2 -2
- package/components/Chip/ChipSelect/ChipSelectTarget.js +1 -1
- package/components/Chip/ChipSort.js +13 -6
- package/components/Chip/ChipSort.js.map +1 -1
- package/components/Chip/ChipSuggest/ChipSuggest.js +24 -12
- package/components/Chip/ChipSuggest/ChipSuggest.js.map +1 -1
- package/components/Chip/ChipSuggest/ChipSuggestDropdown.js +12 -12
- package/components/Chip/ChipSuggest/ChipSuggestDropdown.js.map +1 -1
- package/components/Chip/ChipSuggest/ChipSuggestTarget.js +3 -9
- package/components/Chip/ChipSuggest/ChipSuggestTarget.js.map +1 -1
- package/components/Chip/ChipSuggest/desktop/ChipSuggestDesktopDropdownField.js +4 -3
- package/components/Chip/ChipSuggest/desktop/ChipSuggestDesktopDropdownField.js.map +1 -1
- package/components/Chip/index.js +5 -1
- package/components/Chip/index.js.map +1 -1
- package/components/ChipGroup/ChipGroup.js +8 -8
- package/components/Col/Col.js +133 -133
- package/components/CollapsibleTree/CollapsibleTree.js +2 -2
- package/components/CollapsibleTree/components/CollapsibleTreeLeafContent.js +2 -2
- package/components/CollapsibleTree/components/CollapsibleTreeLeafNode.js +2 -2
- package/components/CollapsibleTree/components/CollapsibleTreeNodeHeader.js +5 -5
- package/components/CollapsibleTreeExtended/CollapsibleTreeExtended.js +7 -2
- package/components/CollapsibleTreeExtended/CollapsibleTreeExtended.js.map +1 -1
- package/components/CollapsibleTreeExtended/components/CollapsibleTreeExtendedNode.js +2 -2
- package/components/Confirm/Confirm.js +22 -19
- package/components/Confirm/Confirm.js.map +1 -1
- package/components/Confirm/components/ConfirmClose.js +21 -7
- package/components/Confirm/components/ConfirmClose.js.map +1 -1
- package/components/Confirm/components/ConfirmCloseButton.js +4 -4
- package/components/Confirm/components/ConfirmCloseButton.js.map +1 -1
- package/components/Confirm/components/ConfirmContent.js +10 -5
- package/components/Confirm/components/ConfirmContent.js.map +1 -1
- package/components/Confirm/components/ConfirmContentSubTitle.js +4 -5
- package/components/Confirm/components/ConfirmContentSubTitle.js.map +1 -1
- package/components/Confirm/components/ConfirmContentTitle.js +6 -8
- package/components/Confirm/components/ConfirmContentTitle.js.map +1 -1
- package/components/Confirm/components/ConfirmControls.js +6 -3
- package/components/Confirm/components/ConfirmControls.js.map +1 -1
- package/components/Confirm/enums.js.map +1 -1
- package/components/DateField/DateField.js +43 -43
- package/components/DateField/DateField.js.map +1 -1
- package/components/DateField/DateFieldContext.js.map +1 -1
- package/components/DateField/DateFieldTarget.js +6 -5
- package/components/DateField/DateFieldTarget.js.map +1 -1
- package/components/DatePickerExtended/DatePickerExtended.js +2 -2
- package/components/DatePickerExtended/DatePickerExtended.js.map +1 -1
- package/components/DatePickerExtended/DatePickerExtendedDropdown.js +2 -2
- package/components/DateRange/DateRange.js +69 -82
- package/components/DateRange/DateRange.js.map +1 -1
- package/components/DateRange/types.js +2 -0
- package/components/DateRange/types.js.map +1 -0
- package/components/DateRange/utils.js +8 -0
- package/components/DateRange/utils.js.map +1 -0
- package/components/DesignTokens/DesignTokenUtils.js +2 -2
- package/components/DesignTokens/components/Step.js +1 -1
- package/components/DesignTokens/components/Step.js.map +1 -1
- package/components/Divider/Divider.js +18 -18
- package/components/DocumentNumberEdit/DocumentNumberEdit.js +4 -4
- package/components/Dropdown/desktop/DropdownDesktop.js +7 -7
- package/components/Dropdown/desktop/DropdownList.js +2 -2
- package/components/Dropdown/desktop/DropdownListItem.js +2 -2
- package/components/Dropdown/desktop/index.js +1 -1
- package/components/Dropdown/index.js +1 -1
- package/components/Dropdown/mobile/DropdownMobile.js +2 -2
- package/components/Dropdown/mobile/DropdownMobileBody.js +2 -2
- package/components/Dropdown/mobile/DropdownMobileClose.js +2 -2
- package/components/Dropdown/mobile/DropdownMobileFooter.js +2 -2
- package/components/Dropdown/mobile/DropdownMobileHeader.js +2 -2
- package/components/Dropdown/mobile/DropdownMobileInner.js +2 -2
- package/components/Dropdown/mobile/DropdownMobileInput.js +2 -2
- package/components/Dropdown/mobile/DropdownMobileList.js +2 -2
- package/components/Dropdown/mobile/DropdownMobileListItem.js +2 -2
- package/components/Dropdown/mobile/DropdownMobileLoader.js +2 -2
- package/components/Dropdown/mobile/DropdownMobileMaskedInput.js +2 -2
- package/components/Ellipsis/Ellipsis.js +4 -4
- package/components/EmptyView/EmptyView.js +5 -5
- package/components/ExpandAnimation/ExpandAnimation.js +2 -2
- package/components/FocusTrapExtended/FocusTrapExtended.js +1 -1
- package/components/Footer/Footer.js +1 -1
- package/components/Footer/components/FooterDescription.js +2 -2
- package/components/Footer/components/FooterDescriptionContent.js +2 -2
- package/components/Footer/components/FooterDescriptionControls.js +2 -2
- package/components/FormField/FormField.js +12 -12
- package/components/FormField/FormFieldContext.js.map +1 -1
- package/components/FormField/components/FormFieldClear.js +2 -2
- package/components/FormField/components/FormFieldCounter.js +2 -2
- package/components/FormField/components/FormFieldDescription.js +3 -3
- package/components/FormField/components/FormFieldInput.js +6 -5
- package/components/FormField/components/FormFieldInput.js.map +1 -1
- package/components/FormField/components/FormFieldLabel.js +21 -9
- package/components/FormField/components/FormFieldLabel.js.map +1 -1
- package/components/FormField/components/FormFieldMaskedInput.js +29 -35
- package/components/FormField/components/FormFieldMaskedInput.js.map +1 -1
- package/components/FormField/components/FormFieldPostfix.js +2 -2
- package/components/FormField/components/FormFieldPrefix.js +2 -2
- package/components/FormField/components/FormFieldTarget.js +10 -13
- package/components/FormField/components/FormFieldTarget.js.map +1 -1
- package/components/FormField/components/FormFieldTextarea.js +6 -5
- package/components/FormField/components/FormFieldTextarea.js.map +1 -1
- package/components/FormField/components/useFormFieldAffixWidth.js +1 -1
- package/components/FormField/components/useFormFieldAffixWidth.js.map +1 -1
- package/components/FormField/components/utils.js +1 -9
- package/components/FormField/components/utils.js.map +1 -1
- package/components/Gap/Gap.js +9 -9
- package/components/Header/Header.js +1 -1
- package/components/Header/components/HeaderLayoutSidebar/HeaderLayoutSidebar.js +2 -2
- package/components/Header/components/HeaderLayoutSidebar/HeaderLayoutSidebarContent.js +2 -2
- package/components/Header/components/HeaderLayoutSidebar/HeaderLayoutSidebarSidebar.js +2 -2
- package/components/Header/components/HeaderSubheader/HeaderSubheader.js +3 -3
- package/components/Header/components/HeaderTabs/HeaderTabs.js +2 -2
- package/components/Header/components/HeaderTabs/HeaderTabsContent.js +2 -2
- package/components/Header/components/HeaderTabs/HeaderTabsControls.js +2 -2
- package/components/Header/components/HeaderTitle/HeaderTitle.js +2 -2
- package/components/Header/components/HeaderTitle/HeaderTitleContent.js +2 -2
- package/components/Header/components/HeaderTitle/HeaderTitleControls.js +2 -2
- package/components/HelpBox/HelpBox.js +53 -45
- package/components/HelpBox/HelpBox.js.map +1 -1
- package/components/IconWrapper/IconWrapper.js +3 -3
- package/components/ImageGallery/ImageGallery.js +1 -1
- package/components/ImageGalleryExtended/ImageGalleryExtended.js +3 -3
- package/components/ImageGalleryExtended/components/ImageGalleryExtendedArrow.js +2 -2
- package/components/ImageGalleryExtended/components/ImageGalleryExtendedDots.js +4 -4
- package/components/ImageGalleryExtended/components/ImageGalleryExtendedMain.js +2 -2
- package/components/ImageGalleryExtended/components/ImageGalleryExtendedSlide.js +2 -2
- package/components/ImageGalleryExtended/components/ImageGalleryExtendedSwipeTrack.js +2 -2
- package/components/ImageGalleryExtended/components/ImageGalleryExtendedThumb.js +2 -2
- package/components/ImageGalleryExtended/components/ImageGalleryExtendedThumbnails.js +2 -2
- package/components/ImageGalleryExtended/components/index.js +1 -1
- package/components/ImageGalleryExtended/index.js +1 -1
- package/components/Island/Island.js +2 -2
- package/components/Island/components/IslandBody.js +2 -2
- package/components/Island/components/IslandFooter.js +2 -2
- package/components/Island/components/IslandHeader.js +2 -2
- package/components/Island/utils.js +1 -1
- package/components/IslandAccordion/IslandAccordion.js +3 -3
- package/components/IslandAccordion/IslandAccordion.js.map +1 -1
- package/components/IslandAccordion/IslandAccordionContext.js.map +1 -1
- package/components/IslandAccordion/components/IslandAccordionContent.js +1 -1
- package/components/IslandAccordion/components/IslandAccordionContent.js.map +1 -1
- package/components/IslandAccordion/components/IslandAccordionFooter.js +2 -2
- package/components/IslandAccordion/components/IslandAccordionFooter.js.map +1 -1
- package/components/IslandAccordion/components/IslandAccordionItem.js +17 -20
- package/components/IslandAccordion/components/IslandAccordionItem.js.map +1 -1
- package/components/IslandWidget/IslandWidget.js +18 -15
- package/components/IslandWidget/IslandWidget.js.map +1 -1
- package/components/IslandWidget/IslandWidgetContext.js.map +1 -1
- package/components/IslandWidget/IslandWidgetLayoutContext.js +3 -1
- package/components/IslandWidget/IslandWidgetLayoutContext.js.map +1 -1
- package/components/IslandWidget/components/IslandWidgetBody.js +5 -5
- package/components/IslandWidget/components/IslandWidgetBody.js.map +1 -1
- package/components/IslandWidget/components/IslandWidgetExtraFooter.js +10 -6
- package/components/IslandWidget/components/IslandWidgetExtraFooter.js.map +1 -1
- package/components/IslandWidget/components/IslandWidgetFooter.js +2 -2
- package/components/IslandWidget/components/IslandWidgetFooter.js.map +1 -1
- package/components/IslandWidget/components/IslandWidgetFooterContent.js +4 -2
- package/components/IslandWidget/components/IslandWidgetFooterContent.js.map +1 -1
- package/components/IslandWidget/components/IslandWidgetFooterControls.js +4 -2
- package/components/IslandWidget/components/IslandWidgetFooterControls.js.map +1 -1
- package/components/IslandWidget/components/IslandWidgetHeader.js +12 -7
- package/components/IslandWidget/components/IslandWidgetHeader.js.map +1 -1
- package/components/IslandWidget/components/IslandWidgetHeaderContent.js +2 -3
- package/components/IslandWidget/components/IslandWidgetHeaderContent.js.map +1 -1
- package/components/IslandWidget/components/IslandWidgetHeaderControls.js +2 -2
- package/components/IslandWidget/components/IslandWidgetHeaderControls.js.map +1 -1
- package/components/IslandWidget/components/IslandWidgetHeaderDescription.js +2 -2
- package/components/IslandWidget/components/IslandWidgetHeaderDescription.js.map +1 -1
- package/components/IslandWidget/components/IslandWidgetHeaderTitle.js +2 -2
- package/components/IslandWidget/components/IslandWidgetHeaderTitle.js.map +1 -1
- package/components/IslandWidget/components/IslandWidgetWrapper.js +15 -5
- package/components/IslandWidget/components/IslandWidgetWrapper.js.map +1 -1
- package/components/LightBox/LightBox.js +6 -6
- package/components/LightBox/LightBoxContent.js +2 -2
- package/components/LightBox/LightBoxControls/LightBoxArrow.js +2 -2
- package/components/LightBox/LightBoxControls/LightBoxClose.js +2 -2
- package/components/LightBox/LightBoxControls/LightBoxControls.js +2 -2
- package/components/LightBox/LightBoxControls/LightBoxNext.js +2 -2
- package/components/LightBox/LightBoxControls/LightBoxPrev.js +2 -2
- package/components/LightBox/LightBoxSideOverlay/LightBoxSideOverlay.js +13 -13
- package/components/LightBox/LightBoxSideOverlay/LightBoxSideOverlayCloseDesktop.js +2 -2
- package/components/LightBox/LightBoxSideOverlay/LightBoxSideOverlayCloseMobile.js +2 -2
- package/components/LightBox/LightBoxSideOverlay/LightBoxSideOverlayLoader.js +1 -1
- package/components/LightBox/LightBoxSidebars/LightBoxLeftSidebar.js +4 -4
- package/components/LightBox/LightBoxSidebars/LightBoxRightSidebar.js +4 -4
- package/components/LightBox/LightBoxViewManager/LightBoxViewManager.js +1 -1
- package/components/Link/Link.js +6 -6
- package/components/List/List.js +4 -4
- package/components/List/ListSortable.js +1 -1
- package/components/List/components/ListActionItem.js +2 -2
- package/components/List/components/ListEmptyState.js +2 -2
- package/components/List/components/ListItem.js +1 -1
- package/components/List/components/ListItemContent.js +5 -5
- package/components/List/components/ListItemControls.js +2 -2
- package/components/List/components/ListItemControlsButton.js +2 -2
- package/components/List/components/ListItemControlsButtonDropdown.js +3 -3
- package/components/List/components/ListItemControlsButtonDropdown.js.map +1 -1
- package/components/List/components/ListItemLoading.js +2 -2
- package/components/List/components/ListItemSelectable.js +7 -7
- package/components/List/components/ListItemTailLeft.js +2 -2
- package/components/List/components/ListItemTailRight.js +2 -2
- package/components/List/components/ListSortableItem.js +4 -4
- package/components/List/components/ListSortableItem.js.map +1 -1
- package/components/List/components/ListSortableItemControls.js +2 -2
- package/components/List/components/ListSortableItemTarget.js +5 -5
- package/components/List/components/ListTableItem.js +4 -4
- package/components/List/index.js +1 -1
- package/components/List/utils.js +1 -9
- package/components/List/utils.js.map +1 -1
- package/components/ListMaster/ListMaster.js +1 -1
- package/components/ListMaster/components/ListMasterBody.js +1 -1
- package/components/ListMaster/components/ListMasterChipGroup.js +2 -2
- package/components/ListMaster/components/ListMasterFooter.js +2 -2
- package/components/ListMaster/components/ListMasterFooterControls.js +2 -2
- package/components/ListMaster/components/ListMasterFooterDescription.js +2 -2
- package/components/ListMaster/components/ListMasterHeader.js +3 -3
- package/components/ListMaster/components/SelectionControls.js +3 -3
- package/components/Loader/LoaderMiddle/LoaderMiddle.js +9 -9
- package/components/Loader/LoaderSmall/LoaderSmall.js +11 -11
- package/components/LoaderScreen/LoaderScreen.js +6 -6
- package/components/Marker/Marker.js +2 -2
- package/components/Marker/utils.js +1 -1
- package/components/MarkerStatus/MarkerStatus.js +8 -8
- package/components/ModalWindow/ModalWindow.js +2 -2
- package/components/ModalWindow/components/ModalWindowBody.js +2 -2
- package/components/ModalWindow/components/ModalWindowClose.js +1 -1
- package/components/ModalWindow/components/ModalWindowContent.js +2 -2
- package/components/ModalWindow/components/ModalWindowHeader.js +2 -2
- package/components/ModalWindow/components/ModalWindowViewManager.js +2 -2
- package/components/MonthYearField/MonthYearFieldTarget.js +5 -5
- package/components/MonthYearRange/MonthYearRange.js +4 -4
- package/components/MultiselectField/components/MultiselectFieldDropdown.js +2 -2
- package/components/MultiselectField/components/MultiselectFieldDropdownContent.js +6 -6
- package/components/MultiselectField/components/MultiselectFieldDropdownFooter.js +2 -2
- package/components/MultiselectField/components/MultiselectFieldDropdownHeader.js +2 -2
- package/components/Notification/Notification.js +3 -3
- package/components/Notification/NotificationGrouped.js +1 -1
- package/components/Notification/components/NotificationBody.js +1 -1
- package/components/Notification/components/NotificationBodyList.js +2 -2
- package/components/Notification/components/NotificationClose.js +1 -1
- package/components/Notification/components/NotificationFooter.js +1 -1
- package/components/Notification/components/NotificationGroupedFooter.js +2 -2
- package/components/Notification/components/NotificationHeader.js +1 -1
- package/components/Notification/components/NotificationIcon.js +1 -1
- package/components/Notification/components/NotificationTime.js +1 -1
- package/components/OrderedList/OrderedList.js +3 -3
- package/components/OrderedList/OrderedListItem.js +3 -3
- package/components/Overlay/Overlay.js +2 -2
- package/components/Overlay/OverlayMask.js +2 -2
- package/components/Overlay/OverlayPanel.js +2 -2
- package/components/Page/Page.js +2 -2
- package/components/Page/components/BodyPage.js +8 -8
- package/components/Page/components/FooterPage.js +7 -14
- package/components/Page/components/FooterPage.js.map +1 -1
- package/components/Page/components/HeaderPage.js +2 -2
- package/components/Pagination/components/PaginationExtended.js +3 -3
- package/components/Pagination/components/PaginationNavigationButton.js +2 -2
- package/components/Pagination/components/PaginationNavigationExtended.js +2 -2
- package/components/Pagination/components/PaginationPageButton.js +3 -3
- package/components/Pagination/components/PaginationPageEllipsis.js +2 -2
- package/components/Pagination/components/PaginationSelect.js +3 -3
- package/components/Pagination/utils.js +1 -1
- package/components/Radio/Radio.js +10 -10
- package/components/Radio/RadioXGroup.js +9 -9
- package/components/Radio/RadioYGroup.js +2 -2
- package/components/Row/Row.js +5 -5
- package/components/SMSField/SMSField.js +3 -3
- package/components/SMSField/components/RefreshIcon.js +2 -2
- package/components/SMSField/components/SMSFieldInput.js +2 -2
- package/components/SMSField/components/SMSFieldRefresh.js +2 -2
- package/components/SMSField/components/SMSFieldSubmit.js +2 -2
- package/components/SMSField/components/SMSFieldTooltip.js +1 -1
- package/components/SegmentedControl/SegmentedControl.js +10 -10
- package/components/SegmentedControl/SegmentedControlSegment.js +4 -4
- package/components/SelectExtendedField/SelectExtendedField.js +2 -2
- package/components/SelectExtendedField/components/SelectExtendedFieldDropdown.js +1 -1
- package/components/SelectExtendedField/components/SelectExtendedFieldDropdownDefault.js +1 -1
- package/components/SelectExtendedField/components/SelectExtendedFieldTarget.js +8 -8
- package/components/SelectField/SelectField.js +2 -2
- package/components/Skeleton/Skeleton.js +6 -6
- package/components/Slider/Slider.js +10 -14
- package/components/Slider/Slider.js.map +1 -1
- package/components/SliderExtended/SliderExtended.js +3 -3
- package/components/SliderExtended/components/SliderExtendedDot/SliderExtendedDot.js +7 -7
- package/components/SliderExtended/components/SliderExtendedDot/SliderExtendedDot.js.map +1 -1
- package/components/SliderExtended/components/SliderExtendedMarks/SliderExtendedMark.js +2 -2
- package/components/SliderExtended/components/SliderExtendedMarks/SliderExtendedMarks.js +2 -2
- package/components/SliderExtended/components/SliderExtendedMoveHandler.js +1 -1
- package/components/SliderExtended/components/SliderExtendedRail.js +3 -3
- package/components/SliderExtended/components/SliderExtendedTooltip/SliderExtendedTooltip.js +6 -6
- package/components/SliderExtended/components/SliderExtendedTooltip/SliderExtendedTooltip.js.map +1 -1
- package/components/SliderExtended/components/SliderExtendedTrack/SliderExtendedTrack.js +8 -8
- package/components/SliderExtended/components/SliderExtendedTrack/SliderExtendedTrack.js.map +1 -1
- package/components/SliderRange/SliderRange.js +12 -19
- package/components/SliderRange/SliderRange.js.map +1 -1
- package/components/SmallInput/SmallInput.js +2 -2
- package/components/Spoiler/Spoiler.js +11 -11
- package/components/StatusTracker/StatusTracker.js +3 -3
- package/components/StatusTracker/components/StatusTrackerAlert.js +2 -2
- package/components/StatusTracker/components/StatusTrackerBody.js +2 -2
- package/components/StatusTracker/components/StatusTrackerButton.js +2 -2
- package/components/StatusTracker/components/StatusTrackerDescription.js +2 -2
- package/components/StatusTracker/components/StatusTrackerFooter.js +2 -2
- package/components/StatusTracker/components/StatusTrackerHeader.js +2 -2
- package/components/StatusTracker/components/StatusTrackerMedia.js +2 -2
- package/components/StatusTracker/components/StatusTrackerStatus.js +2 -2
- package/components/StatusTracker/components/StatusTrackerStatusGroup.js +2 -2
- package/components/StatusTracker/components/StatusTrackerSum.js +2 -2
- package/components/StatusTracker/components/StatusTrackerTitle.js +2 -2
- package/components/Step/Step.js +11 -11
- package/components/Stepper/Stepper.js +9 -9
- package/components/Stepper/StepperExtended.js +2 -2
- package/components/Stepper/StepperStep.js +3 -3
- package/components/Stepper/StepperStepArrowBorder.js +1 -1
- package/components/Suggest/SuggestMobileDropdownContent.js +3 -3
- package/components/Suggest/useSuggest.js +1 -1
- package/components/SuggestField/SuggestField.js +1 -1
- package/components/SuggestField/desktop/SuggestFieldDesktop.js +2 -2
- package/components/SuggestField/desktop/SuggestFieldDesktopDropdown.js +1 -1
- package/components/SuggestField/index.js +1 -1
- package/components/SuggestField/mobile/SuggestFieldMobile.js +1 -1
- package/components/SuggestField/mobile/SuggestFieldMobileDropdown.js +2 -2
- package/components/SuggestField/mobile/SuggestFieldMobileDropdownHint.js +1 -1
- package/components/SuggestField/mobile/index.js +1 -1
- package/components/SwipeableArea/SwipeableArea.js +9 -9
- package/components/Table/ChipPanel.js +2 -2
- package/components/Table/ChipPanelLinks.js +2 -2
- package/components/Table/FilterPanel.js +3 -3
- package/components/Table/MasterTable.js +3 -3
- package/components/Table/NoColumns.js +3 -3
- package/components/Table/PaginationPanel.js +3 -3
- package/components/Table/TableBasic/TableBasic.js +2 -2
- package/components/Table/TableBasic/components/TableBasicBody.js +2 -2
- package/components/Table/TableBasic/components/TableBasicHeader.js +2 -2
- package/components/Table/TableBasic/components/TableBasicRow.js +2 -2
- package/components/Table/TableBasicSettings/TableBasicSettings.js +3 -3
- package/components/Table/TableBasicSettings/components/ColumnSettingsSortableListItemTarget.js +3 -3
- package/components/Table/TableBasicSettings/components/ColumnSettingsStaticListItem.js +2 -2
- package/components/Table/TableBasicSettings/components/TableBasicSettingsBody.js +2 -2
- package/components/Table/TableBasicSettings/components/TableBasicSettingsFooter.js +2 -2
- package/components/Table/TableBasicSettings/components/TableBasicSettingsHeader.js +2 -2
- package/components/Table/TableFooter/TableFooter.js +2 -2
- package/components/Table/TableFooter/components/TableFooterSummary.js +1 -1
- package/components/Table/TableFooter/components/TableFooterSummaryAmount.js +1 -1
- package/components/Table/TableFooter/components/TableFooterSummarySelectAllButton.js +1 -1
- package/components/Table/TableFooter/components/TableFooterSummarySelectedCount.js +1 -1
- package/components/Table/utils.js +1 -1
- package/components/Tabs/Tabs.js +9 -9
- package/components/TabsExtended/TabsExtended.js +3 -3
- package/components/TabsExtended/components/TabsExtendedContent.js +2 -2
- package/components/TabsExtended/components/TabsExtendedDropdownWrapper.js +2 -2
- package/components/TabsExtended/components/TabsExtendedTab.js +2 -2
- package/components/TabsExtended/components/TabsExtendedTabButton.js +2 -2
- package/components/TabsExtended/components/TabsExtendedTabsWrapper.js +2 -2
- package/components/TabsExtended/utils.js +1 -1
- package/components/TabsLine/TabsLine.js +20 -17
- package/components/TabsLine/TabsLine.js.map +1 -1
- package/components/TabsLine/components/TabsLineDesktop.js +85 -98
- package/components/TabsLine/components/TabsLineDesktop.js.map +1 -1
- package/components/TabsLine/components/TabsLineDropdown.js +122 -86
- package/components/TabsLine/components/TabsLineDropdown.js.map +1 -1
- package/components/TabsLine/components/TabsLineItem.js +43 -27
- package/components/TabsLine/components/TabsLineItem.js.map +1 -1
- package/components/TabsLine/components/TabsLineMobile.js +20 -15
- package/components/TabsLine/components/TabsLineMobile.js.map +1 -1
- package/components/TabsLine/utils.js +8 -0
- package/components/TabsLine/utils.js.map +1 -1
- package/components/Tag/Tag.js +6 -6
- package/components/TagColor/TagColor.js +11 -11
- package/components/TagGroup/TagGroup.js +5 -5
- package/components/TextareaField/TextareaField.js +5 -1
- package/components/TextareaField/TextareaField.js.map +1 -1
- package/components/ThemeProvider/ThemeProvider.js +1 -1
- package/components/ThemeProvider/components/ThemeProviderView.js +1 -1
- package/components/Tooltip/components/common/TooltipBody.js +2 -2
- package/components/Tooltip/components/common/TooltipLink.js +5 -5
- package/components/Tooltip/components/common/TooltipXButton.js +1 -1
- package/components/Tooltip/components/desktop/components/TooltipDesktopBase.js +2 -2
- package/components/Tooltip/components/desktop/components/TooltipDesktopTip.js +2 -2
- package/components/Tooltip/components/mobile/TooltipMobile.js +5 -5
- package/components/TopOverlay/TopOverlay.js +7 -7
- package/components/TreeView/TreeView.js +13 -8
- package/components/TreeView/TreeView.js.map +1 -1
- package/components/TreeView/components/TreeViewGroup.js +2 -2
- package/components/TreeView/components/TreeViewNode.js +2 -2
- package/components/Triggers/TriggerClickOnKeyDownEvent.js +2 -5
- package/components/Triggers/TriggerClickOnKeyDownEvent.js.map +1 -1
- package/components/Typography/Caption.js +8 -8
- package/components/Typography/CodeText.js +3 -3
- package/components/Typography/Text.js +10 -10
- package/components/Typography/Title.js +10 -10
- package/components/Typography/constants.js +1 -1
- package/components/UnorderedListExtended/UnorderedListExtended.js +3 -3
- package/components/UnorderedListExtended/UnorderedListExtendedItem.js +3 -3
- package/components/UnorderedListExtended/UnorderedListExtendedItemMarker.js +4 -4
- package/components/UploadZone/UploadZone.js +3 -3
- package/components/UploadZone/components/UploadZoneInput.js +2 -2
- package/components/UploadZone/index.js +1 -1
- package/components/WindowResizeListener/WindowResizeListener.js +1 -1
- package/components/index.js +10 -6
- package/components/index.js.map +1 -1
- package/{components/SliderExtended/utils.js → helpers/setForwardedRef.js} +2 -2
- package/helpers/setForwardedRef.js.map +1 -0
- package/index.d.ts +426 -204
- package/index.js +10 -6
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/triplex-next.css +3044 -3046
- package/utils/amountUtils.js +1 -1
- package/chunks/Card.module-CNOChUdZ.js +0 -32
- package/chunks/Card.module-CNOChUdZ.js.map +0 -1
- package/chunks/Carousel.module-BpVAzSjh.js +0 -34
- package/chunks/Carousel.module-BpVAzSjh.js.map +0 -1
- package/chunks/CheckboxTreeExtended.module-BqOLLHuh.js +0 -24
- package/chunks/CheckboxTreeExtended.module-BqOLLHuh.js.map +0 -1
- package/chunks/Confirm.module-Dw5sV0a8.js +0 -24
- package/chunks/Confirm.module-Dw5sV0a8.js.map +0 -1
- package/chunks/DropdownMobile.module-ljfYoQZP.js +0 -40
- package/chunks/DropdownMobile.module-ljfYoQZP.js.map +0 -1
- package/chunks/Footer.module-DgSEqR3M.js +0 -12
- package/chunks/Footer.module-DgSEqR3M.js.map +0 -1
- package/chunks/HeaderLayoutSidebar.module-k_1rIXs0.js.map +0 -1
- package/chunks/HeaderTabs.module-Dm__bdlz.js +0 -12
- package/chunks/HeaderTabs.module-Dm__bdlz.js.map +0 -1
- package/chunks/HeaderTitle.module-BbIcVzwx.js.map +0 -1
- package/chunks/ImageGalleryExtendedMain.module--816bwiO.js +0 -28
- package/chunks/ImageGalleryExtendedMain.module--816bwiO.js.map +0 -1
- package/chunks/IslandAccordion.module-4rzQ8p9D.js +0 -44
- package/chunks/IslandAccordion.module-4rzQ8p9D.js.map +0 -1
- package/chunks/IslandWidgetFooter.module-Dxb05X44.js +0 -18
- package/chunks/IslandWidgetFooter.module-Dxb05X44.js.map +0 -1
- package/chunks/IslandWidgetHeader.module-K8SbMdcg.js +0 -28
- package/chunks/IslandWidgetHeader.module-K8SbMdcg.js.map +0 -1
- package/chunks/LightBoxControls.module-DsLaGx4X.js +0 -26
- package/chunks/LightBoxControls.module-DsLaGx4X.js.map +0 -1
- package/chunks/LightBoxSideOverlayClose.module-B_RmH_Zj.js.map +0 -1
- package/chunks/ListItemTail.module-CwDNx9W5.js +0 -18
- package/chunks/ListItemTail.module-CwDNx9W5.js.map +0 -1
- package/chunks/ListMasterFooter.module-D7b9ZUqR.js +0 -14
- package/chunks/ListMasterFooter.module-D7b9ZUqR.js.map +0 -1
- package/chunks/ModalWindow.module-urBVReGQ.js +0 -28
- package/chunks/ModalWindow.module-urBVReGQ.js.map +0 -1
- package/chunks/Notification.module-BgjNhU2P.js +0 -34
- package/chunks/Notification.module-BgjNhU2P.js.map +0 -1
- package/chunks/Overlay.module-DlzZBVdp.js +0 -30
- package/chunks/Overlay.module-DlzZBVdp.js.map +0 -1
- package/chunks/Page.module-CEeCuq1n.js +0 -15
- package/chunks/Page.module-CEeCuq1n.js.map +0 -1
- package/chunks/SMSField.module-CGuPONeF.js +0 -30
- package/chunks/SMSField.module-CGuPONeF.js.map +0 -1
- package/chunks/SliderExtendedMarks.module-SGdABaf_.js +0 -24
- package/chunks/SliderExtendedMarks.module-SGdABaf_.js.map +0 -1
- package/chunks/SliderExtendedRail-VEYm3CWM.js.map +0 -1
- package/chunks/StatusTracker.module-oLJmSAgs.js +0 -44
- package/chunks/StatusTracker.module-oLJmSAgs.js.map +0 -1
- package/chunks/TableFooter.module-DOL7cRaV.js +0 -22
- package/chunks/TableFooter.module-DOL7cRaV.js.map +0 -1
- package/chunks/TabsExtended.module-DveIh7_v.js +0 -26
- package/chunks/TabsExtended.module-DveIh7_v.js.map +0 -1
- package/chunks/TabsLine.module-CFuF3nRE.js +0 -36
- package/chunks/TabsLine.module-CFuF3nRE.js.map +0 -1
- package/chunks/TooltipDesktop.module-Bay9M-y1.js +0 -32
- package/chunks/TooltipDesktop.module-Bay9M-y1.js.map +0 -1
- package/chunks/TreeView.module-B1mjvRWg.js +0 -12
- package/chunks/TreeView.module-B1mjvRWg.js.map +0 -1
- package/chunks/vendor-D4wvHis9.js.map +0 -1
- package/components/SliderExtended/utils.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useContext, useEffect } from "react";
|
|
3
|
-
import { c as clsx } from "../../../chunks/vendor-
|
|
3
|
+
import { c as clsx } from "../../../chunks/vendor-CUIykw0y.js";
|
|
4
4
|
import { FormFieldDescriptionContext } from "../FormFieldDescriptionContext.js";
|
|
5
|
-
const formFieldCounter = "
|
|
5
|
+
const formFieldCounter = "formFieldCounter__b525fa05";
|
|
6
6
|
const styles = {
|
|
7
7
|
formFieldCounter
|
|
8
8
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useMemo } from "react";
|
|
3
|
-
import { c as clsx } from "../../../chunks/vendor-
|
|
3
|
+
import { c as clsx } from "../../../chunks/vendor-CUIykw0y.js";
|
|
4
4
|
import { FormFieldDescriptionContext } from "../FormFieldDescriptionContext.js";
|
|
5
|
-
const formFieldDescription = "
|
|
6
|
-
const withCounter = "
|
|
5
|
+
const formFieldDescription = "formFieldDescription__c4cf61b6";
|
|
6
|
+
const withCounter = "withCounter__e83a4305";
|
|
7
7
|
const styles = {
|
|
8
8
|
formFieldDescription,
|
|
9
9
|
withCounter
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import React__default, { useContext, useMemo, useCallback, useLayoutEffect } from "react";
|
|
3
|
-
import { u as uniqueId, c as clsx } from "../../../chunks/vendor-
|
|
3
|
+
import { u as uniqueId, c as clsx } from "../../../chunks/vendor-CUIykw0y.js";
|
|
4
4
|
import { FormFieldContext } from "../FormFieldContext.js";
|
|
5
5
|
import { EFormFieldStatus } from "../enums.js";
|
|
6
6
|
import { createSizeToClassNameMap } from "../../../utils/classNameMaps.js";
|
|
7
7
|
import { isFilled } from "./utils.js";
|
|
8
|
-
const formFieldInput = "
|
|
9
|
-
const sm = "
|
|
10
|
-
const md = "
|
|
11
|
-
const lg = "
|
|
8
|
+
const formFieldInput = "formFieldInput__95e739e8";
|
|
9
|
+
const sm = "sm__ed5d7a26";
|
|
10
|
+
const md = "md__cfe15086";
|
|
11
|
+
const lg = "lg__961e2e6d";
|
|
12
12
|
const styles = {
|
|
13
13
|
formFieldInput,
|
|
14
14
|
sm,
|
|
@@ -40,6 +40,7 @@ const FormFieldInput = React__default.forwardRef(
|
|
|
40
40
|
);
|
|
41
41
|
useLayoutEffect(() => {
|
|
42
42
|
setTargetId(id);
|
|
43
|
+
return () => setTargetId((currentTargetId) => currentTargetId === id ? void 0 : currentTargetId);
|
|
43
44
|
}, [id, setTargetId]);
|
|
44
45
|
useLayoutEffect(() => {
|
|
45
46
|
syncFilled(value ?? defaultValue);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldInput.js","sources":["../../../../src/components/FormField/components/FormFieldInput.tsx"],"sourcesContent":["import React, { useContext, useMemo, useCallback, useLayoutEffect } from \"react\";\nimport clsx from \"clsx\";\nimport { uniqueId } from \"lodash-es\";\nimport { FormFieldContext } from \"../FormFieldContext\";\nimport { EFormFieldStatus } from \"../enums\";\nimport { createSizeToClassNameMap } from \"../../../utils/classNameMaps\";\nimport { DataAttributes } from \"../../../types/CoreTypes\";\nimport { isFilled } from \"./utils\";\nimport styles from \"../styles/FormFieldInput.module.less\";\n\n/** Свойства, передаваемые в рендер-функцию компонента FormFieldInput. */\nexport interface IFormFieldInputProvideProps extends React.InputHTMLAttributes<HTMLInputElement>, DataAttributes {}\n\n/** Свойства компонента FormFieldInput. */\nexport interface IFormFieldInputProps extends Omit<IFormFieldInputProvideProps, \"disabled\"> {\n /**\n * Рендер-функция, в которую можно передать любой инпут с нужным функционалом (валидация ввода, маска).\n * Через аргумент props инпуту передаётся нужная стилизация, идентификатор и обработчики событий.\n */\n render?: (props: IFormFieldInputProvideProps, ref?: React.Ref<HTMLInputElement>) => React.ReactNode;\n}\n\n/** Соответствие размера имени класса. */\nconst SIZE_TO_CLASS_NAME_MAP = createSizeToClassNameMap(styles);\n\n/**\n * Компонент, отображающий input.\n *\n * Синхронизирует с FormFieldContext идентификатор элемента ввода, состояния фокуса и заполненности,\n * а также блокируется, когда поле имеет статус `EFormFieldStatus.DISABLED`.\n */\nexport const FormFieldInput = React.forwardRef<HTMLInputElement, IFormFieldInputProps>(\n (\n {\n id: idProp,\n className,\n value,\n defaultValue,\n onFocus,\n onBlur,\n onAnimationStart,\n onChange,\n render,\n ...restProps\n },\n ref,\n ) => {\n const { size, status, setFocused, setTargetId, setFilled } = useContext(FormFieldContext);\n const id = useMemo(() => (idProp === undefined ? uniqueId(\"input_\") : idProp), [idProp]);\n const classNames = clsx(styles.formFieldInput, SIZE_TO_CLASS_NAME_MAP[size], className);\n\n const syncFilled = useCallback(\n (nextValue: IFormFieldInputProps[\"value\"]) => {\n setFilled(isFilled(nextValue));\n },\n [setFilled],\n );\n\n useLayoutEffect(() => {\n setTargetId(id);\n }, [id, setTargetId]);\n\n // Начальная синхронизация заполненности: defaultValue учитывается только при монтировании,\n // дальнейшие изменения value обрабатываются эффектом ниже.\n useLayoutEffect(() => {\n syncFilled(value ?? defaultValue);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useLayoutEffect(() => {\n if (value !== undefined) {\n syncFilled(value);\n }\n }, [value, syncFilled]);\n\n const handleFocus = useCallback<React.FocusEventHandler<HTMLInputElement>>(\n (event) => {\n syncFilled(event.currentTarget.value);\n setFocused(true);\n onFocus?.(event);\n },\n [setFocused, syncFilled, onFocus],\n );\n\n const handleBlur = useCallback<React.FocusEventHandler<HTMLInputElement>>(\n (event) => {\n syncFilled(event.currentTarget.value);\n setFocused(false);\n onBlur?.(event);\n },\n [setFocused, syncFilled, onBlur],\n );\n\n /**\n * Обработчик начала анимации.\n *\n * Текущая реализация необходима для кейсов с автозаполнением:\n * - Браузер устанавливает значение в поле при загрузке страницы;\n * - Браузер устанавливает значение в поле при навигации пользователем по сохранённым опциям заполнения.\n */\n const handleAnimationStart = useCallback<React.AnimationEventHandler<HTMLInputElement>>(\n (event) => {\n if (event.animationName.startsWith(\"autofill-applied-hook\")) {\n setFilled(true);\n } else if (event.animationName.startsWith(\"autofill-cancelled-hook\")) {\n // Необходимо проверить, что при отмене автозаполнения, в поле не находится значение.\n syncFilled(event.currentTarget.value);\n }\n onAnimationStart?.(event);\n },\n [setFilled, syncFilled, onAnimationStart],\n );\n\n const handleChange = useCallback<React.ChangeEventHandler<HTMLInputElement>>(\n (event) => {\n syncFilled(event.currentTarget.value);\n onChange?.(event);\n },\n [syncFilled, onChange],\n );\n\n const commonProps: IFormFieldInputProvideProps = {\n ...restProps,\n id,\n className: classNames,\n value,\n defaultValue,\n disabled: status === EFormFieldStatus.DISABLED,\n onFocus: handleFocus,\n onBlur: handleBlur,\n onAnimationStart: handleAnimationStart,\n onChange: handleChange,\n };\n\n if (render) {\n // Рендер инпута, переданного снаружи.\n return render(commonProps, ref);\n }\n\n // Рендер текстового инпута по умолчанию.\n return <input {...commonProps} ref={ref} />;\n },\n);\n\nFormFieldInput.displayName = \"FormFieldInput\";\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;AAuBA,MAAM,yBAAyB,yBAAyB,MAAM;AAQvD,MAAM,iBAAiBA,eAAM;AAAA,EAChC,CACI;AAAA,IACI,IAAI;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEP,QACC;AACD,UAAM,EAAE,MAAM,QAAQ,YAAY,aAAa,UAAA,IAAc,WAAW,gBAAgB;AACxF,UAAM,KAAK,QAAQ,MAAO,WAAW,SAAY,SAAS,QAAQ,IAAI,QAAS,CAAC,MAAM,CAAC;AACvF,UAAM,aAAa,KAAK,OAAO,gBAAgB,uBAAuB,IAAI,GAAG,SAAS;AAEtF,UAAM,aAAa;AAAA,MACf,CAAC,cAA6C;AAC1C,kBAAU,SAAS,SAAS,CAAC;AAAA,MACjC;AAAA,MACA,CAAC,SAAS;AAAA,IAAA;AAGd,oBAAgB,MAAM;AAClB,kBAAY,EAAE;AAAA,
|
|
1
|
+
{"version":3,"file":"FormFieldInput.js","sources":["../../../../src/components/FormField/components/FormFieldInput.tsx"],"sourcesContent":["import React, { useContext, useMemo, useCallback, useLayoutEffect } from \"react\";\nimport clsx from \"clsx\";\nimport { uniqueId } from \"lodash-es\";\nimport { FormFieldContext } from \"../FormFieldContext\";\nimport { EFormFieldStatus } from \"../enums\";\nimport { createSizeToClassNameMap } from \"../../../utils/classNameMaps\";\nimport { DataAttributes } from \"../../../types/CoreTypes\";\nimport { isFilled } from \"./utils\";\nimport styles from \"../styles/FormFieldInput.module.less\";\n\n/** Свойства, передаваемые в рендер-функцию компонента FormFieldInput. */\nexport interface IFormFieldInputProvideProps extends React.InputHTMLAttributes<HTMLInputElement>, DataAttributes {}\n\n/** Свойства компонента FormFieldInput. */\nexport interface IFormFieldInputProps extends Omit<IFormFieldInputProvideProps, \"disabled\"> {\n /**\n * Рендер-функция, в которую можно передать любой инпут с нужным функционалом (валидация ввода, маска).\n * Через аргумент props инпуту передаётся нужная стилизация, идентификатор и обработчики событий.\n */\n render?: (props: IFormFieldInputProvideProps, ref?: React.Ref<HTMLInputElement>) => React.ReactNode;\n}\n\n/** Соответствие размера имени класса. */\nconst SIZE_TO_CLASS_NAME_MAP = createSizeToClassNameMap(styles);\n\n/**\n * Компонент, отображающий input.\n *\n * Синхронизирует с FormFieldContext идентификатор элемента ввода, состояния фокуса и заполненности,\n * а также блокируется, когда поле имеет статус `EFormFieldStatus.DISABLED`.\n */\nexport const FormFieldInput = React.forwardRef<HTMLInputElement, IFormFieldInputProps>(\n (\n {\n id: idProp,\n className,\n value,\n defaultValue,\n onFocus,\n onBlur,\n onAnimationStart,\n onChange,\n render,\n ...restProps\n },\n ref,\n ) => {\n const { size, status, setFocused, setTargetId, setFilled } = useContext(FormFieldContext);\n const id = useMemo(() => (idProp === undefined ? uniqueId(\"input_\") : idProp), [idProp]);\n const classNames = clsx(styles.formFieldInput, SIZE_TO_CLASS_NAME_MAP[size], className);\n\n const syncFilled = useCallback(\n (nextValue: IFormFieldInputProps[\"value\"]) => {\n setFilled(isFilled(nextValue));\n },\n [setFilled],\n );\n\n useLayoutEffect(() => {\n setTargetId(id);\n return () => setTargetId((currentTargetId) => (currentTargetId === id ? undefined : currentTargetId));\n }, [id, setTargetId]);\n\n // Начальная синхронизация заполненности: defaultValue учитывается только при монтировании,\n // дальнейшие изменения value обрабатываются эффектом ниже.\n useLayoutEffect(() => {\n syncFilled(value ?? defaultValue);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useLayoutEffect(() => {\n if (value !== undefined) {\n syncFilled(value);\n }\n }, [value, syncFilled]);\n\n const handleFocus = useCallback<React.FocusEventHandler<HTMLInputElement>>(\n (event) => {\n syncFilled(event.currentTarget.value);\n setFocused(true);\n onFocus?.(event);\n },\n [setFocused, syncFilled, onFocus],\n );\n\n const handleBlur = useCallback<React.FocusEventHandler<HTMLInputElement>>(\n (event) => {\n syncFilled(event.currentTarget.value);\n setFocused(false);\n onBlur?.(event);\n },\n [setFocused, syncFilled, onBlur],\n );\n\n /**\n * Обработчик начала анимации.\n *\n * Текущая реализация необходима для кейсов с автозаполнением:\n * - Браузер устанавливает значение в поле при загрузке страницы;\n * - Браузер устанавливает значение в поле при навигации пользователем по сохранённым опциям заполнения.\n */\n const handleAnimationStart = useCallback<React.AnimationEventHandler<HTMLInputElement>>(\n (event) => {\n if (event.animationName.startsWith(\"autofill-applied-hook\")) {\n setFilled(true);\n } else if (event.animationName.startsWith(\"autofill-cancelled-hook\")) {\n // Необходимо проверить, что при отмене автозаполнения, в поле не находится значение.\n syncFilled(event.currentTarget.value);\n }\n onAnimationStart?.(event);\n },\n [setFilled, syncFilled, onAnimationStart],\n );\n\n const handleChange = useCallback<React.ChangeEventHandler<HTMLInputElement>>(\n (event) => {\n syncFilled(event.currentTarget.value);\n onChange?.(event);\n },\n [syncFilled, onChange],\n );\n\n const commonProps: IFormFieldInputProvideProps = {\n ...restProps,\n id,\n className: classNames,\n value,\n defaultValue,\n disabled: status === EFormFieldStatus.DISABLED,\n onFocus: handleFocus,\n onBlur: handleBlur,\n onAnimationStart: handleAnimationStart,\n onChange: handleChange,\n };\n\n if (render) {\n // Рендер инпута, переданного снаружи.\n return render(commonProps, ref);\n }\n\n // Рендер текстового инпута по умолчанию.\n return <input {...commonProps} ref={ref} />;\n },\n);\n\nFormFieldInput.displayName = \"FormFieldInput\";\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;AAuBA,MAAM,yBAAyB,yBAAyB,MAAM;AAQvD,MAAM,iBAAiBA,eAAM;AAAA,EAChC,CACI;AAAA,IACI,IAAI;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EA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6DAAmB;AAAA,MACvB;AAAA,MACA,CAAC,WAAW,YAAY,gBAAgB;AAAA,IAAA;AAG5C,UAAM,eAAe;AAAA,MACjB,CAAC,UAAU;AACP,mBAAW,MAAM,cAAc,KAAK;AACpC,6CAAW;AAAA,MACf;AAAA,MACA,CAAC,YAAY,QAAQ;AAAA,IAAA;AAGzB,UAAM,cAA2C;AAAA,MAC7C,GAAG;AAAA,MACH;AAAA,MACA,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA,UAAU,WAAW,iBAAiB;AAAA,MACtC,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,kBAAkB;AAAA,MAClB,UAAU;AAAA,IAAA;AAGd,QAAI,QAAQ;AAER,aAAO,OAAO,aAAa,GAAG;AAAA,IAClC;AAGA,WAAO,oBAAC,SAAA,EAAO,GAAG,aAAa,IAAA,CAAU;AAAA,EAC7C;AACJ;AAEA,eAAe,cAAc;"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import React__default, { useContext, useMemo, useLayoutEffect } from "react";
|
|
3
|
-
import { u as uniqueId, c as clsx } from "../../../chunks/vendor-
|
|
3
|
+
import { u as uniqueId, c as clsx } from "../../../chunks/vendor-CUIykw0y.js";
|
|
4
4
|
import { FormFieldContext } from "../FormFieldContext.js";
|
|
5
5
|
import { createSizeToClassNameMap } from "../../../utils/classNameMaps.js";
|
|
6
6
|
import { EFormFieldStatus } from "../enums.js";
|
|
7
7
|
import { TARGET_PADDING_X_DEFAULT } from "../consts.js";
|
|
8
|
-
const formFieldLabel = "
|
|
9
|
-
const sm = "
|
|
10
|
-
const md = "
|
|
11
|
-
const lg = "
|
|
12
|
-
const floating = "
|
|
13
|
-
const formFieldLabelText = "
|
|
14
|
-
const disabled = "
|
|
8
|
+
const formFieldLabel = "formFieldLabel__de853f80";
|
|
9
|
+
const sm = "sm__ed5d7a26";
|
|
10
|
+
const md = "md__cfe15086";
|
|
11
|
+
const lg = "lg__961e2e6d";
|
|
12
|
+
const floating = "floating__c19f75dd";
|
|
13
|
+
const formFieldLabelText = "formFieldLabelText__232ec83b";
|
|
14
|
+
const disabled = "disabled__f8e0d3d6";
|
|
15
15
|
const styles = {
|
|
16
16
|
formFieldLabel,
|
|
17
17
|
sm,
|
|
@@ -45,7 +45,19 @@ const FormFieldLabel = React__default.forwardRef(
|
|
|
45
45
|
useLayoutEffect(() => {
|
|
46
46
|
setLabelId(id);
|
|
47
47
|
}, [id, setLabelId]);
|
|
48
|
-
|
|
48
|
+
const Tag = targetId === void 0 ? "span" : "label";
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
Tag,
|
|
51
|
+
{
|
|
52
|
+
...restProps,
|
|
53
|
+
id,
|
|
54
|
+
className: classNames,
|
|
55
|
+
htmlFor: targetId,
|
|
56
|
+
style: labelStyle,
|
|
57
|
+
ref,
|
|
58
|
+
children: /* @__PURE__ */ jsx("span", { className: styles.formFieldLabelText, children })
|
|
59
|
+
}
|
|
60
|
+
);
|
|
49
61
|
}
|
|
50
62
|
);
|
|
51
63
|
FormFieldLabel.displayName = "FormFieldLabel";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldLabel.js","sources":["../../../../src/components/FormField/components/FormFieldLabel.tsx"],"sourcesContent":["import React, { useContext, useMemo, useLayoutEffect } from \"react\";\nimport clsx from \"clsx\";\nimport { uniqueId } from \"lodash-es\";\nimport { FormFieldContext } from \"../FormFieldContext\";\nimport { createSizeToClassNameMap } from \"../../../utils/classNameMaps\";\nimport { EFormFieldStatus } from \"../enums\";\nimport { TARGET_PADDING_X_DEFAULT } from \"../consts\";\nimport styles from \"../styles/FormFieldLabel.module.less\";\n\n/** Свойства компонента FormFieldLabel. */\nexport interface IFormFieldLabelProps extends
|
|
1
|
+
{"version":3,"file":"FormFieldLabel.js","sources":["../../../../src/components/FormField/components/FormFieldLabel.tsx"],"sourcesContent":["import React, { useContext, useMemo, useLayoutEffect } from \"react\";\nimport clsx from \"clsx\";\nimport { uniqueId } from \"lodash-es\";\nimport { FormFieldContext } from \"../FormFieldContext\";\nimport { createSizeToClassNameMap } from \"../../../utils/classNameMaps\";\nimport { EFormFieldStatus } from \"../enums\";\nimport { TARGET_PADDING_X_DEFAULT } from \"../consts\";\nimport styles from \"../styles/FormFieldLabel.module.less\";\n\n/** Свойства компонента FormFieldLabel. */\nexport interface IFormFieldLabelProps extends React.HTMLAttributes<HTMLElement> {\n /** Label отображается в уменьшенном виде над полем ввода/селектом. Если значение не задано, вычисляется как filled || active из FormFieldContext. */\n floating?: boolean;\n}\n\n/** Соответствие размера имени класса. */\nconst SIZE_TO_CLASS_NAME_MAP = createSizeToClassNameMap(styles);\n\n/**\n * Лейбл поля ввода/селекта.\n *\n * Отображается по середине поля ввода; когда инпут/селект имеет значение или фокус,\n * перемещается в верхний левый угол. Собственный идентификатор публикуется в контекст как labelId.\n *\n * Тег зависит от того, есть ли в поле labelable-элемент (input, textarea, select).\n */\nexport const FormFieldLabel = React.forwardRef<HTMLElement, IFormFieldLabelProps>(\n ({ children, id: idProp, className, style, floating: floatingProp, ...restProps }, ref) => {\n const { targetId, size, status, filled, active, prefixWidth, postfixWidth, setLabelId } =\n useContext(FormFieldContext);\n const id = useMemo(() => (idProp === undefined ? uniqueId(\"label_\") : idProp), [idProp]);\n // Label отображается в уменьшенном виде над полем ввода/селектом.\n const floating = floatingProp ?? (filled || active);\n\n const classNames = clsx(\n styles.formFieldLabel,\n SIZE_TO_CLASS_NAME_MAP[size],\n {\n [styles.floating]: floating,\n [styles.disabled]: status === EFormFieldStatus.DISABLED,\n },\n className,\n );\n\n const labelStyle = {\n // Позиции по краям учитывают ширину префикса и постфикса, чтобы лейбл не перекрывался иконками.\n left: prefixWidth || TARGET_PADDING_X_DEFAULT,\n right: postfixWidth || TARGET_PADDING_X_DEFAULT,\n ...style,\n };\n\n useLayoutEffect(() => {\n setLabelId(id);\n }, [id, setLabelId]);\n\n // <label> без htmlFor и без вложенного поля браузер считает несвязанным лейблом,\n // поэтому в полях без labelable-элемента рендерится <span>.\n const Tag = targetId === undefined ? \"span\" : \"label\";\n\n return (\n <Tag\n {...restProps}\n id={id}\n className={classNames}\n htmlFor={targetId}\n style={labelStyle}\n // Tag — объединение тегов, поэтому ref приводится к типу более узкого из них.\n ref={ref as React.Ref<HTMLLabelElement>}\n >\n <span className={styles.formFieldLabelText}>{children}</span>\n </Tag>\n );\n },\n);\n\nFormFieldLabel.displayName = \"FormFieldLabel\";\n"],"names":["React","floating"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,yBAAyB,yBAAyB,MAAM;AAUvD,MAAM,iBAAiBA,eAAM;AAAA,EAChC,CAAC,EAAE,UAAU,IAAI,QAAQ,WAAW,OAAO,UAAU,cAAc,GAAG,UAAA,GAAa,QAAQ;AACvF,UAAM,EAAE,UAAU,MAAM,QAAQ,QAAQ,QAAQ,aAAa,cAAc,eACvE,WAAW,gBAAgB;AAC/B,UAAM,KAAK,QAAQ,MAAO,WAAW,SAAY,SAAS,QAAQ,IAAI,QAAS,CAAC,MAAM,CAAC;AAEvF,UAAMC,YAAW,iBAAiB,UAAU;AAE5C,UAAM,aAAa;AAAA,MACf,OAAO;AAAA,MACP,uBAAuB,IAAI;AAAA,MAC3B;AAAA,QACI,CAAC,OAAO,QAAQ,GAAGA;AAAA,QACnB,CAAC,OAAO,QAAQ,GAAG,WAAW,iBAAiB;AAAA,MAAA;AAAA,MAEnD;AAAA,IAAA;AAGJ,UAAM,aAAa;AAAA;AAAA,MAEf,MAAM,eAAe;AAAA,MACrB,OAAO,gBAAgB;AAAA,MACvB,GAAG;AAAA,IAAA;AAGP,oBAAgB,MAAM;AAClB,iBAAW,EAAE;AAAA,IACjB,GAAG,CAAC,IAAI,UAAU,CAAC;AAInB,UAAM,MAAM,aAAa,SAAY,SAAS;AAE9C,WACI;AAAA,MAAC;AAAA,MAAA;AAAA,QACI,GAAG;AAAA,QACJ;AAAA,QACA,WAAW;AAAA,QACX,SAAS;AAAA,QACT,OAAO;AAAA,QAEP;AAAA,QAEA,UAAA,oBAAC,QAAA,EAAK,WAAW,OAAO,oBAAqB,SAAA,CAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAGlE;AACJ;AAEA,eAAe,cAAc;"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import React__default, { useState, useRef, useContext, useEffect, useCallback } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { m as reactTextMaskExports, c as clsx, n as MaskedInputTextMask } from "../../../chunks/vendor-CUIykw0y.js";
|
|
4
4
|
import { presets } from "./FormFieldMaskedInputPresets.js";
|
|
5
5
|
import { FormFieldInput } from "./FormFieldInput.js";
|
|
6
6
|
import { FormFieldContext } from "../FormFieldContext.js";
|
|
7
7
|
import { EFormFieldStatus } from "../enums.js";
|
|
8
8
|
import { createSizeToClassNameMap } from "../../../utils/classNameMaps.js";
|
|
9
|
-
const formFieldMaskedInputWrapper = "
|
|
10
|
-
const maskLayout = "
|
|
11
|
-
const sm = "
|
|
12
|
-
const md = "
|
|
13
|
-
const lg = "
|
|
14
|
-
const valueMirror = "
|
|
15
|
-
const placeholderMask = "
|
|
16
|
-
const disabled = "
|
|
9
|
+
const formFieldMaskedInputWrapper = "formFieldMaskedInputWrapper__d00c14c2";
|
|
10
|
+
const maskLayout = "maskLayout__e7eb33dc";
|
|
11
|
+
const sm = "sm__ed5d7a26";
|
|
12
|
+
const md = "md__cfe15086";
|
|
13
|
+
const lg = "lg__961e2e6d";
|
|
14
|
+
const valueMirror = "valueMirror__44af0393";
|
|
15
|
+
const placeholderMask = "placeholderMask__1b312d0f";
|
|
16
|
+
const disabled = "disabled__f8e0d3d6";
|
|
17
17
|
const styles = {
|
|
18
18
|
formFieldMaskedInputWrapper,
|
|
19
19
|
maskLayout,
|
|
@@ -24,6 +24,16 @@ const styles = {
|
|
|
24
24
|
placeholderMask,
|
|
25
25
|
disabled
|
|
26
26
|
};
|
|
27
|
+
const PHONE_PREFIX = "+7 (";
|
|
28
|
+
const normalizePhoneText = (text) => {
|
|
29
|
+
let indexesOfPipedChars = [];
|
|
30
|
+
let nextText = text.replace(/^[78]((\D*\d)*)/, `${PHONE_PREFIX}$1`);
|
|
31
|
+
nextText = nextText.replace(/^\d7/, (match) => {
|
|
32
|
+
indexesOfPipedChars = Array.from(PHONE_PREFIX).map((_, i) => i);
|
|
33
|
+
return `${PHONE_PREFIX}${match}`;
|
|
34
|
+
});
|
|
35
|
+
return { indexesOfPipedChars, text: nextText };
|
|
36
|
+
};
|
|
27
37
|
const SIZE_TO_CLASS_NAME_MAP = createSizeToClassNameMap(styles);
|
|
28
38
|
const FormFieldMaskedInputBase = React__default.forwardRef(
|
|
29
39
|
({
|
|
@@ -41,10 +51,11 @@ const FormFieldMaskedInputBase = React__default.forwardRef(
|
|
|
41
51
|
const [filledLength, setFilledLength] = useState(0);
|
|
42
52
|
const pasted = useRef(false);
|
|
43
53
|
const { filled, focused, size, status } = useContext(FormFieldContext);
|
|
54
|
+
const normalizedValue = mask === presets.masks.phone ? normalizePhoneText(value).text : value;
|
|
44
55
|
useEffect(() => {
|
|
45
56
|
const calculatePlaceholderValue = () => {
|
|
46
57
|
let nextPlaceholderValue = [];
|
|
47
|
-
if (!
|
|
58
|
+
if (!normalizedValue) {
|
|
48
59
|
if (placeholderMask2) {
|
|
49
60
|
nextPlaceholderValue = placeholderMask2.split("");
|
|
50
61
|
} else {
|
|
@@ -53,8 +64,8 @@ const FormFieldMaskedInputBase = React__default.forwardRef(
|
|
|
53
64
|
}
|
|
54
65
|
setFilledLength(0);
|
|
55
66
|
} else {
|
|
56
|
-
const { conformedValue } = reactTextMaskExports.conformToMask(
|
|
57
|
-
const conformed = reactTextMaskExports.conformToMask(
|
|
67
|
+
const { conformedValue } = reactTextMaskExports.conformToMask(normalizedValue, mask, { guide: true, placeholderChar });
|
|
68
|
+
const conformed = reactTextMaskExports.conformToMask(normalizedValue, mask, {
|
|
58
69
|
guide: false,
|
|
59
70
|
placeholderChar
|
|
60
71
|
}).conformedValue;
|
|
@@ -63,7 +74,7 @@ const FormFieldMaskedInputBase = React__default.forwardRef(
|
|
|
63
74
|
if (typeof mask[i] === "string") {
|
|
64
75
|
nextPlaceholderValue[i] = conformedValue[i];
|
|
65
76
|
} else {
|
|
66
|
-
if (conformedValue[i] === placeholderChar && !
|
|
77
|
+
if (conformedValue[i] === placeholderChar && !normalizedValue[i]) {
|
|
67
78
|
nextPlaceholderValue[i] = (placeholderMask2 == null ? void 0 : placeholderMask2[i]) || placeholderChar;
|
|
68
79
|
} else {
|
|
69
80
|
nextPlaceholderValue[i] = conformedValue[i];
|
|
@@ -74,7 +85,7 @@ const FormFieldMaskedInputBase = React__default.forwardRef(
|
|
|
74
85
|
return nextPlaceholderValue.join("");
|
|
75
86
|
};
|
|
76
87
|
setPlaceholderValue(calculatePlaceholderValue());
|
|
77
|
-
}, [
|
|
88
|
+
}, [normalizedValue, mask, placeholderChar, placeholderMask2]);
|
|
78
89
|
const handlePaste = () => {
|
|
79
90
|
pasted.current = true;
|
|
80
91
|
};
|
|
@@ -90,30 +101,13 @@ const FormFieldMaskedInputBase = React__default.forwardRef(
|
|
|
90
101
|
return conformedValue;
|
|
91
102
|
};
|
|
92
103
|
const phonePipe = (text) => {
|
|
93
|
-
|
|
94
|
-
if (pasted.current) {
|
|
95
|
-
let regEx = /^[78]((\D*\d)*)/;
|
|
96
|
-
text = text.replace(regEx, "+7 ($1");
|
|
97
|
-
regEx = /^\d7/;
|
|
98
|
-
text = text.replace(regEx, (match) => {
|
|
99
|
-
indexesOfPipedChars = Array.from("+7 (").map((_, i) => i);
|
|
100
|
-
return `+7 (${match}`;
|
|
101
|
-
});
|
|
102
|
-
} else if (text === "7" || text === "8") {
|
|
103
|
-
text = "+7 (";
|
|
104
|
-
}
|
|
104
|
+
const normalized = pasted.current ? normalizePhoneText(text) : { indexesOfPipedChars: [], text: text === "7" || text === "8" ? PHONE_PREFIX : text };
|
|
105
105
|
return {
|
|
106
|
-
indexesOfPipedChars,
|
|
107
|
-
value: reactTextMaskExports.conformToMask(text, mask, { guide: false, placeholderChar }).conformedValue
|
|
106
|
+
indexesOfPipedChars: normalized.indexesOfPipedChars,
|
|
107
|
+
value: reactTextMaskExports.conformToMask(normalized.text, mask, { guide: false, placeholderChar }).conformedValue
|
|
108
108
|
};
|
|
109
109
|
};
|
|
110
|
-
const
|
|
111
|
-
if (mask === presets.masks.phone) {
|
|
112
|
-
return phonePipe(value).value;
|
|
113
|
-
}
|
|
114
|
-
return reactTextMaskExports.conformToMask(value, mask, { guide: false, placeholderChar }).conformedValue;
|
|
115
|
-
};
|
|
116
|
-
const maskedValue = getValue();
|
|
110
|
+
const maskedValue = reactTextMaskExports.conformToMask(normalizedValue, mask, { guide: false, placeholderChar }).conformedValue;
|
|
117
111
|
const inputValue = mask === presets.masks.phone ? maskedValue : value;
|
|
118
112
|
const handleChange = useCallback(
|
|
119
113
|
(event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldMaskedInput.js","sources":["../../../../src/components/FormField/components/FormFieldMaskedInput.tsx"],"sourcesContent":["import React, { useEffect, useContext, useRef, useState, useCallback } from \"react\";\nimport MaskedInputTextMask, { conformToMask, MaskedInputProps, PipeConfig } from \"react-text-mask\";\nimport clsx from \"clsx\";\nimport { DataAttributes } from \"../../../types/CoreTypes\";\nimport { presets } from \"./FormFieldMaskedInputPresets\";\nimport { FormFieldInput } from \"./FormFieldInput\";\nimport { FormFieldContext } from \"../FormFieldContext\";\nimport { TFormFieldMaskedInputMask } from \"../types\";\nimport { EFormFieldStatus } from \"../enums\";\nimport { createSizeToClassNameMap } from \"../../../utils\";\nimport styles from \"../styles/FormFieldMaskedInput.module.less\";\n\n/** Свойства компонента FormFieldMaskedInput. */\nexport interface IFormFieldMaskedInputProps\n extends Omit<MaskedInputProps, \"disabled\" | \"guide\" | \"mask\" | \"render\" | \"defaultValue\">, DataAttributes {\n /** Значение поля. Поле контролируемое, поэтому начальное значение задаётся через него, а не через defaultValue. */\n value: string;\n /** Ссылка на поле ввода. */\n forwardedRef?: React.Ref<HTMLInputElement>;\n /**\n * Маска. Каждый элемент массива должен быть либо строкой, либо регулярным выражением. Каждая строка — это фиксированный символ в маске, а каждое регулярное выражение — это заполнитель, который принимает пользовательский ввод.\n * Подробнее можно ознакомиться https://github.com/text-mask/text-mask/blob/master/componentDocumentation.md#mask.\n */\n mask: TFormFieldMaskedInputMask;\n /** Плейсхолдер, отображаемый при вводе. Например: дд.мм.гггг, при вводе будет отображаться как 22.1м.гггг. */\n placeholderMask?: string;\n}\n\n/** Соответствие размера имени класса. */\nconst SIZE_TO_CLASS_NAME_MAP = createSizeToClassNameMap(styles);\n\nconst FormFieldMaskedInputBase = React.forwardRef<HTMLDivElement, IFormFieldMaskedInputProps>(\n (\n {\n className,\n forwardedRef,\n mask,\n onChange,\n placeholder,\n placeholderChar = \"0\",\n placeholderMask,\n value,\n ...restProps\n },\n ref,\n ) => {\n // Значение инпута, отображающего часть введенного значения и оставшуюся маску.\n const [placeholderValue, setPlaceholderValue] = useState(\"\");\n const [filledLength, setFilledLength] = useState(0);\n const pasted = useRef(false);\n const { filled, focused, size, status } = useContext(FormFieldContext);\n\n useEffect(() => {\n /** Возвращает значение placeholderValue. */\n const calculatePlaceholderValue = (): string => {\n // Массив символов placeholderValue.\n let nextPlaceholderValue: string[] = [];\n\n // Значение инпута остутствует.\n if (!value) {\n // Передан props placeholderMask, например дд.мм.гггг\n if (placeholderMask) {\n // При наличии маски плейсхолдера, placeholderValue равен маски плейсхолдера.\n nextPlaceholderValue = placeholderMask.split(\"\");\n } else {\n // Маска с символами заполнения, например 00.00.00\n const { conformedValue } = conformToMask(\"\", mask, { guide: true, placeholderChar });\n nextPlaceholderValue = conformedValue.split(\"\");\n }\n setFilledLength(0);\n }\n // Инпут имеет value.\n else {\n // Value с маской, например: 22.00.00\n const { conformedValue } = conformToMask(value.toString(), mask, { guide: true, placeholderChar });\n // Нам нужна точная длина того, что уже ввел пользователь\n const conformed = conformToMask(value.toString(), mask, {\n guide: false,\n placeholderChar,\n }).conformedValue;\n setFilledLength(conformed.length);\n\n // Символы placeholderValue собираются из введенного пользователем значения и оставшейся части из placeholderMask или placeholderChar.\n for (let i = 0; i < mask.length; i++) {\n // Не редактируемый символ маски.\n if (typeof mask[i] === \"string\") {\n // Символ из маски.\n nextPlaceholderValue[i] = conformedValue[i];\n } else {\n // Не введенный пользователем символ заполняется символом placeholderMask или placeholderChar.\n if (conformedValue[i] === placeholderChar && !value.toString()[i]) {\n nextPlaceholderValue[i] = placeholderMask?.[i] || placeholderChar;\n } else {\n nextPlaceholderValue[i] = conformedValue[i];\n }\n }\n }\n }\n\n return nextPlaceholderValue.join(\"\");\n };\n\n setPlaceholderValue(calculatePlaceholderValue());\n }, [value, mask, placeholderChar, placeholderMask]);\n\n const handlePaste = () => {\n pasted.current = true;\n };\n\n // Постобработчик введенных значений. Выполняется после внутреннего форматирования и до onChange.\n const pipe = (conformedValue: string, config: PipeConfig) => {\n // Для маски с номером телефона отдельный обработчик.\n if (mask === presets.masks.phone) {\n // Пустое значение не обрабатывается, чтобы значение в инпуте можно было стереть полностью.\n if (!conformedValue.length) {\n return conformedValue;\n }\n\n return phonePipe(config.rawValue);\n } else if (mask === presets.masks.swiftCode) {\n return conformedValue.toUpperCase();\n }\n\n return conformedValue;\n };\n\n // Постобработчик введенных значений, если маска является номером телефона.\n const phonePipe = (text: string) => {\n let indexesOfPipedChars: number[] = [];\n\n if (pasted.current) {\n // Выражение для поиска чисел из 1 цифры и более, начинающихся с 7 или 8\n let regEx = /^[78]((\\D*\\d)*)/;\n\n text = text.replace(regEx, \"+7 ($1\");\n\n // Выражение для поиска чисел вида {любая цифра}7, например 87, 971 и т.д.\n regEx = /^\\d7/;\n\n // Если вторая цифра номера 7, добавляется +7 перед этим, иначе conformToMask вместо 9701234567 вернет +7901234567.\n text = text.replace(regEx, (match) => {\n indexesOfPipedChars = Array.from(\"+7 (\").map((_, i) => i);\n return `+7 (${match}`;\n });\n } else if (text === \"7\" || text === \"8\") {\n // Если первая введенная цифра 7 или 8, заменяем её на +7 (\n text = \"+7 (\";\n }\n\n return {\n indexesOfPipedChars,\n value: conformToMask(text, mask, { guide: false, placeholderChar }).conformedValue,\n };\n };\n\n // Возвращает value, приведённое к маске. Для некоторых типов масок, value приходится модифицировать из-за багов.\n const getValue = (): string => {\n if (mask === presets.masks.phone) {\n return phonePipe(value).value;\n }\n\n return conformToMask(value, mask, { guide: false, placeholderChar }).conformedValue;\n };\n\n // Значение, приведённое к маске, — уходит в react-text-mask.\n const maskedValue = getValue();\n /*\n * Значение, отображаемое в input. Для маски телефона — приведённое к маске (телефон нормализует\n * ввод с 7/8/+7 в начале, без этого react-text-mask форматирует номер неверно), для остальных масок —\n * исходное: react-text-mask сам пишет отформатированное значение в DOM, а исходное значение нужно,\n * чтобы можно было стереть символ-разделитель (иначе маска тут же возвращает его обратно).\n */\n const inputValue = mask === presets.masks.phone ? maskedValue : value;\n\n const handleChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const { value: nextValue } = event.target;\n\n pasted.current = false;\n\n // Сравнивается именно отображаемое значение: react-text-mask успевает отформатировать\n // DOM до вызова обработчика, поэтому nextValue уже приведено к маске.\n if (inputValue !== nextValue) {\n onChange?.(event);\n }\n },\n [inputValue, onChange],\n );\n\n /** Функция для хранения ссылки. */\n const setRef = (ref: (inputElement: HTMLElement) => void) => (instance: HTMLInputElement | null) => {\n if (instance) {\n ref(instance);\n }\n if (typeof forwardedRef === \"function\") {\n forwardedRef(instance);\n } else if (forwardedRef) {\n (forwardedRef as React.MutableRefObject<HTMLInputElement | null>).current = instance;\n }\n };\n\n const getPlaceholderValue = () => {\n if ((!filled && !focused) || (!value && placeholder)) {\n return \"\";\n }\n return placeholderValue;\n };\n\n return (\n <div className={clsx(styles.formFieldMaskedInputWrapper, className)} ref={ref}>\n {getPlaceholderValue() && (\n <div className={clsx(styles.maskLayout, SIZE_TO_CLASS_NAME_MAP[size])} aria-hidden=\"true\">\n <span className={styles.valueMirror}>{placeholderValue.slice(0, filledLength)}</span>\n <span\n className={clsx(styles.placeholderMask, {\n [styles.disabled]: status === EFormFieldStatus.DISABLED,\n })}\n >\n {placeholderValue.slice(filledLength)}\n </span>\n </div>\n )}\n\n {/* Input, отображающий введенное значение. */}\n <MaskedInputTextMask\n disabled={status === EFormFieldStatus.DISABLED}\n /* Input отображает только введенное значение без маски, маска рисуется в inputPlaceholder. */\n guide={false}\n render={(ref, props) => (\n <FormFieldInput\n {...props}\n // react-text-mask подставляет в props defaultValue, равное value (https://github.com/text-mask/text-mask/pull/993).\n // На контролируемом input это даёт предупреждение React «both value and defaultValue props».\n defaultValue={undefined}\n value={inputValue}\n placeholder={placeholder || \"\"}\n ref={setRef(ref)}\n />\n )}\n mask={mask}\n onChange={handleChange}\n onPaste={handlePaste}\n placeholderChar={placeholderChar}\n // value={value} не используется т.к. возникает баг при передаче снаружи изначально пустого value, а затем не пустого.\n value={maskedValue}\n pipe={pipe}\n type=\"text\"\n {...restProps}\n />\n </div>\n );\n },\n);\n\nFormFieldMaskedInputBase.displayName = \"FormFieldMaskedInput\";\n\n/**\n * Компонент маскированного ввода.\n * Основан на https://github.com/text-mask/text-mask.\n */\nexport const FormFieldMaskedInput = Object.assign(FormFieldMaskedInputBase, { presets });\n"],"names":["React","placeholderMask","conformToMask","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,yBAAyB,yBAAyB,MAAM;AAE9D,MAAM,2BAA2BA,eAAM;AAAA,EACnC,CACI;AAAA,IACI;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,IAClB,iBAAAC;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEP,QACC;AAED,UAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAS,EAAE;AAC3D,U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AAAA,UACV,SAAS;AAAA,UACT;AAAA,UAEA,OAAO;AAAA,UACP;AAAA,UACA,MAAK;AAAA,UACJ,GAAG;AAAA,QAAA;AAAA,MAAA;AAAA,IACR,GACJ;AAAA,EAER;AACJ;AAEA,yBAAyB,cAAc;AAMhC,MAAM,uBAAuB,OAAO,OAAO,0BAA0B,EAAE,SAAS;"}
|
|
1
|
+
{"version":3,"file":"FormFieldMaskedInput.js","sources":["../../../../src/components/FormField/components/FormFieldMaskedInput.tsx"],"sourcesContent":["import React, { useEffect, useContext, useRef, useState, useCallback } from \"react\";\nimport MaskedInputTextMask, { conformToMask, MaskedInputProps, PipeConfig } from \"react-text-mask\";\nimport clsx from \"clsx\";\nimport { DataAttributes } from \"../../../types/CoreTypes\";\nimport { presets } from \"./FormFieldMaskedInputPresets\";\nimport { FormFieldInput } from \"./FormFieldInput\";\nimport { FormFieldContext } from \"../FormFieldContext\";\nimport { TFormFieldMaskedInputMask } from \"../types\";\nimport { EFormFieldStatus } from \"../enums\";\nimport { createSizeToClassNameMap } from \"../../../utils\";\nimport styles from \"../styles/FormFieldMaskedInput.module.less\";\n\n/** Свойства компонента FormFieldMaskedInput. */\nexport interface IFormFieldMaskedInputProps\n extends Omit<MaskedInputProps, \"disabled\" | \"guide\" | \"mask\" | \"render\" | \"defaultValue\">, DataAttributes {\n /** Значение поля. Поле контролируемое, поэтому начальное значение задаётся через него, а не через defaultValue. */\n value: string;\n /** Ссылка на поле ввода. */\n forwardedRef?: React.Ref<HTMLInputElement>;\n /**\n * Маска. Каждый элемент массива должен быть либо строкой, либо регулярным выражением. Каждая строка — это фиксированный символ в маске, а каждое регулярное выражение — это заполнитель, который принимает пользовательский ввод.\n * Подробнее можно ознакомиться https://github.com/text-mask/text-mask/blob/master/componentDocumentation.md#mask.\n */\n mask: TFormFieldMaskedInputMask;\n /** Плейсхолдер, отображаемый при вводе. Например: дд.мм.гггг, при вводе будет отображаться как 22.1м.гггг. */\n placeholderMask?: string;\n}\n\nconst PHONE_PREFIX = \"+7 (\";\n\n/**\n * Приводит произвольный номер к виду, который корректно раскладывается по маске телефона.\n * Ведущий код страны 7 или 8 заменяется на \"+7 (\", а номер, у которого вторая цифра 7,\n * дополняется этим же префиксом — иначе conformToMask примет первую цифру номера\n * за литерал \"7\" из маски и потеряет последнюю цифру.\n */\nconst normalizePhoneText = (text: string): { indexesOfPipedChars: number[]; text: string } => {\n let indexesOfPipedChars: number[] = [];\n\n // Поиск числа из 1 цифры и более, начинающегося с 7 или 8.\n let nextText = text.replace(/^[78]((\\D*\\d)*)/, `${PHONE_PREFIX}$1`);\n\n // Поиск числа вида {любая цифра}7, например 87, 971 и т.д., и добавление +7 перед ним.\n nextText = nextText.replace(/^\\d7/, (match) => {\n indexesOfPipedChars = Array.from(PHONE_PREFIX).map((_, i) => i);\n return `${PHONE_PREFIX}${match}`;\n });\n\n return { indexesOfPipedChars, text: nextText };\n};\n\n/** Соответствие размера имени класса. */\nconst SIZE_TO_CLASS_NAME_MAP = createSizeToClassNameMap(styles);\n\nconst FormFieldMaskedInputBase = React.forwardRef<HTMLDivElement, IFormFieldMaskedInputProps>(\n (\n {\n className,\n forwardedRef,\n mask,\n onChange,\n placeholder,\n placeholderChar = \"0\",\n placeholderMask,\n value,\n ...restProps\n },\n ref,\n ) => {\n // Значение инпута, отображающего часть введенного значения и оставшуюся маску.\n const [placeholderValue, setPlaceholderValue] = useState(\"\");\n const [filledLength, setFilledLength] = useState(0);\n const pasted = useRef(false);\n const { filled, focused, size, status } = useContext(FormFieldContext);\n\n /*\n * Для маски телефона значение приводится к виду с префиксом \"+7 (\" — см. normalizePhoneText,\n * для остальных масок используется как есть. Приведение выполняется один раз здесь, потому что\n * одно и то же значение нужно и инпуту, и слою с маской: посчитанные по разным значениям,\n * введённый текст и маска под ним разъезжаются.\n */\n const normalizedValue = mask === presets.masks.phone ? normalizePhoneText(value).text : value;\n\n useEffect(() => {\n /** Возвращает значение placeholderValue. */\n const calculatePlaceholderValue = (): string => {\n // Массив символов placeholderValue.\n let nextPlaceholderValue: string[] = [];\n\n // Значение инпута остутствует.\n if (!normalizedValue) {\n // Передан props placeholderMask, например дд.мм.гггг\n if (placeholderMask) {\n // При наличии маски плейсхолдера, placeholderValue равен маски плейсхолдера.\n nextPlaceholderValue = placeholderMask.split(\"\");\n } else {\n // Маска с символами заполнения, например 00.00.00\n const { conformedValue } = conformToMask(\"\", mask, { guide: true, placeholderChar });\n nextPlaceholderValue = conformedValue.split(\"\");\n }\n setFilledLength(0);\n }\n // Инпут имеет value.\n else {\n // Value с маской, например: 22.00.00\n const { conformedValue } = conformToMask(normalizedValue, mask, { guide: true, placeholderChar });\n // Нам нужна точная длина того, что уже ввел пользователь\n const conformed = conformToMask(normalizedValue, mask, {\n guide: false,\n placeholderChar,\n }).conformedValue;\n setFilledLength(conformed.length);\n\n // Символы placeholderValue собираются из введенного пользователем значения и оставшейся части из placeholderMask или placeholderChar.\n for (let i = 0; i < mask.length; i++) {\n // Не редактируемый символ маски.\n if (typeof mask[i] === \"string\") {\n // Символ из маски.\n nextPlaceholderValue[i] = conformedValue[i];\n } else {\n // Не введенный пользователем символ заполняется символом placeholderMask или placeholderChar.\n if (conformedValue[i] === placeholderChar && !normalizedValue[i]) {\n nextPlaceholderValue[i] = placeholderMask?.[i] || placeholderChar;\n } else {\n nextPlaceholderValue[i] = conformedValue[i];\n }\n }\n }\n }\n\n return nextPlaceholderValue.join(\"\");\n };\n\n setPlaceholderValue(calculatePlaceholderValue());\n }, [normalizedValue, mask, placeholderChar, placeholderMask]);\n\n const handlePaste = () => {\n pasted.current = true;\n };\n\n // Постобработчик введенных значений. Выполняется после внутреннего форматирования и до onChange.\n const pipe = (conformedValue: string, config: PipeConfig) => {\n // Для маски с номером телефона отдельный обработчик.\n if (mask === presets.masks.phone) {\n // Пустое значение не обрабатывается, чтобы значение в инпуте можно было стереть полностью.\n if (!conformedValue.length) {\n return conformedValue;\n }\n\n return phonePipe(config.rawValue);\n } else if (mask === presets.masks.swiftCode) {\n return conformedValue.toUpperCase();\n }\n\n return conformedValue;\n };\n\n // Постобработчик введенных значений, если маска является номером телефона.\n const phonePipe = (text: string) => {\n // При вставке номер может прийти в любом виде, поэтому нормализуется целиком.\n // При ручном вводе нормализуется только первая цифра: дальше в text уже есть префикс \"+7 (\".\n const normalized = pasted.current\n ? normalizePhoneText(text)\n : { indexesOfPipedChars: [], text: text === \"7\" || text === \"8\" ? PHONE_PREFIX : text };\n\n return {\n indexesOfPipedChars: normalized.indexesOfPipedChars,\n value: conformToMask(normalized.text, mask, { guide: false, placeholderChar }).conformedValue,\n };\n };\n\n // Значение, приведённое к маске, — уходит в react-text-mask.\n const maskedValue = conformToMask(normalizedValue, mask, { guide: false, placeholderChar }).conformedValue;\n /*\n * Значение, отображаемое в input. Для маски телефона — приведённое к маске (телефон нормализует\n * ввод с 7/8/+7 в начале, без этого react-text-mask форматирует номер неверно), для остальных масок —\n * исходное: react-text-mask сам пишет отформатированное значение в DOM, а исходное значение нужно,\n * чтобы можно было стереть символ-разделитель (иначе маска тут же возвращает его обратно).\n */\n const inputValue = mask === presets.masks.phone ? maskedValue : value;\n\n const handleChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const { value: nextValue } = event.target;\n\n pasted.current = false;\n\n // Сравнивается именно отображаемое значение: react-text-mask успевает отформатировать\n // DOM до вызова обработчика, поэтому nextValue уже приведено к маске.\n if (inputValue !== nextValue) {\n onChange?.(event);\n }\n },\n [inputValue, onChange],\n );\n\n /** Функция для хранения ссылки. */\n const setRef = (ref: (inputElement: HTMLElement) => void) => (instance: HTMLInputElement | null) => {\n if (instance) {\n ref(instance);\n }\n if (typeof forwardedRef === \"function\") {\n forwardedRef(instance);\n } else if (forwardedRef) {\n (forwardedRef as React.MutableRefObject<HTMLInputElement | null>).current = instance;\n }\n };\n\n const getPlaceholderValue = () => {\n if ((!filled && !focused) || (!value && placeholder)) {\n return \"\";\n }\n return placeholderValue;\n };\n\n return (\n <div className={clsx(styles.formFieldMaskedInputWrapper, className)} ref={ref}>\n {getPlaceholderValue() && (\n <div className={clsx(styles.maskLayout, SIZE_TO_CLASS_NAME_MAP[size])} aria-hidden=\"true\">\n <span className={styles.valueMirror}>{placeholderValue.slice(0, filledLength)}</span>\n <span\n className={clsx(styles.placeholderMask, {\n [styles.disabled]: status === EFormFieldStatus.DISABLED,\n })}\n >\n {placeholderValue.slice(filledLength)}\n </span>\n </div>\n )}\n\n {/* Input, отображающий введенное значение. */}\n <MaskedInputTextMask\n disabled={status === EFormFieldStatus.DISABLED}\n /* Input отображает только введенное значение без маски, маска рисуется в inputPlaceholder. */\n guide={false}\n render={(ref, props) => (\n <FormFieldInput\n {...props}\n // react-text-mask подставляет в props defaultValue, равное value (https://github.com/text-mask/text-mask/pull/993).\n // На контролируемом input это даёт предупреждение React «both value and defaultValue props».\n defaultValue={undefined}\n value={inputValue}\n placeholder={placeholder || \"\"}\n ref={setRef(ref)}\n />\n )}\n mask={mask}\n onChange={handleChange}\n onPaste={handlePaste}\n placeholderChar={placeholderChar}\n // value={value} не используется т.к. возникает баг при передаче снаружи изначально пустого value, а затем не пустого.\n value={maskedValue}\n pipe={pipe}\n type=\"text\"\n {...restProps}\n />\n </div>\n );\n },\n);\n\nFormFieldMaskedInputBase.displayName = \"FormFieldMaskedInput\";\n\n/**\n * Компонент маскированного ввода.\n * Основан на https://github.com/text-mask/text-mask.\n */\nexport const FormFieldMaskedInput = Object.assign(FormFieldMaskedInputBase, { presets });\n"],"names":["React","placeholderMask","conformToMask","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAM,eAAe;AAQrB,MAAM,qBAAqB,CAAC,SAAkE;AAC1F,MAAI,sBAAgC,CAAA;AAGpC,MAAI,WAAW,KAAK,QAAQ,mBAAmB,GAAG,YAAY,IAAI;AAGlE,aAAW,SAAS,QAAQ,QAAQ,CAAC,UAAU;AAC3C,0BAAsB,MAAM,KAAK,YAAY,EAAE,IAAI,CAAC,GAAG,MAAM,CAAC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AAAA,cAC5B,KAAK,OAAOA,IAAG;AAAA,YAAA;AAAA,UAAA;AAAA,UAGvB;AAAA,UACA,UAAU;AAAA,UACV,SAAS;AAAA,UACT;AAAA,UAEA,OAAO;AAAA,UACP;AAAA,UACA,MAAK;AAAA,UACJ,GAAG;AAAA,QAAA;AAAA,MAAA;AAAA,IACR,GACJ;AAAA,EAER;AACJ;AAEA,yBAAyB,cAAc;AAMhC,MAAM,uBAAuB,OAAO,OAAO,0BAA0B,EAAE,SAAS;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import React__default, { useContext } from "react";
|
|
3
|
-
import { c as clsx } from "../../../chunks/vendor-
|
|
3
|
+
import { c as clsx } from "../../../chunks/vendor-CUIykw0y.js";
|
|
4
4
|
import { FormFieldContext } from "../FormFieldContext.js";
|
|
5
5
|
import { useFormFieldAffixWidth } from "./useFormFieldAffixWidth.js";
|
|
6
|
-
const formFieldPostfix = "
|
|
6
|
+
const formFieldPostfix = "formFieldPostfix__b353b7c0";
|
|
7
7
|
const styles = {
|
|
8
8
|
formFieldPostfix
|
|
9
9
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import React__default, { useContext } from "react";
|
|
3
|
-
import { c as clsx } from "../../../chunks/vendor-
|
|
3
|
+
import { c as clsx } from "../../../chunks/vendor-CUIykw0y.js";
|
|
4
4
|
import { FormFieldContext } from "../FormFieldContext.js";
|
|
5
5
|
import { useFormFieldAffixWidth } from "./useFormFieldAffixWidth.js";
|
|
6
|
-
const formFieldPrefix = "
|
|
6
|
+
const formFieldPrefix = "formFieldPrefix__2ff27310";
|
|
7
7
|
const styles = {
|
|
8
8
|
formFieldPrefix
|
|
9
9
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import React__default, { useContext, useMemo, useLayoutEffect, useCallback } from "react";
|
|
3
|
-
import { u as uniqueId, c as clsx } from "../../../chunks/vendor-
|
|
3
|
+
import { u as uniqueId, c as clsx } from "../../../chunks/vendor-CUIykw0y.js";
|
|
4
4
|
import { FormFieldContext } from "../FormFieldContext.js";
|
|
5
5
|
import { EFormFieldStatus } from "../enums.js";
|
|
6
6
|
import { createSizeToClassNameMap } from "../../../utils/classNameMaps.js";
|
|
7
|
-
const formFieldTarget = "
|
|
8
|
-
const sm = "
|
|
9
|
-
const md = "
|
|
10
|
-
const lg = "
|
|
11
|
-
const placeholder = "
|
|
12
|
-
const disabled = "
|
|
13
|
-
const placeholderWrapper = "
|
|
14
|
-
const active = "
|
|
7
|
+
const formFieldTarget = "formFieldTarget__6bdcb964";
|
|
8
|
+
const sm = "sm__ed5d7a26";
|
|
9
|
+
const md = "md__cfe15086";
|
|
10
|
+
const lg = "lg__961e2e6d";
|
|
11
|
+
const placeholder = "placeholder__0327b36b";
|
|
12
|
+
const disabled = "disabled__f8e0d3d6";
|
|
13
|
+
const placeholderWrapper = "placeholderWrapper__b88c409b";
|
|
14
|
+
const active = "active__368ac277";
|
|
15
15
|
const styles = {
|
|
16
16
|
formFieldTarget,
|
|
17
17
|
sm,
|
|
@@ -25,7 +25,7 @@ const styles = {
|
|
|
25
25
|
const sizeToClassNameMap = createSizeToClassNameMap(styles);
|
|
26
26
|
const FormFieldTarget = React__default.forwardRef(
|
|
27
27
|
({ children, id: idProp, className, placeholder: placeholder2, onFocus, onBlur, ...restProps }, ref) => {
|
|
28
|
-
const { size, status, active: active2, labelId, setFilled, setFocused
|
|
28
|
+
const { size, status, active: active2, labelId, setFilled, setFocused } = useContext(FormFieldContext);
|
|
29
29
|
const id = useMemo(() => idProp === void 0 ? uniqueId("target_") : idProp, [idProp]);
|
|
30
30
|
const childrenExist = useMemo(() => React__default.Children.toArray(children).length !== 0, [children]);
|
|
31
31
|
const classNames = clsx(styles.formFieldTarget, sizeToClassNameMap[size], className, {
|
|
@@ -33,9 +33,6 @@ const FormFieldTarget = React__default.forwardRef(
|
|
|
33
33
|
[styles.placeholder]: !!placeholder2 && !childrenExist && status !== EFormFieldStatus.DISABLED,
|
|
34
34
|
[styles.active]: active2
|
|
35
35
|
});
|
|
36
|
-
useLayoutEffect(() => {
|
|
37
|
-
setTargetId(id);
|
|
38
|
-
}, [id, setTargetId]);
|
|
39
36
|
useLayoutEffect(() => {
|
|
40
37
|
setFilled(childrenExist);
|
|
41
38
|
}, [childrenExist, setFilled]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldTarget.js","sources":["../../../../src/components/FormField/components/FormFieldTarget.tsx"],"sourcesContent":["import React, { useContext, useMemo, useLayoutEffect, useCallback } from \"react\";\nimport clsx from \"clsx\";\nimport { uniqueId } from \"lodash-es\";\nimport { FormFieldContext } from \"../FormFieldContext\";\nimport { EFormFieldStatus } from \"@sberbusiness/triplex-next/components/FormField/enums\";\nimport { createSizeToClassNameMap } from \"../../../utils/classNameMaps\";\nimport styles from \"../styles/FormFieldTarget.module.less\";\n\n/** Свойства компонента FormFieldTarget. */\nexport interface IFormFieldTargetProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Текст, или компонент отображающий выбранное placeholder. Отличие от children в том, что placeholder отображается только когда нет children и более бледным цветом. */\n placeholder?: React.ReactNode;\n}\n\nconst sizeToClassNameMap = createSizeToClassNameMap(styles);\n\n/** Компонент, отображающий нередактируемое значение. */\nexport const FormFieldTarget = React.forwardRef<HTMLDivElement, IFormFieldTargetProps>(\n ({ children, id: idProp, className, placeholder, onFocus, onBlur, ...restProps }, ref) => {\n const { size, status, active, labelId, setFilled, setFocused
|
|
1
|
+
{"version":3,"file":"FormFieldTarget.js","sources":["../../../../src/components/FormField/components/FormFieldTarget.tsx"],"sourcesContent":["import React, { useContext, useMemo, useLayoutEffect, useCallback } from \"react\";\nimport clsx from \"clsx\";\nimport { uniqueId } from \"lodash-es\";\nimport { FormFieldContext } from \"../FormFieldContext\";\nimport { EFormFieldStatus } from \"@sberbusiness/triplex-next/components/FormField/enums\";\nimport { createSizeToClassNameMap } from \"../../../utils/classNameMaps\";\nimport styles from \"../styles/FormFieldTarget.module.less\";\n\n/** Свойства компонента FormFieldTarget. */\nexport interface IFormFieldTargetProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Текст, или компонент отображающий выбранное placeholder. Отличие от children в том, что placeholder отображается только когда нет children и более бледным цветом. */\n placeholder?: React.ReactNode;\n}\n\nconst sizeToClassNameMap = createSizeToClassNameMap(styles);\n\n/** Компонент, отображающий нередактируемое значение. */\nexport const FormFieldTarget = React.forwardRef<HTMLDivElement, IFormFieldTargetProps>(\n ({ children, id: idProp, className, placeholder, onFocus, onBlur, ...restProps }, ref) => {\n const { size, status, active, labelId, setFilled, setFocused } = useContext(FormFieldContext);\n const id = useMemo(() => (idProp === undefined ? uniqueId(\"target_\") : idProp), [idProp]);\n const childrenExist = useMemo(() => React.Children.toArray(children).length !== 0, [children]);\n const classNames = clsx(styles.formFieldTarget, sizeToClassNameMap[size], className, {\n [styles.disabled]: status === EFormFieldStatus.DISABLED,\n [styles.placeholder]: !!placeholder && !childrenExist && status !== EFormFieldStatus.DISABLED,\n [styles.active]: active,\n });\n\n useLayoutEffect(() => {\n setFilled(childrenExist);\n }, [childrenExist, setFilled]);\n\n const handleFocus = useCallback<React.FocusEventHandler<HTMLDivElement>>(\n (event) => {\n setFocused(true);\n onFocus?.(event);\n },\n [onFocus, setFocused],\n );\n\n const handleBlur = useCallback<React.FocusEventHandler<HTMLDivElement>>(\n (event) => {\n setFocused(false);\n onBlur?.(event);\n },\n [onBlur, setFocused],\n );\n\n return (\n <div\n {...restProps}\n id={id}\n className={classNames}\n tabIndex={status === EFormFieldStatus.DISABLED ? -1 : 0}\n aria-labelledby={labelId}\n aria-disabled={status === EFormFieldStatus.DISABLED}\n onBlur={handleBlur}\n onFocus={handleFocus}\n ref={ref}\n >\n {childrenExist ? children : <span className={styles.placeholderWrapper}>{placeholder}</span>}\n </div>\n );\n },\n);\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AW,KAAK;AAAA,QACtD,mBAAiB;AAAA,QACjB,iBAAe,WAAW,iBAAiB;AAAA,QAC3C,QAAQ;AAAA,QACR,SAAS;AAAA,QACT;AAAA,QAEC,0BAAgB,WAAW,oBAAC,UAAK,WAAW,OAAO,oBAAqB,UAAAD,aAAA,CAAY;AAAA,MAAA;AAAA,IAAA;AAAA,EAGjG;AACJ;AAEA,gBAAgB,cAAc;"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import React__default, { useContext, useMemo, useCallback, useLayoutEffect } from "react";
|
|
3
|
-
import { u as uniqueId, c as clsx } from "../../../chunks/vendor-
|
|
3
|
+
import { u as uniqueId, c as clsx } from "../../../chunks/vendor-CUIykw0y.js";
|
|
4
4
|
import { createSizeToClassNameMap } from "../../../utils/classNameMaps.js";
|
|
5
5
|
import { FormFieldContext } from "../FormFieldContext.js";
|
|
6
6
|
import { EFormFieldStatus } from "../enums.js";
|
|
7
7
|
import { isFilled } from "./utils.js";
|
|
8
|
-
const formFieldTextarea = "
|
|
9
|
-
const sm = "
|
|
10
|
-
const md = "
|
|
11
|
-
const lg = "
|
|
8
|
+
const formFieldTextarea = "formFieldTextarea__993b6527";
|
|
9
|
+
const sm = "sm__ed5d7a26";
|
|
10
|
+
const md = "md__cfe15086";
|
|
11
|
+
const lg = "lg__961e2e6d";
|
|
12
12
|
const styles = {
|
|
13
13
|
formFieldTextarea,
|
|
14
14
|
sm,
|
|
@@ -29,6 +29,7 @@ const FormFieldTextarea = React__default.forwardRef(
|
|
|
29
29
|
);
|
|
30
30
|
useLayoutEffect(() => {
|
|
31
31
|
setTargetId(id);
|
|
32
|
+
return () => setTargetId((currentTargetId) => currentTargetId === id ? void 0 : currentTargetId);
|
|
32
33
|
}, [id, setTargetId]);
|
|
33
34
|
useLayoutEffect(() => {
|
|
34
35
|
syncFilled(value ?? defaultValue);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldTextarea.js","sources":["../../../../src/components/FormField/components/FormFieldTextarea.tsx"],"sourcesContent":["import React, { useContext, useMemo, useCallback, useLayoutEffect } from \"react\";\nimport clsx from \"clsx\";\nimport { uniqueId } from \"lodash-es\";\nimport { createSizeToClassNameMap } from \"../../../utils/classNameMaps\";\nimport { FormFieldContext } from \"../FormFieldContext\";\nimport { EFormFieldStatus } from \"../enums\";\nimport { isFilled } from \"./utils\";\nimport styles from \"../styles/FormFieldTextarea.module.less\";\n\n
|
|
1
|
+
{"version":3,"file":"FormFieldTextarea.js","sources":["../../../../src/components/FormField/components/FormFieldTextarea.tsx"],"sourcesContent":["import React, { useContext, useMemo, useCallback, useLayoutEffect } from \"react\";\nimport clsx from \"clsx\";\nimport { uniqueId } from \"lodash-es\";\nimport { createSizeToClassNameMap } from \"../../../utils/classNameMaps\";\nimport { FormFieldContext } from \"../FormFieldContext\";\nimport { EFormFieldStatus } from \"../enums\";\nimport { isFilled } from \"./utils\";\nimport styles from \"../styles/FormFieldTextarea.module.less\";\n\n/**\n * Свойства компонента FormFieldTextarea.\n *\n * Атрибут disabled исключён намеренно: блокировка задаётся статусом поля (EFormFieldStatus.DISABLED), и переданное\n * значение всё равно было бы перетёрто. Так же устроен FormFieldInput.\n */\nexport interface IFormFieldTextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, \"disabled\"> {}\n\n// Соответствие размера имени класса.\nconst sizeToClassNameMap = createSizeToClassNameMap(styles);\n\n/** Компонент, отображающий textarea. */\nexport const FormFieldTextarea = React.forwardRef<HTMLTextAreaElement, IFormFieldTextareaProps>(\n (\n { id: idProp, className, value, defaultValue, onFocus, onBlur, onAnimationStart, onChange, ...restProps },\n ref,\n ) => {\n const { size, status, setFocused, setTargetId, setFilled } = useContext(FormFieldContext);\n const id = useMemo(() => (idProp === undefined ? uniqueId(\"textarea_\") : idProp), [idProp]);\n const classNames = clsx(styles.formFieldTextarea, sizeToClassNameMap[size], className);\n\n const syncFilled = useCallback(\n (nextValue: IFormFieldTextareaProps[\"value\"]) => {\n setFilled(isFilled(nextValue));\n },\n [setFilled],\n );\n\n useLayoutEffect(() => {\n setTargetId(id);\n return () => setTargetId((currentTargetId) => (currentTargetId === id ? undefined : currentTargetId));\n }, [id, setTargetId]);\n\n useLayoutEffect(() => {\n syncFilled(value ?? defaultValue);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useLayoutEffect(() => {\n if (value !== undefined) {\n syncFilled(value);\n }\n }, [value, syncFilled]);\n\n const handleFocus = useCallback<React.FocusEventHandler<HTMLTextAreaElement>>(\n (event) => {\n syncFilled(event.currentTarget.value);\n setFocused(true);\n onFocus?.(event);\n },\n [syncFilled, setFocused, onFocus],\n );\n\n const handleBlur = useCallback<React.FocusEventHandler<HTMLTextAreaElement>>(\n (event) => {\n syncFilled(event.currentTarget.value);\n setFocused(false);\n onBlur?.(event);\n },\n [syncFilled, setFocused, onBlur],\n );\n\n /**\n * Обработчик начала анимации.\n *\n * Текущая реализация необходима для кейсов с автозаполнением:\n * - Браузер устанавливает значение в поле при загрузке страницы;\n * - Браузер устанавливает значение в поле при навигации пользователем по сохранённым опциям заполнения.\n */\n const handleAnimationStart = useCallback<React.AnimationEventHandler<HTMLTextAreaElement>>(\n (event) => {\n if (event.animationName.startsWith(\"autofill-applied-hook\")) {\n setFilled(true);\n } else if (event.animationName.startsWith(\"autofill-cancelled-hook\")) {\n // Необходимо проверить, что при отмене автозаполнения, в поле не находится значение.\n syncFilled(event.currentTarget.value);\n }\n onAnimationStart?.(event);\n },\n [setFilled, syncFilled, onAnimationStart],\n );\n\n const handleChange = useCallback<React.ChangeEventHandler<HTMLTextAreaElement>>(\n (event) => {\n syncFilled(event.currentTarget.value);\n onChange?.(event);\n },\n [onChange, syncFilled],\n );\n\n return (\n <textarea\n {...restProps}\n id={id}\n className={classNames}\n value={value}\n defaultValue={defaultValue}\n disabled={status === EFormFieldStatus.DISABLED}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onAnimationStart={handleAnimationStart}\n onChange={handleChange}\n ref={ref}\n />\n );\n },\n);\n\nFormFieldTextarea.displayName = \"FormFieldTextarea\";\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,MAAM,qBAAqB,yBAAyB,MAAM;AAGnD,MAAM,oBAAoBA,eAAM;AAAA,EACnC,CACI,EAAE,IAAI,QAAQ,WAAW,OAAO,cAAc,SAAS,QAAQ,kBAAkB,UAAU,GAAG,UAAA,GAC9F,QACC;AACD,UAAM,EAAE,MAAM,QAAQ,YAAY,aAAa,UAAA,IAAc,WAAW,gBAAgB;AACxF,UAAM,KAAK,QAAQ,MAAO,WAAW,SAAY,SAAS,WAAW,IAAI,QAAS,CAAC,MAAM,CAAC;AAC1F,UAAM,aAAa,KAAK,OAAO,mBAAmB,mBAAmB,IAAI,GAAG,SAAS;AAErF,UAAM,aAAa;AAAA,MACf,CAAC,cAAgD;AAC7C,kBAAU,SAAS,SAAS,CAAC;AAAA,MACjC;AAAA,MACA,CAAC,SAAS;AAAA,IAAA;AAGd,oBAAgB,MAAM;AAClB,kBAAY,EAAE;AACd,aAAO,MAAM,YAAY,CAAC,oBAAqB,oBAAoB,KAAK,SAAY,eAAgB;AAAA,IACxG,GAAG,CAAC,IAAI,WAAW,CAAC;AAEpB,oBAAgB,MAAM;AAClB,iBAAW,SAAS,YAAY;AAAA,IAEpC,GAAG,CAAA,CAAE;AAEL,oBAAgB,MAAM;AAClB,UAAI,UAAU,QAAW;AACrB,mBAAW,KAAK;AAAA,MACpB;AAAA,IACJ,GAAG,CAAC,OAAO,UAAU,CAAC;AAEtB,UAAM,cAAc;AAAA,MAChB,CAAC,UAAU;AACP,mBAAW,MAAM,cAAc,KAAK;AACpC,mBAAW,IAAI;AACf,2CAAU;AAAA,MACd;AAAA,MACA,CAAC,YAAY,YAAY,OAAO;AAAA,IAAA;AAGpC,UAAM,aAAa;AAAA,MACf,CAAC,UAAU;AACP,mBAAW,MAAM,cAAc,KAAK;AACpC,mBAAW,KAAK;AAChB,yCAAS;AAAA,MACb;AAAA,MACA,CAAC,YAAY,YAAY,MAAM;AAAA,IAAA;AAUnC,UAAM,uBAAuB;AAAA,MACzB,CAAC,UAAU;AACP,YAAI,MAAM,cAAc,WAAW,uBAAuB,GAAG;AACzD,oBAAU,IAAI;AAAA,QAClB,WAAW,MAAM,cAAc,WAAW,yBAAyB,GAAG;AAElE,qBAAW,MAAM,cAAc,KAAK;AAAA,QACxC;AACA,6DAAmB;AAAA,MACvB;AAAA,MACA,CAAC,WAAW,YAAY,gBAAgB;AAAA,IAAA;AAG5C,UAAM,eAAe;AAAA,MACjB,CAAC,UAAU;AACP,mBAAW,MAAM,cAAc,KAAK;AACpC,6CAAW;AAAA,MACf;AAAA,MACA,CAAC,UAAU,UAAU;AAAA,IAAA;AAGzB,WACI;AAAA,MAAC;AAAA,MAAA;AAAA,QACI,GAAG;AAAA,QACJ;AAAA,QACA,WAAW;AAAA,QACX;AAAA,QACA;AAAA,QACA,UAAU,WAAW,iBAAiB;AAAA,QACtC,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,kBAAkB;AAAA,QAClB,UAAU;AAAA,QACV;AAAA,MAAA;AAAA,IAAA;AAAA,EAGZ;AACJ;AAEA,kBAAkB,cAAc;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRef, useCallback, useEffect } from "react";
|
|
2
2
|
import { TARGET_PADDING_X_DEFAULT } from "../consts.js";
|
|
3
|
-
import { setForwardedRef } from "
|
|
3
|
+
import { setForwardedRef } from "../../../helpers/setForwardedRef.js";
|
|
4
4
|
const useFormFieldAffixWidth = (setWidth, forwardedRef) => {
|
|
5
5
|
const elementRef = useRef(null);
|
|
6
6
|
const setRef = useCallback(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormFieldAffixWidth.js","sources":["../../../../src/components/FormField/components/useFormFieldAffixWidth.ts"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from \"react\";\nimport { TARGET_PADDING_X_DEFAULT } from \"../consts\";\nimport { setForwardedRef } from \"
|
|
1
|
+
{"version":3,"file":"useFormFieldAffixWidth.js","sources":["../../../../src/components/FormField/components/useFormFieldAffixWidth.ts"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from \"react\";\nimport { TARGET_PADDING_X_DEFAULT } from \"../consts\";\nimport { setForwardedRef } from \"../../../helpers/setForwardedRef\";\n\n/**\n * Синхронизирует измеренную ширину контейнера-аффикса (FormFieldPrefix / FormFieldPostfix)\n * с контекстом FormField: поле использует её как горизонтальный внутренний отступ.\n *\n * Ширина отслеживается через ResizeObserver, при размонтировании сбрасывается\n * до TARGET_PADDING_X_DEFAULT.\n *\n * @param setWidth Сеттер ширины из FormFieldContext (setPrefixWidth или setPostfixWidth).\n * @param forwardedRef Внешний ref компонента, в который нужно продублировать элемент.\n * @returns Ref-колбэк для корневого элемента аффикса.\n */\nexport const useFormFieldAffixWidth = (\n setWidth: React.Dispatch<React.SetStateAction<number>>,\n forwardedRef: React.ForwardedRef<HTMLSpanElement>,\n): React.RefCallback<HTMLSpanElement> => {\n const elementRef = useRef<HTMLSpanElement | null>(null);\n\n const setRef = useCallback(\n (instance: HTMLSpanElement | null) => {\n elementRef.current = instance;\n setForwardedRef(forwardedRef, instance);\n },\n [forwardedRef],\n );\n\n useEffect(() => {\n const element = elementRef.current;\n\n if (!element) {\n return;\n }\n\n const resizeObserver = new ResizeObserver(([entry]) => {\n const width = entry.target.getBoundingClientRect().width;\n\n setWidth((prevWidth) => (prevWidth !== width ? width : prevWidth));\n });\n\n resizeObserver.observe(element);\n\n return () => {\n resizeObserver.disconnect();\n setWidth(TARGET_PADDING_X_DEFAULT);\n };\n }, [setWidth]);\n\n return setRef;\n};\n"],"names":[],"mappings":";;;AAeO,MAAM,yBAAyB,CAClC,UACA,iBACqC;AACrC,QAAM,aAAa,OAA+B,IAAI;AAEtD,QAAM,SAAS;AAAA,IACX,CAAC,aAAqC;AAClC,iBAAW,UAAU;AACrB,sBAAgB,cAAc,QAAQ;AAAA,IAC1C;AAAA,IACA,CAAC,YAAY;AAAA,EAAA;AAGjB,YAAU,MAAM;AACZ,UAAM,UAAU,WAAW;AAE3B,QAAI,CAAC,SAAS;AACV;AAAA,IACJ;AAEA,UAAM,iBAAiB,IAAI,eAAe,CAAC,CAAC,KAAK,MAAM;AACnD,YAAM,QAAQ,MAAM,OAAO,sBAAA,EAAwB;AAEnD,eAAS,CAAC,cAAe,cAAc,QAAQ,QAAQ,SAAU;AAAA,IACrE,CAAC;AAED,mBAAe,QAAQ,OAAO;AAE9B,WAAO,MAAM;AACT,qBAAe,WAAA;AACf,eAAS,wBAAwB;AAAA,IACrC;AAAA,EACJ,GAAG,CAAC,QAAQ,CAAC;AAEb,SAAO;AACX;"}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
const setForwardedRef = (ref, instance) => {
|
|
2
|
-
if (typeof ref === "function") {
|
|
3
|
-
ref(instance);
|
|
4
|
-
} else if (ref) {
|
|
5
|
-
ref.current = instance;
|
|
6
|
-
}
|
|
7
|
-
};
|
|
8
1
|
const isFilled = (value) => {
|
|
9
2
|
if (value === void 0) {
|
|
10
3
|
return false;
|
|
@@ -15,7 +8,6 @@ const isFilled = (value) => {
|
|
|
15
8
|
}
|
|
16
9
|
};
|
|
17
10
|
export {
|
|
18
|
-
isFilled
|
|
19
|
-
setForwardedRef
|
|
11
|
+
isFilled
|
|
20
12
|
};
|
|
21
13
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../src/components/FormField/components/utils.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../src/components/FormField/components/utils.ts"],"sourcesContent":["/**\n * Проверяет наличие значения в элементе ввода.\n *\n * Число считается заполненным всегда (включая 0), строка и массив строк — по длине.\n *\n * @param value Значение элемента ввода.\n * @returns true, если значение непустое.\n */\nexport const isFilled = (value: string | readonly string[] | number | undefined): boolean => {\n if (value === undefined) {\n return false;\n } else if (typeof value === \"number\") {\n return true;\n } else {\n return value.length !== 0;\n }\n};\n"],"names":[],"mappings":"AAQO,MAAM,WAAW,CAAC,UAAoE;AACzF,MAAI,UAAU,QAAW;AACrB,WAAO;AAAA,EACX,WAAW,OAAO,UAAU,UAAU;AAClC,WAAO;AAAA,EACX,OAAO;AACH,WAAO,MAAM,WAAW;AAAA,EAC5B;AACJ;"}
|