@skbkontur/react-ui 4.13.3 → 4.13.4-fix-auto-batch-react18.1
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/CHANGELOG.md +11 -0
- package/cjs/components/Button/Button.styles.js +2 -1
- package/cjs/components/Button/Button.styles.js.map +1 -1
- package/cjs/components/Input/Input.d.ts +8 -4
- package/cjs/components/Input/Input.js +32 -6
- package/cjs/components/Input/Input.js.map +1 -1
- package/cjs/components/Input/Input.md +49 -0
- package/cjs/components/Input/Input.styles.js +2 -1
- package/cjs/components/Input/Input.styles.js.map +1 -1
- package/cjs/components/Loader/Loader.js +1 -3
- package/cjs/components/Loader/Loader.js.map +1 -1
- package/cjs/components/Modal/Modal.js +1 -2
- package/cjs/components/Modal/Modal.js.map +1 -1
- package/cjs/components/Modal/Modal.styles.d.ts +0 -2
- package/cjs/components/Modal/Modal.styles.js +22 -33
- package/cjs/components/Modal/Modal.styles.js.map +1 -1
- package/cjs/components/Modal/ModalBody.js +0 -2
- package/cjs/components/Modal/ModalBody.js.map +1 -1
- package/cjs/components/Modal/ModalFooter.js +2 -5
- package/cjs/components/Modal/ModalFooter.js.map +1 -1
- package/cjs/components/Modal/ModalHeader.js +1 -6
- package/cjs/components/Modal/ModalHeader.js.map +1 -1
- package/cjs/components/PasswordInput/PasswordInput.js +5 -5
- package/cjs/components/PasswordInput/PasswordInput.js.map +1 -1
- package/cjs/components/Toast/Toast.md +2 -2
- package/cjs/internal/CustomComboBox/CustomComboBox.js +12 -9
- package/cjs/internal/CustomComboBox/CustomComboBox.js.map +1 -1
- package/cjs/internal/InputLikeText/InputLikeText.js +4 -1
- package/cjs/internal/InputLikeText/InputLikeText.js.map +1 -1
- package/cjs/internal/ThemeShowcase/VariablesCollector.d.ts +1 -1
- package/cjs/internal/ZIndex/ZIndexStorage.d.ts +0 -5
- package/cjs/internal/ZIndex/ZIndexStorage.js +1 -6
- package/cjs/internal/ZIndex/ZIndexStorage.js.map +1 -1
- package/cjs/internal/themes/DarkTheme.d.ts +1 -0
- package/cjs/internal/themes/DarkTheme.js +6 -5
- package/cjs/internal/themes/DarkTheme.js.map +1 -1
- package/cjs/internal/themes/DefaultTheme.d.ts +1 -0
- package/cjs/internal/themes/DefaultTheme.js +4 -3
- package/cjs/internal/themes/DefaultTheme.js.map +1 -1
- package/cjs/lib/ModalStack.js +4 -2
- package/cjs/lib/ModalStack.js.map +1 -1
- package/cjs/lib/net/fetch.js +4 -4
- package/cjs/lib/net/fetch.js.map +1 -1
- package/cjs/typings/global.d.ts +4 -0
- package/components/Button/Button.styles/Button.styles.js +1 -1
- package/components/Button/Button.styles/Button.styles.js.map +1 -1
- package/components/Input/Input/Input.js +18 -5
- package/components/Input/Input/Input.js.map +1 -1
- package/components/Input/Input.d.ts +8 -4
- package/components/Input/Input.md +49 -0
- package/components/Input/Input.styles/Input.styles.js +1 -1
- package/components/Input/Input.styles/Input.styles.js.map +1 -1
- package/components/Loader/Loader/Loader.js +0 -2
- package/components/Loader/Loader/Loader.js.map +1 -1
- package/components/Modal/Modal/Modal.js +0 -1
- package/components/Modal/Modal/Modal.js.map +1 -1
- package/components/Modal/Modal.styles/Modal.styles.js +21 -27
- package/components/Modal/Modal.styles/Modal.styles.js.map +1 -1
- package/components/Modal/Modal.styles.d.ts +0 -2
- package/components/Modal/ModalBody/ModalBody.js +0 -2
- package/components/Modal/ModalBody/ModalBody.js.map +1 -1
- package/components/Modal/ModalFooter/ModalFooter.js +2 -6
- package/components/Modal/ModalFooter/ModalFooter.js.map +1 -1
- package/components/Modal/ModalHeader/ModalHeader.js +2 -6
- package/components/Modal/ModalHeader/ModalHeader.js.map +1 -1
- package/components/PasswordInput/PasswordInput/PasswordInput.js +6 -5
- package/components/PasswordInput/PasswordInput/PasswordInput.js.map +1 -1
- package/components/Toast/Toast.md +2 -2
- package/internal/CustomComboBox/CustomComboBox/CustomComboBox.js +11 -9
- package/internal/CustomComboBox/CustomComboBox/CustomComboBox.js.map +1 -1
- package/internal/InputLikeText/InputLikeText/InputLikeText.js +5 -2
- package/internal/InputLikeText/InputLikeText/InputLikeText.js.map +1 -1
- package/internal/ThemeShowcase/VariablesCollector.d.ts +1 -1
- package/internal/ZIndex/ZIndexStorage/ZIndexStorage.js +1 -6
- package/internal/ZIndex/ZIndexStorage/ZIndexStorage.js.map +1 -1
- package/internal/ZIndex/ZIndexStorage.d.ts +0 -5
- package/internal/themes/DarkTheme/DarkTheme.js +2 -3
- package/internal/themes/DarkTheme/DarkTheme.js.map +1 -1
- package/internal/themes/DarkTheme.d.ts +1 -0
- package/internal/themes/DefaultTheme/DefaultTheme.js +5 -4
- package/internal/themes/DefaultTheme/DefaultTheme.js.map +1 -1
- package/internal/themes/DefaultTheme.d.ts +1 -0
- package/lib/ModalStack/ModalStack.js +2 -1
- package/lib/ModalStack/ModalStack.js.map +1 -1
- package/lib/net/fetch/fetch.js +2 -3
- package/lib/net/fetch/fetch.js.map +1 -1
- package/package.json +2 -5
- package/typings/global.d.ts +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Modal.styles.ts"],"names":["styles","root","css","bg","t","modalBackBg","modalBackOpacity","container","window","modalBg","modalBorderRadius","mobileWindow","centerContainer","mobileCenterContainer","alignTop","close","padding","parseInt","modalCloseButtonPadding","modalCloseButtonColor","modalCloseButtonClickArea","modalCloseButtonHoverColor","modalCloseIconSize","mobileClose","mobileModalCloseButtonRightPadding","mobileModalCloseButtonTopPadding","mobileModalHeaderPadding","mobileModalCloseButtonClickArea","mobileModalCloseIconSize","mobileCloseWithoutHeader","closeWrapper","paddingBottom","modalCloseButtonBottomPadding","legacyGap","modalCloseWrapperLegacyGap","legacyShift","modalCloseButtonLegacyShift","blockSizeX","blockSizeY","mobileCloseWrapper","size","bgDefault","disabled","modalCloseButtonDisabledColor","focus","borderColorFocus","headerWrapper","header","modalHeaderFontSize","modalHeaderLineHeight","modalHeaderPaddingTop","modalPaddingRight","modalHeaderPaddingBottom","modalPaddingLeft","modalHeaderTextColor","mobileHeader","mobileModalHeaderFontSize","mobileModalHeaderLineHeight","body","modalBodyPaddingBottom","modalBodyTextColor","mobileBody","mobileModalBodyPadding","mobileModalBodyFontSize","headerWithClose","rightPadding","modalCloseLegacyGap","mobileHeaderWithClose","footer","modalFooterPaddingTop","modalFooterPaddingBottom","modalFooterTextColor","mobileFooter","mobileModalFooterPadding","footerWrapper","panel","modalFooterPanelPaddingTop","modalFooterPanelPaddingBottom","modalFooterBg","fixedHeader","modalFixedHeaderPaddingBottom","modalFixedHeaderBg","modalFixedHeaderBorder","modalFixedHeaderShadow","mobileFixedHeader","fixedFooter","modalFixedFooterBorder","modalFixedFooterShadow","fixedPanel","modalFixedPanelShadow","headerAddPadding","bodyWithoutHeader","modalPaddingTop","mobileBodyWithoutHeader","bodyWithoutPadding","bodyAddPaddingForPanel","modalPaddingBottom","mobileBodyAddPaddingForPanel","columnFlexContainer"],"mappings":"4QAAA;;AAEA,iD;;AAEO,IAAMA,MAAM,GAAG,2BAAa;AACjCC,EAAAA,IADiC,kBAC1B;AACL,eAAOC,YAAP;;;;;;;AAOD,GATgC;;AAWjCC,EAAAA,EAXiC,cAW9BC,CAX8B,EAWpB;AACX,eAAOF,YAAP;;;;;;AAMgBE,IAAAA,CAAC,CAACC,WANlB;AAOaD,IAAAA,CAAC,CAACE,gBAPf;;AASD,GArBgC;;AAuBjCC,EAAAA,SAvBiC,uBAuBrB;AACV,eAAOL,YAAP;;;;;;;;;;;;;;;AAeD,GAvCgC;;AAyCjCM,EAAAA,MAzCiC,kBAyC1BJ,CAzC0B,EAyChB;AACf,eAAOF,YAAP;;;;;AAKgBE,IAAAA,CAAC,CAACK,OALlB;AAMmBL,IAAAA,CAAC,CAACM,iBANrB;;AAQD,GAlDgC;;AAoDjCC,EAAAA,YApDiC,0BAoDlB;AACb,eAAOT,YAAP;;;;;AAKD,GA1DgC;;AA4DjCU,EAAAA,eA5DiC,6BA4Df;AAChB,eAAOV,YAAP;;;;;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AAwSjC2D,EAAAA,WAxSiC,uBAwSrBjF,CAxSqB,EAwSX;AACpB,eAAOF,YAAP;;;AAGgBE,IAAAA,CAAC,CAAC6E,kBAHlB;AAIgB7E,IAAAA,CAAC,CAACkF,sBAJlB;;;;;;;;;;AAckBlF,IAAAA,CAAC,CAACmF,sBAdpB;;;AAiBD,GA1TgC;;AA4TjCC,EAAAA,UA5TiC,sBA4TtBpF,CA5TsB,EA4TZ;AACnB,eAAOF,YAAP;;AAEkBE,IAAAA,CAAC,CAACqF,qBAFpB;;;AAKD,GAlUgC;;AAoUjCC,EAAAA,gBApUiC,8BAoUd;AACjB,eAAOxF,YAAP;;;AAGD,GAxUgC;;AA0UjCyF,EAAAA,iBA1UiC,6BA0UfvF,CA1Ue,EA0UL;AAC1B,eAAOF,YAAP;AACiBE,IAAAA,CAAC,CAACwF,eADnB;;AAGD,GA9UgC;;AAgVjCC,EAAAA,uBAhViC,qCAgVP;AACxB,eAAO3F,YAAP;;;AAGD,GApVgC;;AAsVjC4F,EAAAA,kBAtViC,gCAsVZ;AACnB,eAAO5F,YAAP;;;AAGD,GA1VgC;;AA4VjC6F,EAAAA,sBA5ViC,kCA4VV3F,CA5VU,EA4VA;AAC/B,eAAOF,YAAP;AACoBE,IAAAA,CAAC,CAAC4F,kBADtB;;AAGD,GAhWgC;;AAkWjCC,EAAAA,4BAlWiC,wCAkWJ7F,CAlWI,EAkWM;AACrC,eAAOF,YAAP;AACoBE,IAAAA,CAAC,CAAC0D,sBADtB;;AAGD,GAtWgC;;AAwWjCoC,EAAAA,mBAxWiC,iCAwWX;AACpB,eAAOhG,YAAP;;;;;;AAMD,GA/WgC,EAAb,CAAf,C","sourcesContent":["import { css, memoizeStyle } from '../../lib/theming/Emotion';\nimport { Theme } from '../../lib/theming/Theme';\nimport { resetButton } from '../../lib/styles/Mixins';\n\nexport const styles = memoizeStyle({\n root() {\n return css`\n height: 100%;\n left: 0;\n position: fixed;\n top: 0;\n width: 100%;\n `;\n },\n\n bg(t: Theme) {\n return css`\n bottom: 0;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n background: ${t.modalBackBg};\n opacity: ${t.modalBackOpacity};\n `;\n },\n\n container() {\n return css`\n position: relative;\n white-space: nowrap;\n text-align: center;\n height: 100%;\n overflow-y: auto;\n outline: none;\n\n &::before {\n content: '';\n display: inline-block;\n vertical-align: middle;\n height: 80%; /* to vertical align modal 40%/60% of screen height */\n }\n `;\n },\n\n window(t: Theme) {\n return css`\n position: relative;\n white-space: normal;\n margin: auto;\n box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);\n background: ${t.modalBg};\n border-radius: ${t.modalBorderRadius};\n `;\n },\n\n mobileWindow() {\n return css`\n width: 100%;\n height: 100%;\n overflow: auto;\n `;\n },\n\n centerContainer() {\n return css`\n position: relative;\n display: inline-block;\n text-align: left;\n vertical-align: middle;\n box-sizing: border-box;\n z-index: 10;\n margin: 40px 20px;\n `;\n },\n\n mobileCenterContainer() {\n return css`\n margin: 0;\n width: 100%;\n height: 100%;\n `;\n },\n\n alignTop() {\n return css`\n vertical-align: top;\n `;\n },\n\n close(t: Theme) {\n const padding = parseInt(t.modalCloseButtonPadding);\n return css`\n ${resetButton()};\n position: absolute;\n display: flex;\n right: ${padding}px;\n top: ${padding}px;\n background: none;\n background: transparent;\n cursor: pointer;\n color: ${t.modalCloseButtonColor};\n text-align: center;\n vertical-align: middle;\n padding: ${t.modalCloseButtonClickArea};\n margin: -${t.modalCloseButtonClickArea};\n\n &:hover {\n color: ${t.modalCloseButtonHoverColor};\n }\n\n & > svg {\n width: ${t.modalCloseIconSize};\n height: ${t.modalCloseIconSize};\n box-sizing: content-box;\n }\n `;\n },\n\n mobileClose(t: Theme) {\n return css`\n right: ${t.mobileModalCloseButtonRightPadding};\n top: ${parseInt(t.mobileModalCloseButtonTopPadding) + parseInt(t.mobileModalHeaderPadding)}px;\n padding: ${t.mobileModalCloseButtonClickArea};\n margin: -${t.mobileModalCloseButtonClickArea};\n\n & > svg {\n width: ${t.mobileModalCloseIconSize};\n height: ${t.mobileModalCloseIconSize};\n }\n `;\n },\n\n mobileCloseWithoutHeader() {\n return css`\n position: static;\n `;\n },\n\n closeWrapper(t: Theme) {\n const padding = parseInt(t.modalCloseButtonPadding);\n const paddingBottom = parseInt(t.modalCloseButtonBottomPadding);\n const legacyGap = parseInt(t.modalCloseWrapperLegacyGap);\n const legacyShift = parseInt(t.modalCloseButtonLegacyShift);\n const blockSizeX = parseInt(t.modalCloseIconSize) + 2 * padding - legacyShift;\n const blockSizeY = parseInt(t.modalCloseIconSize) + padding + paddingBottom + legacyGap;\n return css`\n position: relative;\n float: right;\n width: ${blockSizeX + legacyGap}px;\n height: ${blockSizeY}px;\n `;\n },\n\n mobileCloseWrapper(t: Theme) {\n const size = parseInt(t.mobileModalCloseIconSize) + parseInt(t.mobileModalCloseButtonClickArea) * 2;\n\n return css`\n position: absolute;\n right: ${t.mobileModalCloseButtonRightPadding};\n top: ${t.mobileModalCloseButtonTopPadding};\n padding: 0px;\n margin: 0px;\n display: flex;\n justify-content: center;\n align-items: center;\n width: ${size}px;\n height: ${size}px;\n background: radial-gradient(50% 50% at 50% 50%, ${t.bgDefault} 60%, rgba(255, 255, 255, 0) 100%);\n border-radius: ${size}px;\n `;\n },\n\n disabled(t: Theme) {\n return css`\n pointer-events: none;\n cursor: default;\n color: ${t.modalCloseButtonDisabledColor};\n `;\n },\n\n focus(t: Theme) {\n return css`\n color: ${t.modalCloseButtonHoverColor};\n outline: 2px solid ${t.borderColorFocus};\n `;\n },\n\n headerWrapper() {\n return css`\n position: relative;\n `;\n },\n\n header(t: Theme) {\n return css`\n font-size: ${t.modalHeaderFontSize};\n line-height: ${t.modalHeaderLineHeight};\n padding: ${t.modalHeaderPaddingTop} ${t.modalPaddingRight} ${t.modalHeaderPaddingBottom} ${t.modalPaddingLeft};\n overflow-wrap: break-word;\n word-wrap: break-word;\n color: ${t.modalHeaderTextColor};\n `;\n },\n\n mobileHeader(t: Theme) {\n return css`\n font-size: ${t.mobileModalHeaderFontSize};\n line-height: ${t.mobileModalHeaderLineHeight};\n padding: ${t.mobileModalHeaderPadding};\n `;\n },\n\n body(t: Theme) {\n return css`\n padding: 0 ${t.modalPaddingRight} ${t.modalBodyPaddingBottom} ${t.modalPaddingLeft};\n color: ${t.modalBodyTextColor};\n `;\n },\n\n mobileBody(t: Theme) {\n return css`\n padding: ${t.mobileModalBodyPadding};\n padding-top: 0px;\n display: flex;\n flex-flow: column;\n flex: 1;\n font-size: ${t.mobileModalBodyFontSize};\n `;\n },\n\n headerWithClose(t: Theme) {\n const rightPadding =\n 2 * parseInt(t.modalCloseButtonPadding) + parseInt(t.modalCloseIconSize) + parseInt(t.modalCloseLegacyGap);\n\n return css`\n padding-right: ${rightPadding}px;\n `;\n },\n\n mobileHeaderWithClose(t: Theme) {\n return css`\n padding-right: ${2 * parseInt(t.mobileModalCloseButtonRightPadding) + parseInt(t.mobileModalCloseIconSize)}px;\n `;\n },\n\n footer(t: Theme) {\n return css`\n padding: ${t.modalFooterPaddingTop} ${t.modalPaddingRight} ${t.modalFooterPaddingBottom} ${t.modalPaddingLeft};\n color: ${t.modalFooterTextColor};\n border-radius: 0 0 ${t.modalBorderRadius} ${t.modalBorderRadius};\n `;\n },\n\n mobileFooter(t: Theme) {\n return css`\n padding: ${t.mobileModalFooterPadding};\n `;\n },\n\n footerWrapper() {\n return css`\n position: relative;\n `;\n },\n\n panel(t: Theme) {\n return css`\n padding-top: ${t.modalFooterPanelPaddingTop};\n padding-bottom: ${t.modalFooterPanelPaddingBottom};\n background: ${t.modalFooterBg};\n `;\n },\n\n fixedHeader(t: Theme) {\n return css`\n margin-bottom: 10px;\n padding-bottom: ${t.modalFixedHeaderPaddingBottom};\n background: ${t.modalFixedHeaderBg};\n border-bottom: ${t.modalFixedHeaderBorder};\n\n &:after {\n bottom: 11px;\n content: '';\n position: absolute;\n height: 1px;\n width: 100%;\n left: 0;\n z-index: -1;\n box-shadow: ${t.modalFixedHeaderShadow};\n }\n `;\n },\n\n mobileFixedHeader(t: Theme) {\n return css`\n padding-bottom: ${t.mobileModalHeaderPadding};\n `;\n },\n\n fixedFooter(t: Theme) {\n return css`\n padding-top: 20px;\n margin-top: 10px;\n background: ${t.modalFixedHeaderBg};\n border-top: ${t.modalFixedFooterBorder};\n\n &:before {\n top: 11px;\n content: '';\n position: absolute;\n height: 1px;\n width: 100%;\n left: 0;\n z-index: -1;\n box-shadow: ${t.modalFixedFooterShadow};\n }\n `;\n },\n\n fixedPanel(t: Theme) {\n return css`\n &:before {\n box-shadow: ${t.modalFixedPanelShadow};\n }\n `;\n },\n\n headerAddPadding() {\n return css`\n padding-bottom: 22px;\n `;\n },\n\n bodyWithoutHeader(t: Theme) {\n return css`\n padding-top: ${t.modalPaddingTop};\n `;\n },\n\n mobileBodyWithoutHeader() {\n return css`\n padding-top: 0px;\n `;\n },\n\n bodyWithoutPadding() {\n return css`\n padding: 0;\n `;\n },\n\n bodyAddPaddingForPanel(t: Theme) {\n return css`\n padding-bottom: ${t.modalPaddingBottom};\n `;\n },\n\n mobileBodyAddPaddingForPanel(t: Theme) {\n return css`\n padding-bottom: ${t.mobileModalBodyPadding};\n `;\n },\n\n columnFlexContainer() {\n return css`\n height: 100%;\n display: flex;\n flex-flow: column;\n overflow-y: auto;\n `;\n },\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["Modal.styles.ts"],"names":["styles","root","css","bg","t","modalBackBg","modalBackOpacity","container","window","modalBg","modalBorderRadius","mobileWindow","centerContainer","mobileCenterContainer","alignTop","close","padding","parseInt","modalCloseButtonPadding","modalCloseButtonColor","modalCloseButtonClickArea","modalCloseButtonHoverColor","modalCloseIconSize","mobileClose","mobileModalCloseButtonRightPadding","mobileModalCloseButtonTopPadding","mobileModalHeaderPadding","mobileModalCloseButtonClickArea","mobileModalCloseIconSize","mobileCloseWithoutHeader","closeWrapper","paddingBottom","modalCloseButtonBottomPadding","legacyGap","modalCloseWrapperLegacyGap","legacyShift","modalCloseButtonLegacyShift","blockSizeX","blockSizeY","mobileCloseWrapper","size","bgDefault","disabled","modalCloseButtonDisabledColor","focus","borderColorFocus","header","modalHeaderFontSize","modalHeaderLineHeight","modalHeaderPaddingTop","modalPaddingRight","modalHeaderPaddingBottom","modalPaddingLeft","modalHeaderTextColor","mobileHeader","mobileModalHeaderFontSize","mobileModalHeaderLineHeight","body","modalBodyPaddingBottom","modalBodyTextColor","mobileBody","mobileModalBodyPadding","mobileModalBodyFontSize","headerWithClose","rightPadding","modalCloseLegacyGap","mobileHeaderWithClose","footer","modalFooterPaddingTop","modalFooterPaddingBottom","modalFooterTextColor","mobileFooter","mobileModalFooterPadding","panel","modalFooterPanelPaddingTop","modalFooterPanelPaddingBottom","modalFooterBg","fixedHeader","modalFixedHeaderPaddingBottom","modalFixedHeaderBg","modalFixedHeaderBorder","modalFixedHeaderShadow","mobileFixedHeader","fixedFooter","modalFixedFooterBorder","modalFixedFooterShadow","fixedPanel","modalFixedPanelShadow","headerAddPadding","bodyWithoutHeader","modalPaddingTop","mobileBodyWithoutHeader","bodyWithoutPadding","bodyAddPaddingForPanel","modalPaddingBottom","mobileBodyAddPaddingForPanel","columnFlexContainer"],"mappings":"4QAAA;;AAEA,iD;;AAEO,IAAMA,MAAM,GAAG,2BAAa;AACjCC,EAAAA,IADiC,kBAC1B;AACL,eAAOC,YAAP;;;;;;;AAOD,GATgC;;AAWjCC,EAAAA,EAXiC,cAW9BC,CAX8B,EAWpB;AACX,eAAOF,YAAP;;;;;;AAMgBE,IAAAA,CAAC,CAACC,WANlB;AAOaD,IAAAA,CAAC,CAACE,gBAPf;;AASD,GArBgC;;AAuBjCC,EAAAA,SAvBiC,uBAuBrB;AACV,eAAOL,YAAP;;;;;;;;;;;;;;;AAeD,GAvCgC;;AAyCjCM,EAAAA,MAzCiC,kBAyC1BJ,CAzC0B,EAyChB;AACf,eAAOF,YAAP;;;;;AAKgBE,IAAAA,CAAC,CAACK,OALlB;AAMmBL,IAAAA,CAAC,CAACM,iBANrB;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CyD,EAAAA,WA7RiC,uBA6RrB/E,CA7RqB,EA6RX;AACpB,eAAOF,YAAP;;;AAGgBE,IAAAA,CAAC,CAAC2E,kBAHlB;AAIgB3E,IAAAA,CAAC,CAACgF,sBAJlB;;;;;;;;;;AAckBhF,IAAAA,CAAC,CAACiF,sBAdpB;;;AAiBD,GA/SgC;;AAiTjCC,EAAAA,UAjTiC,sBAiTtBlF,CAjTsB,EAiTZ;AACnB,eAAOF,YAAP;;AAEkBE,IAAAA,CAAC,CAACmF,qBAFpB;;;AAKD,GAvTgC;;AAyTjCC,EAAAA,gBAzTiC,8BAyTd;AACjB,eAAOtF,YAAP;;;AAGD,GA7TgC;;AA+TjCuF,EAAAA,iBA/TiC,6BA+TfrF,CA/Te,EA+TL;AAC1B,eAAOF,YAAP;AACiBE,IAAAA,CAAC,CAACsF,eADnB;;AAGD,GAnUgC;;AAqUjCC,EAAAA,uBArUiC,qCAqUP;AACxB,eAAOzF,YAAP;;;AAGD,GAzUgC;;AA2UjC0F,EAAAA,kBA3UiC,gCA2UZ;AACnB,eAAO1F,YAAP;;;AAGD,GA/UgC;;AAiVjC2F,EAAAA,sBAjViC,kCAiVVzF,CAjVU,EAiVA;AAC/B,eAAOF,YAAP;AACoBE,IAAAA,CAAC,CAAC0F,kBADtB;;AAGD,GArVgC;;AAuVjCC,EAAAA,4BAvViC,wCAuVJ3F,CAvVI,EAuVM;AACrC,eAAOF,YAAP;AACoBE,IAAAA,CAAC,CAACyD,sBADtB;;AAGD,GA3VgC;;AA6VjCmC,EAAAA,mBA7ViC,iCA6VX;AACpB,eAAO9F,YAAP;;;;;;AAMD,GApWgC,EAAb,CAAf,C","sourcesContent":["import { css, memoizeStyle } from '../../lib/theming/Emotion';\nimport { Theme } from '../../lib/theming/Theme';\nimport { resetButton } from '../../lib/styles/Mixins';\n\nexport const styles = memoizeStyle({\n root() {\n return css`\n height: 100%;\n left: 0;\n position: fixed;\n top: 0;\n width: 100%;\n `;\n },\n\n bg(t: Theme) {\n return css`\n bottom: 0;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n background: ${t.modalBackBg};\n opacity: ${t.modalBackOpacity};\n `;\n },\n\n container() {\n return css`\n position: relative;\n white-space: nowrap;\n text-align: center;\n height: 100%;\n overflow-y: auto;\n outline: none;\n\n &::before {\n content: '';\n display: inline-block;\n vertical-align: middle;\n height: 80%; /* to vertical align modal 40%/60% of screen height */\n }\n `;\n },\n\n window(t: Theme) {\n return css`\n position: relative;\n white-space: normal;\n margin: auto;\n box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);\n background: ${t.modalBg};\n border-radius: ${t.modalBorderRadius};\n `;\n },\n\n mobileWindow() {\n return css`\n width: 100%;\n height: 100%;\n overflow: auto;\n `;\n },\n\n centerContainer() {\n return css`\n position: relative;\n display: inline-block;\n text-align: left;\n vertical-align: middle;\n box-sizing: border-box;\n z-index: 10;\n margin: 40px 20px;\n `;\n },\n\n mobileCenterContainer() {\n return css`\n margin: 0;\n width: 100%;\n height: 100%;\n `;\n },\n\n alignTop() {\n return css`\n vertical-align: top;\n `;\n },\n\n close(t: Theme) {\n const padding = parseInt(t.modalCloseButtonPadding);\n return css`\n ${resetButton()};\n position: absolute;\n display: flex;\n right: ${padding}px;\n top: ${padding}px;\n background: none;\n background: transparent;\n cursor: pointer;\n color: ${t.modalCloseButtonColor};\n text-align: center;\n vertical-align: middle;\n padding: ${t.modalCloseButtonClickArea};\n margin: -${t.modalCloseButtonClickArea};\n\n &:hover {\n color: ${t.modalCloseButtonHoverColor};\n }\n\n & > svg {\n width: ${t.modalCloseIconSize};\n height: ${t.modalCloseIconSize};\n box-sizing: content-box;\n }\n `;\n },\n\n mobileClose(t: Theme) {\n return css`\n right: ${t.mobileModalCloseButtonRightPadding};\n top: ${parseInt(t.mobileModalCloseButtonTopPadding) + parseInt(t.mobileModalHeaderPadding)}px;\n padding: ${t.mobileModalCloseButtonClickArea};\n margin: -${t.mobileModalCloseButtonClickArea};\n\n & > svg {\n width: ${t.mobileModalCloseIconSize};\n height: ${t.mobileModalCloseIconSize};\n }\n `;\n },\n\n mobileCloseWithoutHeader() {\n return css`\n position: static;\n `;\n },\n\n closeWrapper(t: Theme) {\n const padding = parseInt(t.modalCloseButtonPadding);\n const paddingBottom = parseInt(t.modalCloseButtonBottomPadding);\n const legacyGap = parseInt(t.modalCloseWrapperLegacyGap);\n const legacyShift = parseInt(t.modalCloseButtonLegacyShift);\n const blockSizeX = parseInt(t.modalCloseIconSize) + 2 * padding - legacyShift;\n const blockSizeY = parseInt(t.modalCloseIconSize) + padding + paddingBottom + legacyGap;\n return css`\n position: relative;\n float: right;\n width: ${blockSizeX + legacyGap}px;\n height: ${blockSizeY}px;\n `;\n },\n\n mobileCloseWrapper(t: Theme) {\n const size = parseInt(t.mobileModalCloseIconSize) + parseInt(t.mobileModalCloseButtonClickArea) * 2;\n\n return css`\n position: absolute;\n right: ${t.mobileModalCloseButtonRightPadding};\n top: ${t.mobileModalCloseButtonTopPadding};\n padding: 0px;\n margin: 0px;\n display: flex;\n justify-content: center;\n align-items: center;\n width: ${size}px;\n height: ${size}px;\n background: radial-gradient(50% 50% at 50% 50%, ${t.bgDefault} 60%, rgba(255, 255, 255, 0) 100%);\n border-radius: ${size}px;\n `;\n },\n\n disabled(t: Theme) {\n return css`\n pointer-events: none;\n cursor: default;\n color: ${t.modalCloseButtonDisabledColor};\n `;\n },\n\n focus(t: Theme) {\n return css`\n color: ${t.modalCloseButtonHoverColor};\n outline: 2px solid ${t.borderColorFocus};\n `;\n },\n\n header(t: Theme) {\n return css`\n font-size: ${t.modalHeaderFontSize};\n line-height: ${t.modalHeaderLineHeight};\n padding: ${t.modalHeaderPaddingTop} ${t.modalPaddingRight} ${t.modalHeaderPaddingBottom} ${t.modalPaddingLeft};\n overflow-wrap: break-word;\n word-wrap: break-word;\n color: ${t.modalHeaderTextColor};\n `;\n },\n\n mobileHeader(t: Theme) {\n return css`\n position: relative;\n font-size: ${t.mobileModalHeaderFontSize};\n line-height: ${t.mobileModalHeaderLineHeight};\n padding: ${t.mobileModalHeaderPadding};\n `;\n },\n\n body(t: Theme) {\n return css`\n padding: 0 ${t.modalPaddingRight} ${t.modalBodyPaddingBottom} ${t.modalPaddingLeft};\n color: ${t.modalBodyTextColor};\n `;\n },\n\n mobileBody(t: Theme) {\n return css`\n padding: ${t.mobileModalBodyPadding};\n padding-top: 0px;\n display: flex;\n flex-flow: column;\n flex: 1;\n font-size: ${t.mobileModalBodyFontSize};\n `;\n },\n\n headerWithClose(t: Theme) {\n const rightPadding =\n 2 * parseInt(t.modalCloseButtonPadding) + parseInt(t.modalCloseIconSize) + parseInt(t.modalCloseLegacyGap);\n\n return css`\n padding-right: ${rightPadding}px;\n `;\n },\n\n mobileHeaderWithClose(t: Theme) {\n return css`\n padding-right: ${2 * parseInt(t.mobileModalCloseButtonRightPadding) + parseInt(t.mobileModalCloseIconSize)}px;\n `;\n },\n\n footer(t: Theme) {\n return css`\n padding: ${t.modalFooterPaddingTop} ${t.modalPaddingRight} ${t.modalFooterPaddingBottom} ${t.modalPaddingLeft};\n color: ${t.modalFooterTextColor};\n border-radius: 0 0 ${t.modalBorderRadius} ${t.modalBorderRadius};\n `;\n },\n\n mobileFooter(t: Theme) {\n return css`\n padding: ${t.mobileModalFooterPadding};\n `;\n },\n\n panel(t: Theme) {\n return css`\n padding-top: ${t.modalFooterPanelPaddingTop};\n padding-bottom: ${t.modalFooterPanelPaddingBottom};\n background: ${t.modalFooterBg};\n `;\n },\n\n fixedHeader(t: Theme) {\n return css`\n margin-bottom: 10px;\n padding-bottom: ${t.modalFixedHeaderPaddingBottom};\n background: ${t.modalFixedHeaderBg};\n border-bottom: ${t.modalFixedHeaderBorder};\n\n &:after {\n bottom: 11px;\n content: '';\n position: absolute;\n height: 1px;\n width: 100%;\n left: 0;\n z-index: -1;\n box-shadow: ${t.modalFixedHeaderShadow};\n }\n `;\n },\n\n mobileFixedHeader(t: Theme) {\n return css`\n padding-bottom: ${t.mobileModalHeaderPadding};\n `;\n },\n\n fixedFooter(t: Theme) {\n return css`\n padding-top: 20px;\n margin-top: 10px;\n background: ${t.modalFixedHeaderBg};\n border-top: ${t.modalFixedFooterBorder};\n\n &:before {\n top: 11px;\n content: '';\n position: absolute;\n height: 1px;\n width: 100%;\n left: 0;\n z-index: -1;\n box-shadow: ${t.modalFixedFooterShadow};\n }\n `;\n },\n\n fixedPanel(t: Theme) {\n return css`\n &:before {\n box-shadow: ${t.modalFixedPanelShadow};\n }\n `;\n },\n\n headerAddPadding() {\n return css`\n padding-bottom: 22px;\n `;\n },\n\n bodyWithoutHeader(t: Theme) {\n return css`\n padding-top: ${t.modalPaddingTop};\n `;\n },\n\n mobileBodyWithoutHeader() {\n return css`\n padding-top: 0px;\n `;\n },\n\n bodyWithoutPadding() {\n return css`\n padding: 0;\n `;\n },\n\n bodyAddPaddingForPanel(t: Theme) {\n return css`\n padding-bottom: ${t.modalPaddingBottom};\n `;\n },\n\n mobileBodyAddPaddingForPanel(t: Theme) {\n return css`\n padding-bottom: ${t.mobileModalBodyPadding};\n `;\n },\n\n columnFlexContainer() {\n return css`\n height: 100%;\n display: flex;\n flex-flow: column;\n overflow-y: auto;\n `;\n },\n});\n"]}
|
|
@@ -57,8 +57,6 @@ ModalBody = (0, _decorator.responsiveLayout)(_class = (0, _rootNode.rootNode)(_c
|
|
|
57
57
|
function (_ref) {var _cx;var additionalPadding = _ref.additionalPadding,hasHeader = _ref.hasHeader;return /*#__PURE__*/(
|
|
58
58
|
_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: _this3.setRootNode }, _this3.props), /*#__PURE__*/
|
|
59
59
|
_react.default.createElement(_ZIndex.ZIndex, {
|
|
60
|
-
priority: 'ModalBody',
|
|
61
|
-
createStackingContext: true,
|
|
62
60
|
className: (0, _Emotion.cx)((_cx = {}, _cx[
|
|
63
61
|
_Modal.styles.body(_this3.theme)] = true, _cx[
|
|
64
62
|
_Modal.styles.mobileBody(_this3.theme)] = _this3.isMobileLayout, _cx[
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ModalBody.tsx"],"names":["ModalBody","responsiveLayout","rootNode","handleResize","LayoutEvents","emit","render","theme","renderMain","noPadding","props","additionalPadding","hasHeader","setRootNode","styles","body","mobileBody","isMobileLayout","bodyWithoutHeader","mobileBodyWithoutHeader","bodyAddPaddingForPanel","mobileBodyAddPaddingForPanel","bodyWithoutPadding","children","React","Component","__KONTUR_REACT_UI__","__MODAL_BODY__"],"mappings":"uUAAA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uC;;;;;;;;;AASA;AACA;AACA;AACA;AACA,G;;;AAGaA,S,OAFZC,2B,eACAC,kB;;;;;;;;;;;;;;;;;;;AAoBSC,IAAAA,Y,GAAe,YAAM;AAC3BC,MAAAA,YAAY,CAACC,IAAb;AACD,K,uDAbMC,M,GAAP,kBAAgB,mBACd,oBACE,6BAAC,0BAAD,CAAc,QAAd,QACG,UAACC,KAAD,EAAW,CACV,MAAI,CAACA,KAAL,GAAaA,KAAb,CACA,OAAO,MAAI,CAACC,UAAL,EAAP,CACD,CAJH,CADF,CAQD,C;;AAMMA,EAAAA,U,GAAP,sBAAiC;AAC/B,QAAQC,SAAR,GAAsB,KAAKC,KAA3B,CAAQD,SAAR;AACA;AACE,mCAAC,0BAAD,CAAc,QAAd;AACG,mCAAGE,iBAAH,QAAGA,iBAAH,CAAsBC,SAAtB,QAAsBA,SAAtB;AACC,uCAAC,4BAAD,2BAAe,WAAW,EAAE,MAAI,CAACC,WAAjC,IAAkD,MAAI,CAACH,KAAvD;AACE,uCAAC,cAAD;AACE,YAAA,
|
|
1
|
+
{"version":3,"sources":["ModalBody.tsx"],"names":["ModalBody","responsiveLayout","rootNode","handleResize","LayoutEvents","emit","render","theme","renderMain","noPadding","props","additionalPadding","hasHeader","setRootNode","styles","body","mobileBody","isMobileLayout","bodyWithoutHeader","mobileBodyWithoutHeader","bodyAddPaddingForPanel","mobileBodyAddPaddingForPanel","bodyWithoutPadding","children","React","Component","__KONTUR_REACT_UI__","__MODAL_BODY__"],"mappings":"uUAAA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uC;;;;;;;;;AASA;AACA;AACA;AACA;AACA,G;;;AAGaA,S,OAFZC,2B,eACAC,kB;;;;;;;;;;;;;;;;;;;AAoBSC,IAAAA,Y,GAAe,YAAM;AAC3BC,MAAAA,YAAY,CAACC,IAAb;AACD,K,uDAbMC,M,GAAP,kBAAgB,mBACd,oBACE,6BAAC,0BAAD,CAAc,QAAd,QACG,UAACC,KAAD,EAAW,CACV,MAAI,CAACA,KAAL,GAAaA,KAAb,CACA,OAAO,MAAI,CAACC,UAAL,EAAP,CACD,CAJH,CADF,CAQD,C;;AAMMA,EAAAA,U,GAAP,sBAAiC;AAC/B,QAAQC,SAAR,GAAsB,KAAKC,KAA3B,CAAQD,SAAR;AACA;AACE,mCAAC,0BAAD,CAAc,QAAd;AACG,mCAAGE,iBAAH,QAAGA,iBAAH,CAAsBC,SAAtB,QAAsBA,SAAtB;AACC,uCAAC,4BAAD,2BAAe,WAAW,EAAE,MAAI,CAACC,WAAjC,IAAkD,MAAI,CAACH,KAAvD;AACE,uCAAC,cAAD;AACE,YAAA,SAAS,EAAE;AACRI,0BAAOC,IAAP,CAAY,MAAI,CAACR,KAAjB,CADQ,IACkB,IADlB;AAERO,0BAAOE,UAAP,CAAkB,MAAI,CAACT,KAAvB,CAFQ,IAEwB,MAAI,CAACU,cAF7B;AAGRH,0BAAOI,iBAAP,CAAyB,MAAI,CAACX,KAA9B,CAHQ,IAG+B,CAACK,SAHhC;AAIRE,0BAAOK,uBAAP,EAJQ,IAI2B,CAACP,SAAD,IAAc,MAAI,CAACK,cAJ9C;AAKRH,0BAAOM,sBAAP,CAA8B,MAAI,CAACb,KAAnC,CALQ,IAKoCI,iBALpC;AAMRG,0BAAOO,4BAAP,CAAoC,MAAI,CAACd,KAAzC,CANQ,IAM0CI,iBAAiB,IAAI,MAAI,CAACM,cANpE;AAORH,0BAAOQ,kBAAP,EAPQ,IAOsBb,SAPtB,OADb;;;AAWG,UAAA,MAAI,CAACQ,cAAL;AACC,uCAAC,8BAAD,IAAgB,QAAQ,EAAE,MAAI,CAACd,YAA/B,IAA8C,MAAI,CAACO,KAAL,CAAWa,QAAzD,CADD;;AAGC,UAAA,MAAI,CAACb,KAAL,CAAWa,QAdf,CADF,CADD,GADH,CADF;;;;;;;AAyBD,G,oBAlD4BC,eAAMC,S,WACrBC,mB,GAAsB,W,UACtBC,c,GAAiB,I","sourcesContent":["import React from 'react';\n\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { ZIndex } from '../../internal/ZIndex';\nimport { CommonWrapper, CommonProps } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { responsiveLayout } from '../ResponsiveLayout/decorator';\nimport * as LayoutEvents from '../../lib/LayoutEvents';\nimport { ResizeDetector } from '../../internal/ResizeDetector';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\n\nimport { ModalContext } from './ModalContext';\nimport { styles } from './Modal.styles';\n\nexport interface ModalBodyProps extends CommonProps {\n /**\n * убирает отступы\n */\n noPadding?: boolean;\n}\n\n/**\n * Контейнер с отступами от края модалки\n *\n * @visibleName Modal.Body\n */\n@responsiveLayout\n@rootNode\nexport class ModalBody extends React.Component<ModalBodyProps> {\n public static __KONTUR_REACT_UI__ = 'ModalBody';\n public static __MODAL_BODY__ = true;\n\n private theme!: Theme;\n private isMobileLayout!: boolean;\n private setRootNode!: TSetRootNode;\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n private handleResize = () => {\n LayoutEvents.emit();\n };\n\n public renderMain(): JSX.Element {\n const { noPadding } = this.props;\n return (\n <ModalContext.Consumer>\n {({ additionalPadding, hasHeader }) => (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <ZIndex\n className={cx({\n [styles.body(this.theme)]: true,\n [styles.mobileBody(this.theme)]: this.isMobileLayout,\n [styles.bodyWithoutHeader(this.theme)]: !hasHeader,\n [styles.mobileBodyWithoutHeader()]: !hasHeader && this.isMobileLayout,\n [styles.bodyAddPaddingForPanel(this.theme)]: additionalPadding,\n [styles.mobileBodyAddPaddingForPanel(this.theme)]: additionalPadding && this.isMobileLayout,\n [styles.bodyWithoutPadding()]: noPadding,\n })}\n >\n {this.isMobileLayout ? (\n <ResizeDetector onResize={this.handleResize}>{this.props.children}</ResizeDetector>\n ) : (\n this.props.children\n )}\n </ZIndex>\n </CommonWrapper>\n )}\n </ModalContext.Consumer>\n );\n }\n}\n"]}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
var _getScrollWidth = require("../../lib/dom/getScrollWidth");
|
|
4
4
|
var _Sticky = require("../Sticky");
|
|
5
5
|
var _ThemeContext = require("../../lib/theming/ThemeContext");
|
|
6
|
-
var _ZIndex = require("../../internal/ZIndex");
|
|
7
6
|
var _CommonWrapper = require("../../internal/CommonWrapper");
|
|
8
7
|
var _Emotion = require("../../lib/theming/Emotion");
|
|
9
8
|
var _ResponsiveLayout = require("../ResponsiveLayout");
|
|
@@ -85,15 +84,13 @@ function ModalFooter(props) {
|
|
|
85
84
|
};
|
|
86
85
|
|
|
87
86
|
return /*#__PURE__*/(
|
|
88
|
-
_react.default.createElement(_CommonWrapper.CommonWrapper, props,
|
|
89
|
-
_react.default.createElement(_ZIndex.ZIndex, { priority: 'ModalFooter', className: _Modal.styles.footerWrapper() },
|
|
87
|
+
_react.default.createElement(_CommonWrapper.CommonWrapper, props,
|
|
90
88
|
sticky ? /*#__PURE__*/
|
|
91
89
|
_react.default.createElement(_Sticky.Sticky, { side: "bottom", offset: modal.horizontalScroll ? (0, _getScrollWidth.getScrollWidth)() : 0 },
|
|
92
90
|
renderContent) :
|
|
93
91
|
|
|
94
92
|
|
|
95
|
-
renderContent()))
|
|
96
|
-
|
|
93
|
+
renderContent()));
|
|
97
94
|
|
|
98
95
|
|
|
99
96
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ModalFooter.tsx"],"names":["ModalFooterDataTids","root","ModalFooter","props","theme","ThemeContext","modal","ModalContext","layout","sticky","isMobile","gap","panel","children","setHasFooter","setHasPanel","renderContent","fixed","styles","footer","fixedFooter","Boolean","fixedPanel","mobileFooter","
|
|
1
|
+
{"version":3,"sources":["ModalFooter.tsx"],"names":["ModalFooterDataTids","root","ModalFooter","props","theme","ThemeContext","modal","ModalContext","layout","sticky","isMobile","gap","panel","children","setHasFooter","setHasPanel","renderContent","fixed","styles","footer","fixedFooter","Boolean","fixedPanel","mobileFooter","horizontalScroll","__KONTUR_REACT_UI__","__MODAL_FOOTER__"],"mappings":"8GAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,8C;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,IAAMA,mBAAmB,GAAG;AACjCC,EAAAA,IAAI,EAAE,mBAD2B,EAA5B;;;AAIP;AACA;AACA;AACA;AACA,G;AACA,SAASC,WAAT,CAAqBC,KAArB,EAA8C;AAC5C,MAAMC,KAAK,GAAG,uBAAWC,0BAAX,CAAd;AACA,MAAMC,KAAK,GAAG,uBAAWC,0BAAX,CAAd;AACA,MAAMC,MAAM,GAAG,4CAAf;;AAEA,sBAA4DL,KAA5D,CAAQM,MAAR,CAAQA,MAAR,8BAAiB,CAACD,MAAM,CAACE,QAAzB,iBAAmCC,GAAnC,GAA4DR,KAA5D,CAAmCQ,GAAnC,CAAwCC,KAAxC,GAA4DT,KAA5D,CAAwCS,KAAxC,CAA+CC,QAA/C,GAA4DV,KAA5D,CAA+CU,QAA/C;;AAEA,8BAAgB,YAAM;AACpBP,IAAAA,KAAK,CAACQ,YAAN,oBAAAR,KAAK,CAACQ,YAAN;AACAR,IAAAA,KAAK,CAACS,WAAN,oBA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lC;AACAvB,WAAW,CAACwB,gBAAZ,GAA+B,IAA/B","sourcesContent":["import React, { ReactNode, useContext, useLayoutEffect } from 'react';\n\nimport { getScrollWidth } from '../../lib/dom/getScrollWidth';\nimport { Sticky } from '../Sticky';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { CommonWrapper, CommonProps } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { useResponsiveLayout } from '../ResponsiveLayout';\nimport { Gapped, GappedProps } from '../Gapped';\nimport { isNonNullable } from '../../lib/utils';\n\nimport { styles } from './Modal.styles';\nimport { ModalContext } from './ModalContext';\n\nexport interface ModalFooterProps extends CommonProps {\n /**\n * Включает серый цвет в футере\n */\n panel?: boolean;\n /**\n * Закрепляет футер снизу модального окна\n *\n * На десктопе по умолчанию равен `true`\n * На мобильных по умолчанию равен `false`\n */\n sticky?: boolean;\n /**\n * Контент футера\n */\n children?: ReactNode;\n /**\n * Задаёт отступ между элементами футера\n */\n gap?: GappedProps['gap'];\n}\n\nexport const ModalFooterDataTids = {\n root: 'ModalFooter__root',\n} as const;\n\n/**\n * Футер модального окна.\n *\n * @visibleName Modal.Footer\n */\nfunction ModalFooter(props: ModalFooterProps) {\n const theme = useContext(ThemeContext);\n const modal = useContext(ModalContext);\n const layout = useResponsiveLayout();\n\n const { sticky = !layout.isMobile, gap, panel, children } = props;\n\n useLayoutEffect(() => {\n modal.setHasFooter?.();\n modal.setHasPanel?.(panel);\n\n return () => {\n modal.setHasFooter?.(false);\n modal.setHasPanel?.(false);\n };\n }, [panel]);\n\n const renderContent = (fixed = false) => {\n return (\n <div\n data-tid={ModalFooterDataTids.root}\n className={cx({\n [styles.footer(theme)]: true,\n [styles.fixedFooter(theme)]: fixed,\n [styles.panel(theme)]: Boolean(panel),\n [styles.fixedPanel(theme)]: fixed && Boolean(panel),\n [styles.mobileFooter(theme)]: layout.isMobile,\n })}\n >\n {isNonNullable(gap) ? (\n <Gapped vertical={layout.isMobile} gap={gap}>\n {children}\n </Gapped>\n ) : (\n children\n )}\n </div>\n );\n };\n\n return (\n <CommonWrapper {...props}>\n {sticky ? (\n <Sticky side=\"bottom\" offset={modal.horizontalScroll ? getScrollWidth() : 0}>\n {renderContent}\n </Sticky>\n ) : (\n renderContent()\n )}\n </CommonWrapper>\n );\n}\n\nModalFooter.__KONTUR_REACT_UI__ = 'ModalFooter';\nModalFooter.__MODAL_FOOTER__ = true;\n\nexport { ModalFooter };\n"]}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _Sticky = require("../Sticky");
|
|
4
4
|
var _ThemeContext = require("../../lib/theming/ThemeContext");
|
|
5
|
-
var _ZIndex = require("../../internal/ZIndex");
|
|
6
5
|
var _CommonWrapper = require("../../internal/CommonWrapper");
|
|
7
6
|
var _Emotion = require("../../lib/theming/Emotion");
|
|
8
7
|
var _ResponsiveLayout = require("../ResponsiveLayout");
|
|
@@ -59,11 +58,7 @@ function ModalHeader(props) {
|
|
|
59
58
|
};
|
|
60
59
|
|
|
61
60
|
return /*#__PURE__*/(
|
|
62
|
-
_react.default.createElement(_CommonWrapper.CommonWrapper, props, /*#__PURE__*/
|
|
63
|
-
_react.default.createElement(_ZIndex.ZIndex, { priority: 'ModalHeader', className: _Modal.styles.headerWrapper() },
|
|
64
|
-
sticky ? /*#__PURE__*/_react.default.createElement(_Sticky.Sticky, { side: "top" }, renderContent) : renderContent())));
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
_react.default.createElement(_CommonWrapper.CommonWrapper, props, sticky ? /*#__PURE__*/_react.default.createElement(_Sticky.Sticky, { side: "top" }, renderContent) : renderContent()));
|
|
67
62
|
|
|
68
63
|
}
|
|
69
64
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ModalHeader.tsx"],"names":["ModalHeaderDataTids","root","ModalHeader","props","theme","ThemeContext","modal","ModalContext","layout","sticky","isMobile","children","setHasHeader","renderContent","fixed","styles","header","mobileHeader","headerAddPadding","Boolean","additionalPadding","fixedHeader","mobileFixedHeader","headerWithClose","close","mobileHeaderWithClose","requestClose","disableClose","
|
|
1
|
+
{"version":3,"sources":["ModalHeader.tsx"],"names":["ModalHeaderDataTids","root","ModalHeader","props","theme","ThemeContext","modal","ModalContext","layout","sticky","isMobile","children","setHasHeader","renderContent","fixed","styles","header","mobileHeader","headerAddPadding","Boolean","additionalPadding","fixedHeader","mobileFixedHeader","headerWithClose","close","mobileHeaderWithClose","requestClose","disableClose","__KONTUR_REACT_UI__","__MODAL_HEADER__"],"mappings":"8GAAA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,8C;;;;;;;AAOO,IAAMA,mBAAmB,GAAG;AACjCC,EAAAA,IAAI,EAAE,mBAD2B,EAA5B;;;AAIP;AACA;AACA;AACA;AACA,G;AACA,SAASC,WAAT,CAAqBC,KAArB,EAA8C;AAC5C,MAAMC,KAAK,GAAG,uBAAWC,0BAAX,CAAd;AACA,MAAMC,KAAK,GAAG,uBAAWC,0BAAX,CAAd;AACA,MAAMC,MAAM,GAAG,4CAAf;;AAEA,sBAAgDL,KAAhD,CAAQM,MAAR,CAAQA,MAAR,8BAAiB,CAACD,MAAM,CAACE,QAAzB,iBAAmCC,QAAnC,GAAgDR,KAAhD,CAAmCQ,QAAnC;;AAEA,8BAAgB,YAAM;AACpBL,IAAAA,KAAK,CAACM,YAAN,oBAAAN,KAAK,CAACM,YAAN;;AAEA,WAAO,oBAAMN,KAAK,CAACM,YAAZ,oBAAMN,KAAK,CAACM,YAAN,CAAqB,KAArB,CAAN,EAAP;AACD,GAJD,EAIG,EAJH;;AAMA,MAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD,EAAmB,aAAlBA,KAAkB,cAAlBA,KAAkB,GAAV,KAAU;AACvC;AACE;AACE,oBAAUd,mBAAmB,CAACC,IADhC;AAEE,QAAA,SAAS,EAAE;AACRc,sBAAOC,MAAP,CAAcZ,KAAd,CADQ,IACe,IADf;AAERW,sBAAOE,YAAP,CAAoBb,KAApB,CAFQ,IAEqBI,MAAM,CAACE,QAF5B;AAGRK,sBAAOG,gBAAP,EAHQ,IAGoBC,OAAO,CAACb,KAAK,CAACc,iBAAP,CAH3B;AAIRL,sBAAOM,WAAP,CAAmBjB,KAAnB,CAJQ,IAIoBU,KAJpB;AAKRC,sBAAOO,iBAAP,CAAyBlB,KAAzB,CALQ,IAK0BU,KAAK,IAAIN,MAAM,CAACE,QAL1C;AAMRK,sBAAOQ,eAAP,CAAuBnB,KAAvB,CANQ,IAMwBe,OAAO,CAACb,KAAK,CAACkB,KAAP,CAN/B;AAORT,sBAAOU,qBAAP,CAA6BrB,KAA7B,CAPQ,IAO8BI,MAAM,CAACE,QAPrC,OAFb;;;AAYGJ,MAAAA,KAAK,CAACkB,KAAN,iBAAe,6BAAC,sBAAD,IAAY,YAAY,EAAElB,KAAK,CAACkB,KAAN,CAAYE,YAAtC,EAAoD,YAAY,EAAEpB,KAAK,CAACkB,KAAN,CAAYG,YAA9E,GAZlB;AAaGhB,MAAAA,QAbH,CADF;;;AAiBD,GAlBD;;AAoBA;AACE,iCAAC,4BAAD,EAAmBR,KAAnB,EAA2BM,MAAM,gBAAG,6BAAC,cAAD,IAAQ,IAAI,EAAC,KAAb,IAAoBI,aAApB,CAAH,GAAiDA,aAAa,EAA/F,CADF;;AAGD;;AAEDX,WAAW,CAAC0B,mBAAZ,GAAkC,aAAlC;AACA1B,WAAW,CAAC2B,gBAAZ,GAA+B,IAA/B","sourcesContent":["import React, { ReactNode, useContext, useLayoutEffect } from 'react';\n\nimport { Sticky } from '../Sticky';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { CommonWrapper, CommonProps } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { useResponsiveLayout } from '../ResponsiveLayout';\n\nimport { styles } from './Modal.styles';\nimport { ModalClose } from './ModalClose';\nimport { ModalContext } from './ModalContext';\n\nexport interface ModalHeaderProps extends CommonProps {\n sticky?: boolean;\n children?: ReactNode;\n}\n\nexport const ModalHeaderDataTids = {\n root: 'ModalHeader__root',\n} as const;\n\n/**\n * Шапка модального окна\n *\n * @visibleName Modal.Header\n */\nfunction ModalHeader(props: ModalHeaderProps) {\n const theme = useContext(ThemeContext);\n const modal = useContext(ModalContext);\n const layout = useResponsiveLayout();\n\n const { sticky = !layout.isMobile, children } = props;\n\n useLayoutEffect(() => {\n modal.setHasHeader?.();\n\n return () => modal.setHasHeader?.(false);\n }, []);\n\n const renderContent = (fixed = false) => {\n return (\n <div\n data-tid={ModalHeaderDataTids.root}\n className={cx({\n [styles.header(theme)]: true,\n [styles.mobileHeader(theme)]: layout.isMobile,\n [styles.headerAddPadding()]: Boolean(modal.additionalPadding),\n [styles.fixedHeader(theme)]: fixed,\n [styles.mobileFixedHeader(theme)]: fixed && layout.isMobile,\n [styles.headerWithClose(theme)]: Boolean(modal.close),\n [styles.mobileHeaderWithClose(theme)]: layout.isMobile,\n })}\n >\n {modal.close && <ModalClose requestClose={modal.close.requestClose} disableClose={modal.close.disableClose} />}\n {children}\n </div>\n );\n };\n\n return (\n <CommonWrapper {...props}>{sticky ? <Sticky side=\"top\">{renderContent}</Sticky> : renderContent()}</CommonWrapper>\n );\n}\n\nModalHeader.__KONTUR_REACT_UI__ = 'ModalHeader';\nModalHeader.__MODAL_HEADER__ = true;\n\nexport { ModalHeader };\n"]}
|
|
@@ -190,12 +190,12 @@ PasswordInput = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*
|
|
|
190
190
|
capsLockEnabled && /*#__PURE__*/
|
|
191
191
|
_react.default.createElement("span", { className: _PasswordInput.styles.capsLockDetector(), "data-tid": PasswordInputDataTids.capsLockDetector }), /*#__PURE__*/
|
|
192
192
|
|
|
193
|
-
_react.default.createElement("span", {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
193
|
+
_react.default.createElement("span", { className: (0, _Emotion.cx)(_PasswordInput.styles.toggleVisibility(_this.theme), _this.getEyeWrapperClassname()) },
|
|
194
|
+
!_this.props.disabled && /*#__PURE__*/
|
|
195
|
+
_react.default.createElement("span", { onClick: _this.handleToggleVisibility, "data-tid": PasswordInputDataTids.eyeIcon }, /*#__PURE__*/
|
|
196
|
+
_react.default.createElement(_PasswordInputIcon.PasswordInputIcon, { visible: _this.state.visible })))));
|
|
197
|
+
|
|
197
198
|
|
|
198
|
-
!_this.props.disabled && /*#__PURE__*/_react.default.createElement(_PasswordInputIcon.PasswordInputIcon, { visible: _this.state.visible }))));
|
|
199
199
|
|
|
200
200
|
|
|
201
201
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PasswordInput.tsx"],"names":["PasswordInputDataTids","root","capsLockDetector","eyeIcon","PasswordInput","rootNode","getProps","defaultProps","state","visible","capsLockEnabled","focus","input","blur","handleBlur","handleKeyPress","e","props","onKeyPress","detectCapsLock","getModifierState","Codes","CapsLock","setState","handleKeydown","onKeyDown","handleToggleVisibility","prevState","handleFocus","renderEye","styles","iconWrapper","toggleVisibility","theme","getEyeWrapperClassname","disabled","refInput","element","hideSymbols","renderMain","rest","inputProps","rightIcon","componentDidMount","isIE11","window","document","msCapsLockWarningOff","getDerivedStateFromProps","render","setRootNode","size","eyeWrapperLarge","eyeWrapperMedium","eyeWrapperSmall","React","PureComponent","__KONTUR_REACT_UI__","propTypes","PropTypes","bool"],"mappings":";;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,wD;;;;;;;;;;;AAWO,IAAMA,qBAAqB,GAAG;AACnCC,EAAAA,IAAI,EAAE,eAD6B;AAEnCC,EAAAA,gBAAgB,EAAE,+BAFiB;AAGnCC,EAAAA,OAAO,EAAE,sBAH0B,EAA9B,C;;;;;AAQP;AACA;AACA,G;;AAEaC,a,OADZC,kB;;;;;;;;;;;;;;AAeSC,IAAAA,Q,GAAW,0CAAkBF,aAAa,CAACG,YAAhC,C;;AAEZC,IAAAA,K,GA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AAR,kCAAiC,CAC/B,QAAQ,KAAK5B,QAAL,GAAgB6C,IAAxB,GACE,KAAK,OAAL,CACE,OAAOrB,sBAAOsB,eAAP,CAAuB,KAAKnB,KAA5B,CAAP,CACF,KAAK,QAAL,CACE,OAAOH,sBAAOuB,gBAAP,CAAwB,KAAKpB,KAA7B,CAAP,CACF,KAAK,OAAL,CACA,QACE,OAAOH,sBAAOwB,eAAP,CAAuB,KAAKrB,KAA5B,CAAP,CAPJ,CASD,C,wBA3IgCsB,eAAMC,a,WACzBC,mB,GAAsB,e,UAEtBC,S,GAAY,EACxB;AACJ;AACA,KACIvC,cAAc,EAAEwC,mBAAUC,IAJF,E,UAOZrD,Y,GAA6B,EACzC4C,IAAI,EAAE,OADmC,E","sourcesContent":["// TODO: Enable this rule in functional components.\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { RenderLayer } from '../../internal/RenderLayer';\nimport { isNonNullable } from '../../lib/utils';\nimport { isKeyCapsLock } from '../../lib/events/keyboard/identifiers';\nimport { KeyboardEventCodes as Codes } from '../../lib/events/keyboard/KeyboardEventCodes';\nimport { Input, InputProps } from '../Input';\nimport { Nullable } from '../../typings/utility-types';\nimport { isIE11 } from '../../lib/client';\nimport { CommonWrapper, CommonProps, CommonWrapperRestProps } from '../../internal/CommonWrapper';\nimport { Theme } from '../../lib/theming/Theme';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { cx } from '../../lib/theming/Emotion';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\n\nimport { styles } from './PasswordInput.styles';\nimport { PasswordInputIcon } from './PasswordInputIcon';\n\nexport interface PasswordInputProps extends CommonProps, InputProps {\n detectCapsLock?: boolean;\n}\n\nexport interface PasswordInputState {\n visible: boolean;\n capsLockEnabled?: boolean | null;\n}\n\nexport const PasswordInputDataTids = {\n root: 'PasswordInput',\n capsLockDetector: 'PasswordInputCapsLockDetector',\n eyeIcon: 'PasswordInputEyeIcon',\n} as const;\n\ntype DefaultProps = Required<Pick<PasswordInputProps, 'size'>>;\n\n/**\n * Компонент для ввода пароля\n */\n@rootNode\nexport class PasswordInput extends React.PureComponent<PasswordInputProps, PasswordInputState> {\n public static __KONTUR_REACT_UI__ = 'PasswordInput';\n\n public static propTypes = {\n /**\n * Включает CapsLock детектор\n */\n detectCapsLock: PropTypes.bool,\n };\n\n public static defaultProps: DefaultProps = {\n size: 'small',\n };\n\n private getProps = createPropsGetter(PasswordInput.defaultProps);\n\n public state: PasswordInputState = {\n visible: false,\n capsLockEnabled: false,\n };\n\n private theme!: Theme;\n\n private input: Nullable<Input>;\n private setRootNode!: TSetRootNode;\n\n public componentDidMount() {\n if (this.props.detectCapsLock) {\n this.setState({ capsLockEnabled: null });\n }\n\n // @ts-expect-error: IE-specific API.\n if (isIE11 && !window.document.msCapsLockWarningOff) {\n // @ts-expect-error: Read the comment above.\n // turns off default ie capslock warning\n window.document.msCapsLockWarningOff = true;\n }\n }\n\n public static getDerivedStateFromProps(props: PasswordInputProps, state: PasswordInputState) {\n if (props.disabled) {\n return { visible: false };\n }\n\n return state;\n }\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n {this.renderMain}\n </CommonWrapper>\n );\n }}\n </ThemeContext.Consumer>\n );\n }\n\n /**\n * @public\n */\n public focus = () => {\n if (this.input) {\n this.input.focus();\n }\n };\n\n /**\n * @public\n */\n public blur = () => {\n this.handleBlur();\n };\n\n private handleKeyPress = (e: React.KeyboardEvent<HTMLInputElement>) => {\n const { onKeyPress, detectCapsLock } = this.props;\n\n if (onKeyPress) {\n onKeyPress(e);\n }\n\n if (!detectCapsLock) {\n return;\n }\n\n const capsLockEnabled = e.getModifierState(Codes.CapsLock);\n\n this.setState({ capsLockEnabled });\n };\n\n private handleKeydown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n const {\n props: { detectCapsLock, onKeyDown },\n state: { capsLockEnabled },\n } = this;\n\n if (onKeyDown) {\n onKeyDown(e);\n }\n\n if (!detectCapsLock) {\n return;\n }\n\n if (isKeyCapsLock(e) && isNonNullable(capsLockEnabled)) {\n this.setState({ capsLockEnabled: !capsLockEnabled });\n }\n };\n\n private handleToggleVisibility = () => {\n this.setState((prevState) => ({ visible: !prevState.visible }), this.handleFocus);\n };\n\n private handleFocus = () => {\n if (this.input) {\n this.input.focus();\n }\n };\n\n private handleBlur = () => {\n if (this.input) {\n this.input.blur();\n }\n };\n\n private getEyeWrapperClassname() {\n switch (this.getProps().size) {\n case 'large':\n return styles.eyeWrapperLarge(this.theme);\n case 'medium':\n return styles.eyeWrapperMedium(this.theme);\n case 'small':\n default:\n return styles.eyeWrapperSmall(this.theme);\n }\n }\n\n private renderEye = () => {\n const { capsLockEnabled } = this.state;\n\n return (\n <span className={styles.iconWrapper()}>\n {capsLockEnabled && (\n <span className={styles.capsLockDetector()} data-tid={PasswordInputDataTids.capsLockDetector} />\n )}\n <span\n data-tid={PasswordInputDataTids.eyeIcon}\n className={cx(styles.toggleVisibility(this.theme), this.getEyeWrapperClassname())}\n onClick={this.handleToggleVisibility}\n >\n {!this.props.disabled && <PasswordInputIcon visible={this.state.visible} />}\n </span>\n </span>\n );\n };\n\n private refInput = (element: Input) => {\n this.input = element;\n };\n\n private hideSymbols = () => {\n this.setState({ visible: false });\n };\n\n private renderMain = (props: CommonWrapperRestProps<PasswordInputProps>) => {\n const { detectCapsLock, ...rest } = props;\n const inputProps = {\n ...rest,\n onKeyDown: this.handleKeydown,\n onKeyPress: this.handleKeyPress,\n rightIcon: this.renderEye(),\n };\n\n return (\n <RenderLayer onFocusOutside={this.hideSymbols} onClickOutside={this.hideSymbols}>\n <div data-tid={PasswordInputDataTids.root} className={styles.root()}>\n <Input ref={this.refInput} type={this.state.visible ? 'text' : 'password'} {...inputProps} />\n </div>\n </RenderLayer>\n );\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["PasswordInput.tsx"],"names":["PasswordInputDataTids","root","capsLockDetector","eyeIcon","PasswordInput","rootNode","getProps","defaultProps","state","visible","capsLockEnabled","focus","input","blur","handleBlur","handleKeyPress","e","props","onKeyPress","detectCapsLock","getModifierState","Codes","CapsLock","setState","handleKeydown","onKeyDown","handleToggleVisibility","prevState","handleFocus","renderEye","styles","iconWrapper","toggleVisibility","theme","getEyeWrapperClassname","disabled","refInput","element","hideSymbols","renderMain","rest","inputProps","rightIcon","componentDidMount","isIE11","window","document","msCapsLockWarningOff","getDerivedStateFromProps","render","setRootNode","size","eyeWrapperLarge","eyeWrapperMedium","eyeWrapperSmall","React","PureComponent","__KONTUR_REACT_UI__","propTypes","PropTypes","bool"],"mappings":";;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,wD;;;;;;;;;;;AAWO,IAAMA,qBAAqB,GAAG;AACnCC,EAAAA,IAAI,EAAE,eAD6B;AAEnCC,EAAAA,gBAAgB,EAAE,+BAFiB;AAGnCC,EAAAA,OAAO,EAAE,sBAH0B,EAA9B,C;;;;;AAQP;AACA;AACA,G;;AAEaC,a,OADZC,kB;;;;;;;;;;;;;;AAeSC,IAAAA,Q,GAAW,0CAAkBF,aAAa,CAACG,YAAhC,C;;AAEZC,IAAAA,K,GAA4B;AACjCC,MAAAA,OAAO,EAAE,KADwB;AAEjCC,MAAAA,eAAe,EAAE,KAFgB,E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiD5BC,IAAAA,K,GAAQ,YAAM;AACnB,UAAI,MAAKC,KAAT,EAAgB;AACd,cAAKA,KAAL,CAAWD,KAAX;AACD;AACF,K;;;;;AAKME,IAAAA,I,GAAO,YAAM;AAClB,YAAKC,UAAL;AACD,K;;AAEOC,IAAAA,c,GAAiB,UAACC,CAAD,EAA8C;AACrE,wBAAuC,MAAKC,KAA5C,CAA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A,KACIvC,cAAc,EAAEwC,mBAAUC,IAJF,E,UAOZrD,Y,GAA6B,EACzC4C,IAAI,EAAE,OADmC,E","sourcesContent":["// TODO: Enable this rule in functional components.\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { RenderLayer } from '../../internal/RenderLayer';\nimport { isNonNullable } from '../../lib/utils';\nimport { isKeyCapsLock } from '../../lib/events/keyboard/identifiers';\nimport { KeyboardEventCodes as Codes } from '../../lib/events/keyboard/KeyboardEventCodes';\nimport { Input, InputProps } from '../Input';\nimport { Nullable } from '../../typings/utility-types';\nimport { isIE11 } from '../../lib/client';\nimport { CommonWrapper, CommonProps, CommonWrapperRestProps } from '../../internal/CommonWrapper';\nimport { Theme } from '../../lib/theming/Theme';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { cx } from '../../lib/theming/Emotion';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\n\nimport { styles } from './PasswordInput.styles';\nimport { PasswordInputIcon } from './PasswordInputIcon';\n\nexport interface PasswordInputProps extends CommonProps, InputProps {\n detectCapsLock?: boolean;\n}\n\nexport interface PasswordInputState {\n visible: boolean;\n capsLockEnabled?: boolean | null;\n}\n\nexport const PasswordInputDataTids = {\n root: 'PasswordInput',\n capsLockDetector: 'PasswordInputCapsLockDetector',\n eyeIcon: 'PasswordInputEyeIcon',\n} as const;\n\ntype DefaultProps = Required<Pick<PasswordInputProps, 'size'>>;\n\n/**\n * Компонент для ввода пароля\n */\n@rootNode\nexport class PasswordInput extends React.PureComponent<PasswordInputProps, PasswordInputState> {\n public static __KONTUR_REACT_UI__ = 'PasswordInput';\n\n public static propTypes = {\n /**\n * Включает CapsLock детектор\n */\n detectCapsLock: PropTypes.bool,\n };\n\n public static defaultProps: DefaultProps = {\n size: 'small',\n };\n\n private getProps = createPropsGetter(PasswordInput.defaultProps);\n\n public state: PasswordInputState = {\n visible: false,\n capsLockEnabled: false,\n };\n\n private theme!: Theme;\n\n private input: Nullable<Input>;\n private setRootNode!: TSetRootNode;\n\n public componentDidMount() {\n if (this.props.detectCapsLock) {\n this.setState({ capsLockEnabled: null });\n }\n\n // @ts-expect-error: IE-specific API.\n if (isIE11 && !window.document.msCapsLockWarningOff) {\n // @ts-expect-error: Read the comment above.\n // turns off default ie capslock warning\n window.document.msCapsLockWarningOff = true;\n }\n }\n\n public static getDerivedStateFromProps(props: PasswordInputProps, state: PasswordInputState) {\n if (props.disabled) {\n return { visible: false };\n }\n\n return state;\n }\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n {this.renderMain}\n </CommonWrapper>\n );\n }}\n </ThemeContext.Consumer>\n );\n }\n\n /**\n * @public\n */\n public focus = () => {\n if (this.input) {\n this.input.focus();\n }\n };\n\n /**\n * @public\n */\n public blur = () => {\n this.handleBlur();\n };\n\n private handleKeyPress = (e: React.KeyboardEvent<HTMLInputElement>) => {\n const { onKeyPress, detectCapsLock } = this.props;\n\n if (onKeyPress) {\n onKeyPress(e);\n }\n\n if (!detectCapsLock) {\n return;\n }\n\n const capsLockEnabled = e.getModifierState(Codes.CapsLock);\n\n this.setState({ capsLockEnabled });\n };\n\n private handleKeydown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n const {\n props: { detectCapsLock, onKeyDown },\n state: { capsLockEnabled },\n } = this;\n\n if (onKeyDown) {\n onKeyDown(e);\n }\n\n if (!detectCapsLock) {\n return;\n }\n\n if (isKeyCapsLock(e) && isNonNullable(capsLockEnabled)) {\n this.setState({ capsLockEnabled: !capsLockEnabled });\n }\n };\n\n private handleToggleVisibility = () => {\n this.setState((prevState) => ({ visible: !prevState.visible }), this.handleFocus);\n };\n\n private handleFocus = () => {\n if (this.input) {\n this.input.focus();\n }\n };\n\n private handleBlur = () => {\n if (this.input) {\n this.input.blur();\n }\n };\n\n private getEyeWrapperClassname() {\n switch (this.getProps().size) {\n case 'large':\n return styles.eyeWrapperLarge(this.theme);\n case 'medium':\n return styles.eyeWrapperMedium(this.theme);\n case 'small':\n default:\n return styles.eyeWrapperSmall(this.theme);\n }\n }\n\n private renderEye = () => {\n const { capsLockEnabled } = this.state;\n\n return (\n <span className={styles.iconWrapper()}>\n {capsLockEnabled && (\n <span className={styles.capsLockDetector()} data-tid={PasswordInputDataTids.capsLockDetector} />\n )}\n <span className={cx(styles.toggleVisibility(this.theme), this.getEyeWrapperClassname())}>\n {!this.props.disabled && (\n <span onClick={this.handleToggleVisibility} data-tid={PasswordInputDataTids.eyeIcon}>\n <PasswordInputIcon visible={this.state.visible} />\n </span>\n )}\n </span>\n </span>\n );\n };\n\n private refInput = (element: Input) => {\n this.input = element;\n };\n\n private hideSymbols = () => {\n this.setState({ visible: false });\n };\n\n private renderMain = (props: CommonWrapperRestProps<PasswordInputProps>) => {\n const { detectCapsLock, ...rest } = props;\n const inputProps = {\n ...rest,\n onKeyDown: this.handleKeydown,\n onKeyPress: this.handleKeyPress,\n rightIcon: this.renderEye(),\n };\n\n return (\n <RenderLayer onFocusOutside={this.hideSymbols} onClickOutside={this.hideSymbols}>\n <div data-tid={PasswordInputDataTids.root} className={styles.root()}>\n <Input ref={this.refInput} type={this.state.visible ? 'text' : 'password'} {...inputProps} />\n </div>\n </RenderLayer>\n );\n };\n}\n"]}
|
|
@@ -70,10 +70,10 @@ class Toaster extends React.Component {
|
|
|
70
70
|
|
|
71
71
|
### SuperToast
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
Вы можете объединить удобство статических методов и кастамизируемость классического способа через `ref`.
|
|
74
74
|
Для этого можно добавить обёртку, которая позволяет Toast работать по примеру GlobalLoader.
|
|
75
75
|
|
|
76
|
-
Т.е. кастомный Toast можно добавить в единственном месте
|
|
76
|
+
Т.е. кастомный Toast можно добавить в единственном месте в проекте, а статические методы будут всегда использовать последний отрендеренный экземпляр Toast:
|
|
77
77
|
|
|
78
78
|
Также в обёртке можно изменить логику появления всплывашки, по рекомендации Гайдов:
|
|
79
79
|
https://guides.kontur.ru/components/toast/#08
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.LOADER_SHOW_TIME = exports.DefaultState = exports.DELAY_BEFORE_SHOW_LOADER = exports.CustomComboBoxDataTids = exports.CustomComboBox = void 0;var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));var _react = _interopRequireDefault(require("react"));
|
|
2
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
|
|
@@ -332,18 +333,20 @@ CustomComboBox = (0, _decorator.responsiveLayout)(_class = (0, _rootNode.rootNod
|
|
|
332
333
|
var effects;
|
|
333
334
|
var nextState;
|
|
334
335
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
336
|
+
_reactDom.default.flushSync(function () {
|
|
337
|
+
_this.setState(
|
|
338
|
+
function (state) {
|
|
339
|
+
var stateAndEffect = _this.reducer(state, _this.props, action);var _ref =
|
|
338
340
|
|
|
339
|
-
|
|
341
|
+
stateAndEffect instanceof Array ? stateAndEffect : [stateAndEffect, []];nextState = _ref[0];effects = _ref[1];
|
|
340
342
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
343
|
+
return nextState;
|
|
344
|
+
},
|
|
345
|
+
function () {
|
|
346
|
+
effects.forEach(_this.handleEffect);
|
|
347
|
+
});
|
|
346
348
|
|
|
349
|
+
});
|
|
347
350
|
};_this.
|
|
348
351
|
|
|
349
352
|
handleEffect = function (effect) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CustomComboBox.tsx"],"names":["DELAY_BEFORE_SHOW_LOADER","LOADER_SHOW_TIME","DefaultState","inputChanged","editing","items","loading","opened","focused","textValue","repeatRequest","undefined","requestStatus","ComboBoxRequestStatus","Unknown","CustomComboBoxDataTids","comboBoxView","CustomComboBox","responsiveLayout","rootNode","state","requestId","cancelationToken","reducer","cancelLoaderDelay","focus","props","disabled","input","inputLikeText","selectInputText","selectAll","blur","handleBlur","dispatch","action","effects","nextState","setState","stateAndEffect","Array","forEach","handleEffect","effect","getState","getProps","handleValueChange","value","type","keepFocus","isMobileLayout","handleFocus","handleClickOutside","e","close","setTimeout","handleInputBlur","handleInputClick","search","query","getItems","cancelPromise","Promise","_","reject","expectingId","loaderShowDelay","resolve","cancelLoader","catch","race","code","cancelSearch","CancelationError","open","render","viewProps","align","borderless","disablePortal","error","menuAlign","drawArrow","menuPos","placeholder","size","totalCount","warning","width","maxLength","maxMenuHeight","leftIcon","rightIcon","inputMode","onValueChange","onClickOutside","onFocus","onFocusOutside","onInputBlur","onInputValueChange","onInputFocus","onInputClick","onInputKeyDown","event","persist","onMouseEnter","onMouseOver","onMouseLeave","renderItem","renderNotFound","itemWrapper","renderValue","renderTotalCount","renderAddButton","refInput","refMenu","menu","refInputLikeText","setRootNode","componentDidMount","autoFocus","componentDidUpdate","prevProps","prevState","reset","React","PureComponent","__KONTUR_REACT_UI__"],"mappings":"quBAAA;;;;;;;AAOA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA,8C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DO,IAAMA,wBAAwB,GAAG,GAAjC,C;AACA,IAAMC,gBAAgB,GAAG,IAAzB,C;;AAEA,IAAMC,YAAY,GAAG;AAC1BC,EAAAA,YAAY,EAAE,KADY;AAE1BC,EAAAA,OAAO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;AACA,K,QACSC,K,GAAP,iBAAe,CACb,KAAK1F,QAAL,CAAc,EAAEc,IAAI,EAAE,OAAR,EAAd,EACD,C,yBArOoC6E,eAAMC,a,WAC7BC,mB,GAAsB,gB","sourcesContent":["import React, { AriaAttributes } from 'react';\n\nimport { Nullable } from '../../typings/utility-types';\nimport { Input, InputIconType } from '../../components/Input';\nimport { Menu } from '../Menu';\nimport { InputLikeText } from '../InputLikeText';\nimport { MenuItemState } from '../../components/MenuItem';\nimport { CancelationError, taskWithDelay } from '../../lib/utils';\nimport { fixClickFocusIE } from '../../lib/events/fixClickFocusIE';\nimport { CommonProps, CommonWrapper } from '../../internal/CommonWrapper';\nimport { responsiveLayout } from '../../components/ResponsiveLayout/decorator';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { DropdownContainerProps } from '../DropdownContainer';\n\nimport { ComboBoxRequestStatus } from './CustomComboBoxTypes';\nimport { CustomComboBoxAction, CustomComboBoxEffect, reducer } from './CustomComboBoxReducer';\nimport { ComboBoxView } from './ComboBoxView';\n\nexport interface CustomComboBoxProps<T> extends Pick<DropdownContainerProps, 'menuPos'>, CommonProps {\n align?: 'left' | 'center' | 'right';\n autoFocus?: boolean;\n borderless?: boolean;\n disablePortal?: boolean;\n disabled?: boolean;\n /**\n * Cостояние валидации при ошибке.\n */\n error?: boolean;\n maxLength?: number;\n menuAlign?: 'left' | 'right';\n drawArrow?: boolean;\n leftIcon?: InputIconType;\n rightIcon?: InputIconType;\n searchOnFocus?: boolean;\n onValueChange?: (value: T) => void;\n onInputValueChange?: (value: string) => Nullable<string> | void;\n onUnexpectedInput?: (value: string) => void | null | T;\n onFocus?: () => void;\n onBlur?: () => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseOver?: (e: React.MouseEvent) => void;\n onMouseLeave?: (e: React.MouseEvent) => void;\n onInputKeyDown?: (e: React.KeyboardEvent<HTMLElement>) => void;\n placeholder?: string;\n size?: 'small' | 'medium' | 'large';\n totalCount?: number;\n value?: Nullable<T>;\n /**\n * Cостояние валидации при предупреждении.\n */\n warning?: boolean;\n 'aria-describedby'?: AriaAttributes['aria-describedby'];\n width?: string | number;\n maxMenuHeight?: number | string;\n renderNotFound?: () => React.ReactNode;\n renderTotalCount?: (found: number, total: number) => React.ReactNode;\n renderItem: (item: T, state?: MenuItemState) => React.ReactNode;\n itemWrapper?: (item?: T) => React.ComponentType<unknown>;\n renderValue: (value: T) => React.ReactNode;\n renderAddButton?: (query?: string) => React.ReactNode;\n valueToString: (value: T) => string;\n itemToValue: (item: T) => string | number;\n getItems: (query: string) => Promise<T[]>;\n inputMode?: React.HTMLAttributes<HTMLInputElement>['inputMode'];\n}\n\nexport interface CustomComboBoxState<T> {\n editing: boolean;\n loading: boolean;\n opened: boolean;\n textValue: string;\n items: Nullable<T[]>;\n inputChanged: boolean;\n focused: boolean;\n repeatRequest: () => void;\n requestStatus: ComboBoxRequestStatus;\n}\n\nexport const DELAY_BEFORE_SHOW_LOADER = 300;\nexport const LOADER_SHOW_TIME = 1000;\n\nexport const DefaultState = {\n inputChanged: false,\n editing: false,\n items: null,\n loading: false,\n opened: false,\n focused: false,\n textValue: '',\n repeatRequest: () => undefined,\n requestStatus: ComboBoxRequestStatus.Unknown,\n};\n\nexport const CustomComboBoxDataTids = {\n comboBoxView: 'ComboBoxView__root',\n} as const;\n\n@responsiveLayout\n@rootNode\nexport class CustomComboBox<T> extends React.PureComponent<CustomComboBoxProps<T>, CustomComboBoxState<T>> {\n public static __KONTUR_REACT_UI__ = 'CustomComboBox';\n\n public state: CustomComboBoxState<T> = DefaultState;\n public input: Nullable<Input>;\n public menu: Nullable<Menu>;\n public inputLikeText: Nullable<InputLikeText>;\n public requestId = 0;\n public loaderShowDelay: Nullable<Promise<void>>;\n private focused = false;\n private cancelationToken: Nullable<(reason?: Error) => void> = null;\n private isMobileLayout!: boolean;\n\n private reducer = reducer;\n public cancelLoaderDelay: () => void = () => null;\n\n /**\n * @public\n */\n public focus = () => {\n if (this.props.disabled) {\n return;\n }\n\n if (this.input) {\n this.input.focus();\n } else if (this.inputLikeText) {\n this.inputLikeText.focus();\n }\n };\n\n /**\n * @public\n */\n public selectInputText = () => {\n if (this.props.disabled) {\n return;\n }\n if (this.input) {\n this.input.selectAll();\n }\n };\n\n /**\n * @public\n */\n public blur = () => {\n if (this.props.disabled) {\n return;\n }\n\n this.handleBlur();\n };\n private setRootNode!: TSetRootNode;\n\n /**\n * @public\n */\n public async search(query: string = this.state.textValue) {\n const { getItems } = this.props;\n\n const cancelPromise: Promise<never> = new Promise((_, reject) => (this.cancelationToken = reject));\n this.requestId += 1;\n const expectingId = this.requestId;\n\n if (!this.loaderShowDelay) {\n this.loaderShowDelay = new Promise<void>((resolve) => {\n const cancelLoader = taskWithDelay(() => {\n this.dispatch({ type: 'RequestItems' });\n setTimeout(resolve, LOADER_SHOW_TIME);\n }, DELAY_BEFORE_SHOW_LOADER);\n\n cancelPromise.catch(() => cancelLoader());\n\n this.cancelLoaderDelay = () => {\n cancelLoader();\n resolve();\n };\n });\n }\n\n try {\n const items = await Promise.race([getItems(query), cancelPromise]);\n if (this.state.loading) {\n await Promise.race([this.loaderShowDelay, cancelPromise]);\n }\n if (expectingId === this.requestId) {\n this.dispatch({\n type: 'ReceiveItems',\n items,\n });\n }\n } catch (error) {\n if (error && error.code === 'CancelationError') {\n this.dispatch({ type: 'CancelRequest' });\n } else if (expectingId === this.requestId) {\n this.dispatch({\n type: 'RequestFailure',\n repeatRequest: () => {\n this.search(query);\n if (this.input) {\n this.input.focus();\n }\n },\n });\n }\n } finally {\n if (expectingId === this.requestId) {\n if (!this.state.loading) {\n this.cancelLoaderDelay();\n }\n this.cancelationToken = null;\n this.loaderShowDelay = null;\n }\n }\n }\n\n /**\n * @public\n */\n public cancelSearch() {\n if (this.cancelationToken) {\n this.cancelationToken(new CancelationError());\n }\n }\n\n /**\n * @public\n */\n public open() {\n this.dispatch({ type: 'Open' });\n }\n\n /**\n * @public\n */\n public close() {\n this.dispatch({ type: 'Close' });\n }\n\n public render() {\n const viewProps = {\n align: this.props.align,\n borderless: this.props.borderless,\n disabled: this.props.disabled,\n disablePortal: this.props.disablePortal,\n editing: this.state.editing,\n error: this.props.error,\n items: this.state.items,\n loading: this.state.loading,\n menuAlign: this.props.menuAlign,\n opened: this.state.opened,\n drawArrow: this.props.drawArrow,\n menuPos: this.props.menuPos,\n placeholder: this.props.placeholder,\n size: this.props.size,\n textValue: this.state.textValue,\n totalCount: this.props.totalCount,\n value: this.props.value,\n warning: this.props.warning,\n 'aria-describedby': this.props['aria-describedby'],\n width: this.props.width,\n maxLength: this.props.maxLength,\n maxMenuHeight: this.props.maxMenuHeight,\n leftIcon: this.props.leftIcon,\n rightIcon: this.props.rightIcon,\n inputMode: this.props.inputMode,\n\n onValueChange: this.handleValueChange,\n onClickOutside: this.handleClickOutside,\n onFocus: this.handleFocus,\n onFocusOutside: this.handleBlur,\n onInputBlur: this.handleInputBlur,\n onInputValueChange: (value: string) => this.dispatch({ type: 'TextChange', value }),\n onInputFocus: this.handleFocus,\n onInputClick: this.handleInputClick,\n onInputKeyDown: (event: React.KeyboardEvent) => {\n event.persist();\n this.dispatch({ type: 'KeyPress', event });\n },\n onMouseEnter: this.props.onMouseEnter,\n onMouseOver: this.props.onMouseOver,\n onMouseLeave: this.props.onMouseLeave,\n renderItem: this.props.renderItem,\n renderNotFound: this.props.renderNotFound,\n itemWrapper: this.props.itemWrapper,\n renderValue: this.props.renderValue,\n renderTotalCount: this.props.renderTotalCount,\n renderAddButton: this.props.renderAddButton,\n repeatRequest: this.state.repeatRequest,\n requestStatus: this.state.requestStatus,\n\n refInput: (input: Nullable<Input>) => {\n this.input = input;\n },\n refMenu: (menu: Nullable<Menu>) => {\n this.menu = menu;\n },\n refInputLikeText: (inputLikeText: Nullable<InputLikeText>) => {\n this.inputLikeText = inputLikeText;\n },\n };\n\n return (\n <CommonWrapper {...this.props}>\n <ComboBoxView {...viewProps} ref={this.setRootNode} />\n </CommonWrapper>\n );\n }\n\n public componentDidMount() {\n this.dispatch({ type: 'Mount' });\n if (this.props.autoFocus) {\n this.focus();\n }\n }\n\n public componentDidUpdate(prevProps: CustomComboBoxProps<T>, prevState: CustomComboBoxState<T>) {\n if (prevState.editing && !this.state.editing) {\n this.handleBlur();\n }\n this.dispatch({ type: 'DidUpdate', prevProps, prevState });\n }\n\n /**\n * @public\n */\n public reset() {\n this.dispatch({ type: 'Reset' });\n }\n\n private dispatch = (action: CustomComboBoxAction<T>) => {\n let effects: Array<CustomComboBoxEffect<T>>;\n let nextState: Pick<CustomComboBoxState<T>, never>;\n\n this.setState(\n (state) => {\n const stateAndEffect = this.reducer(state, this.props, action);\n\n [nextState, effects] = stateAndEffect instanceof Array ? stateAndEffect : [stateAndEffect, []];\n\n return nextState;\n },\n () => {\n effects.forEach(this.handleEffect);\n },\n );\n };\n\n private handleEffect = (effect: CustomComboBoxEffect<T>) => {\n effect(this.dispatch, this.getState, this.getProps, () => this);\n };\n\n private getProps = () => this.props;\n\n private getState = () => this.state;\n\n private handleValueChange = (value: T) => {\n this.dispatch({\n type: 'ValueChange',\n value,\n keepFocus: !this.isMobileLayout,\n });\n };\n\n private handleFocus = () => {\n if (this.focused) {\n return;\n }\n this.focused = true;\n this.dispatch({ type: 'Focus' });\n };\n\n private handleClickOutside = (e: Event) => {\n fixClickFocusIE(e);\n this.handleBlur();\n };\n\n private handleBlur = () => {\n if (!this.focused) {\n if (this.state.opened) {\n this.close();\n }\n return;\n }\n\n this.focused = false;\n // workaround for the similar bug with focusout\n // in Firefox, Chrome and IE\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1363964\n setTimeout(() => {\n this.dispatch({ type: 'Blur' });\n });\n };\n\n private handleInputBlur = () => {\n // If menu opened, RenderLayer is active and\n // it would call handleFocusOutside\n // In that way handleBlur would be called\n\n // TODO: add check for mobile layout, to call `handleBlur`\n\n if (this.state.opened) {\n return;\n }\n this.handleBlur();\n };\n\n private handleInputClick = () => {\n if (!this.cancelationToken) {\n this.dispatch({ type: 'InputClick' });\n }\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["CustomComboBox.tsx"],"names":["DELAY_BEFORE_SHOW_LOADER","LOADER_SHOW_TIME","DefaultState","inputChanged","editing","items","loading","opened","focused","textValue","repeatRequest","undefined","requestStatus","ComboBoxRequestStatus","Unknown","CustomComboBoxDataTids","comboBoxView","CustomComboBox","responsiveLayout","rootNode","state","requestId","cancelationToken","reducer","cancelLoaderDelay","focus","props","disabled","input","inputLikeText","selectInputText","selectAll","blur","handleBlur","dispatch","action","effects","nextState","ReactDOM","flushSync","setState","stateAndEffect","Array","forEach","handleEffect","effect","getState","getProps","handleValueChange","value","type","keepFocus","isMobileLayout","handleFocus","handleClickOutside","e","close","setTimeout","handleInputBlur","handleInputClick","search","query","getItems","cancelPromise","Promise","_","reject","expectingId","loaderShowDelay","resolve","cancelLoader","catch","race","code","cancelSearch","CancelationError","open","render","viewProps","align","borderless","disablePortal","error","menuAlign","drawArrow","menuPos","placeholder","size","totalCount","warning","width","maxLength","maxMenuHeight","leftIcon","rightIcon","inputMode","onValueChange","onClickOutside","onFocus","onFocusOutside","onInputBlur","onInputValueChange","onInputFocus","onInputClick","onInputKeyDown","event","persist","onMouseEnter","onMouseOver","onMouseLeave","renderItem","renderNotFound","itemWrapper","renderValue","renderTotalCount","renderAddButton","refInput","refMenu","menu","refInputLikeText","setRootNode","componentDidMount","autoFocus","componentDidUpdate","prevProps","prevState","reset","React","PureComponent","__KONTUR_REACT_UI__"],"mappings":"quBAAA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA,8C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DO,IAAMA,wBAAwB,GAAG,GAAjC,C;AACA,IAAMC,gBAAgB,GAAG,IAAzB,C;;AAEA,IAAMC,YAAY,GAAG;AAC1BC,EAAAA,YAAY,EAAE,KADY;AAE1BC,EAAAA,OAAO,EAA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AATA,SAArB,EAAgCC,SAAS,EAATA,SAAhC,EAAd,EACD,C,CAED;AACF;AACA,K,QACSC,K,GAAP,iBAAe,CACb,KAAK5F,QAAL,CAAc,EAAEgB,IAAI,EAAE,OAAR,EAAd,EACD,C,yBArOoC6E,eAAMC,a,WAC7BC,mB,GAAsB,gB","sourcesContent":["import React, { AriaAttributes } from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { Nullable } from '../../typings/utility-types';\nimport { Input, InputIconType } from '../../components/Input';\nimport { Menu } from '../Menu';\nimport { InputLikeText } from '../InputLikeText';\nimport { MenuItemState } from '../../components/MenuItem';\nimport { CancelationError, taskWithDelay } from '../../lib/utils';\nimport { fixClickFocusIE } from '../../lib/events/fixClickFocusIE';\nimport { CommonProps, CommonWrapper } from '../../internal/CommonWrapper';\nimport { responsiveLayout } from '../../components/ResponsiveLayout/decorator';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { DropdownContainerProps } from '../DropdownContainer';\n\nimport { ComboBoxRequestStatus } from './CustomComboBoxTypes';\nimport { CustomComboBoxAction, CustomComboBoxEffect, reducer } from './CustomComboBoxReducer';\nimport { ComboBoxView } from './ComboBoxView';\n\nexport interface CustomComboBoxProps<T> extends Pick<DropdownContainerProps, 'menuPos'>, CommonProps {\n align?: 'left' | 'center' | 'right';\n autoFocus?: boolean;\n borderless?: boolean;\n disablePortal?: boolean;\n disabled?: boolean;\n /**\n * Cостояние валидации при ошибке.\n */\n error?: boolean;\n maxLength?: number;\n menuAlign?: 'left' | 'right';\n drawArrow?: boolean;\n leftIcon?: InputIconType;\n rightIcon?: InputIconType;\n searchOnFocus?: boolean;\n onValueChange?: (value: T) => void;\n onInputValueChange?: (value: string) => Nullable<string> | void;\n onUnexpectedInput?: (value: string) => void | null | T;\n onFocus?: () => void;\n onBlur?: () => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseOver?: (e: React.MouseEvent) => void;\n onMouseLeave?: (e: React.MouseEvent) => void;\n onInputKeyDown?: (e: React.KeyboardEvent<HTMLElement>) => void;\n placeholder?: string;\n size?: 'small' | 'medium' | 'large';\n totalCount?: number;\n value?: Nullable<T>;\n /**\n * Cостояние валидации при предупреждении.\n */\n warning?: boolean;\n 'aria-describedby'?: AriaAttributes['aria-describedby'];\n width?: string | number;\n maxMenuHeight?: number | string;\n renderNotFound?: () => React.ReactNode;\n renderTotalCount?: (found: number, total: number) => React.ReactNode;\n renderItem: (item: T, state?: MenuItemState) => React.ReactNode;\n itemWrapper?: (item?: T) => React.ComponentType<unknown>;\n renderValue: (value: T) => React.ReactNode;\n renderAddButton?: (query?: string) => React.ReactNode;\n valueToString: (value: T) => string;\n itemToValue: (item: T) => string | number;\n getItems: (query: string) => Promise<T[]>;\n inputMode?: React.HTMLAttributes<HTMLInputElement>['inputMode'];\n}\n\nexport interface CustomComboBoxState<T> {\n editing: boolean;\n loading: boolean;\n opened: boolean;\n textValue: string;\n items: Nullable<T[]>;\n inputChanged: boolean;\n focused: boolean;\n repeatRequest: () => void;\n requestStatus: ComboBoxRequestStatus;\n}\n\nexport const DELAY_BEFORE_SHOW_LOADER = 300;\nexport const LOADER_SHOW_TIME = 1000;\n\nexport const DefaultState = {\n inputChanged: false,\n editing: false,\n items: null,\n loading: false,\n opened: false,\n focused: false,\n textValue: '',\n repeatRequest: () => undefined,\n requestStatus: ComboBoxRequestStatus.Unknown,\n};\n\nexport const CustomComboBoxDataTids = {\n comboBoxView: 'ComboBoxView__root',\n} as const;\n\n@responsiveLayout\n@rootNode\nexport class CustomComboBox<T> extends React.PureComponent<CustomComboBoxProps<T>, CustomComboBoxState<T>> {\n public static __KONTUR_REACT_UI__ = 'CustomComboBox';\n\n public state: CustomComboBoxState<T> = DefaultState;\n public input: Nullable<Input>;\n public menu: Nullable<Menu>;\n public inputLikeText: Nullable<InputLikeText>;\n public requestId = 0;\n public loaderShowDelay: Nullable<Promise<void>>;\n private focused = false;\n private cancelationToken: Nullable<(reason?: Error) => void> = null;\n private isMobileLayout!: boolean;\n\n private reducer = reducer;\n public cancelLoaderDelay: () => void = () => null;\n\n /**\n * @public\n */\n public focus = () => {\n if (this.props.disabled) {\n return;\n }\n\n if (this.input) {\n this.input.focus();\n } else if (this.inputLikeText) {\n this.inputLikeText.focus();\n }\n };\n\n /**\n * @public\n */\n public selectInputText = () => {\n if (this.props.disabled) {\n return;\n }\n if (this.input) {\n this.input.selectAll();\n }\n };\n\n /**\n * @public\n */\n public blur = () => {\n if (this.props.disabled) {\n return;\n }\n\n this.handleBlur();\n };\n private setRootNode!: TSetRootNode;\n\n /**\n * @public\n */\n public async search(query: string = this.state.textValue) {\n const { getItems } = this.props;\n\n const cancelPromise: Promise<never> = new Promise((_, reject) => (this.cancelationToken = reject));\n this.requestId += 1;\n const expectingId = this.requestId;\n\n if (!this.loaderShowDelay) {\n this.loaderShowDelay = new Promise<void>((resolve) => {\n const cancelLoader = taskWithDelay(() => {\n this.dispatch({ type: 'RequestItems' });\n setTimeout(resolve, LOADER_SHOW_TIME);\n }, DELAY_BEFORE_SHOW_LOADER);\n\n cancelPromise.catch(() => cancelLoader());\n\n this.cancelLoaderDelay = () => {\n cancelLoader();\n resolve();\n };\n });\n }\n\n try {\n const items = await Promise.race([getItems(query), cancelPromise]);\n if (this.state.loading) {\n await Promise.race([this.loaderShowDelay, cancelPromise]);\n }\n if (expectingId === this.requestId) {\n this.dispatch({\n type: 'ReceiveItems',\n items,\n });\n }\n } catch (error) {\n if (error && error.code === 'CancelationError') {\n this.dispatch({ type: 'CancelRequest' });\n } else if (expectingId === this.requestId) {\n this.dispatch({\n type: 'RequestFailure',\n repeatRequest: () => {\n this.search(query);\n if (this.input) {\n this.input.focus();\n }\n },\n });\n }\n } finally {\n if (expectingId === this.requestId) {\n if (!this.state.loading) {\n this.cancelLoaderDelay();\n }\n this.cancelationToken = null;\n this.loaderShowDelay = null;\n }\n }\n }\n\n /**\n * @public\n */\n public cancelSearch() {\n if (this.cancelationToken) {\n this.cancelationToken(new CancelationError());\n }\n }\n\n /**\n * @public\n */\n public open() {\n this.dispatch({ type: 'Open' });\n }\n\n /**\n * @public\n */\n public close() {\n this.dispatch({ type: 'Close' });\n }\n\n public render() {\n const viewProps = {\n align: this.props.align,\n borderless: this.props.borderless,\n disabled: this.props.disabled,\n disablePortal: this.props.disablePortal,\n editing: this.state.editing,\n error: this.props.error,\n items: this.state.items,\n loading: this.state.loading,\n menuAlign: this.props.menuAlign,\n opened: this.state.opened,\n drawArrow: this.props.drawArrow,\n menuPos: this.props.menuPos,\n placeholder: this.props.placeholder,\n size: this.props.size,\n textValue: this.state.textValue,\n totalCount: this.props.totalCount,\n value: this.props.value,\n warning: this.props.warning,\n 'aria-describedby': this.props['aria-describedby'],\n width: this.props.width,\n maxLength: this.props.maxLength,\n maxMenuHeight: this.props.maxMenuHeight,\n leftIcon: this.props.leftIcon,\n rightIcon: this.props.rightIcon,\n inputMode: this.props.inputMode,\n\n onValueChange: this.handleValueChange,\n onClickOutside: this.handleClickOutside,\n onFocus: this.handleFocus,\n onFocusOutside: this.handleBlur,\n onInputBlur: this.handleInputBlur,\n onInputValueChange: (value: string) => this.dispatch({ type: 'TextChange', value }),\n onInputFocus: this.handleFocus,\n onInputClick: this.handleInputClick,\n onInputKeyDown: (event: React.KeyboardEvent) => {\n event.persist();\n this.dispatch({ type: 'KeyPress', event });\n },\n onMouseEnter: this.props.onMouseEnter,\n onMouseOver: this.props.onMouseOver,\n onMouseLeave: this.props.onMouseLeave,\n renderItem: this.props.renderItem,\n renderNotFound: this.props.renderNotFound,\n itemWrapper: this.props.itemWrapper,\n renderValue: this.props.renderValue,\n renderTotalCount: this.props.renderTotalCount,\n renderAddButton: this.props.renderAddButton,\n repeatRequest: this.state.repeatRequest,\n requestStatus: this.state.requestStatus,\n\n refInput: (input: Nullable<Input>) => {\n this.input = input;\n },\n refMenu: (menu: Nullable<Menu>) => {\n this.menu = menu;\n },\n refInputLikeText: (inputLikeText: Nullable<InputLikeText>) => {\n this.inputLikeText = inputLikeText;\n },\n };\n\n return (\n <CommonWrapper {...this.props}>\n <ComboBoxView {...viewProps} ref={this.setRootNode} />\n </CommonWrapper>\n );\n }\n\n public componentDidMount() {\n this.dispatch({ type: 'Mount' });\n if (this.props.autoFocus) {\n this.focus();\n }\n }\n\n public componentDidUpdate(prevProps: CustomComboBoxProps<T>, prevState: CustomComboBoxState<T>) {\n if (prevState.editing && !this.state.editing) {\n this.handleBlur();\n }\n this.dispatch({ type: 'DidUpdate', prevProps, prevState });\n }\n\n /**\n * @public\n */\n public reset() {\n this.dispatch({ type: 'Reset' });\n }\n\n private dispatch = (action: CustomComboBoxAction<T>) => {\n let effects: Array<CustomComboBoxEffect<T>>;\n let nextState: Pick<CustomComboBoxState<T>, never>;\n\n ReactDOM.flushSync(() => {\n this.setState(\n (state) => {\n const stateAndEffect = this.reducer(state, this.props, action);\n\n [nextState, effects] = stateAndEffect instanceof Array ? stateAndEffect : [stateAndEffect, []];\n\n return nextState;\n },\n () => {\n effects.forEach(this.handleEffect);\n },\n );\n });\n };\n\n private handleEffect = (effect: CustomComboBoxEffect<T>) => {\n effect(this.dispatch, this.getState, this.getProps, () => this);\n };\n\n private getProps = () => this.props;\n\n private getState = () => this.state;\n\n private handleValueChange = (value: T) => {\n this.dispatch({\n type: 'ValueChange',\n value,\n keepFocus: !this.isMobileLayout,\n });\n };\n\n private handleFocus = () => {\n if (this.focused) {\n return;\n }\n this.focused = true;\n this.dispatch({ type: 'Focus' });\n };\n\n private handleClickOutside = (e: Event) => {\n fixClickFocusIE(e);\n this.handleBlur();\n };\n\n private handleBlur = () => {\n if (!this.focused) {\n if (this.state.opened) {\n this.close();\n }\n return;\n }\n\n this.focused = false;\n // workaround for the similar bug with focusout\n // in Firefox, Chrome and IE\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1363964\n setTimeout(() => {\n this.dispatch({ type: 'Blur' });\n });\n };\n\n private handleInputBlur = () => {\n // If menu opened, RenderLayer is active and\n // it would call handleFocusOutside\n // In that way handleBlur would be called\n\n // TODO: add check for mobile layout, to call `handleBlur`\n\n if (this.state.opened) {\n return;\n }\n this.handleBlur();\n };\n\n private handleInputClick = () => {\n if (!this.cancelationToken) {\n this.dispatch({ type: 'InputClick' });\n }\n };\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.InputLikeTextDataTids = exports.InputLikeText = void 0;var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
2
2
|
|
|
3
3
|
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
4
5
|
|
|
5
6
|
var _utils = require("../../lib/utils");
|
|
6
7
|
var _identifiers = require("../../lib/events/keyboard/identifiers");
|
|
@@ -434,7 +435,9 @@ InputLikeText = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*
|
|
|
434
435
|
}
|
|
435
436
|
}
|
|
436
437
|
|
|
437
|
-
|
|
438
|
+
_reactDom.default.flushSync(function () {
|
|
439
|
+
_this.setState({ focused: true });
|
|
440
|
+
});
|
|
438
441
|
|
|
439
442
|
if (_this.props.onFocus) {
|
|
440
443
|
_this.props.onFocus(e);
|