From 8696f40c03eae21608d9810bc04ee1a872b0a284 Mon Sep 17 00:00:00 2001 From: Egor Pogadaev Date: Mon, 25 Mar 2019 16:55:41 +0500 Subject: [PATCH 01/29] fix(Input): fix placeholder width for masked input #1272 --- .../retail-ui/components/internal/MaskedInput/MaskedInput.less | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/retail-ui/components/internal/MaskedInput/MaskedInput.less b/packages/retail-ui/components/internal/MaskedInput/MaskedInput.less index e1e03a074a1..2faec27813c 100644 --- a/packages/retail-ui/components/internal/MaskedInput/MaskedInput.less +++ b/packages/retail-ui/components/internal/MaskedInput/MaskedInput.less @@ -13,6 +13,7 @@ /* stylelint-disable-next-line font-family-no-missing-generic-family-keyword */ font-family: kontur-mask-char, Segoe UI, Helevetica Neue; /* IE use Times New Roman as default font */ font-size: inherit; + flex: 100% 1 1; } .inputMask { From d8b73982df1f9883bcd79ac36597a05f65c45560 Mon Sep 17 00:00:00 2001 From: Egor Pogadaev Date: Mon, 25 Mar 2019 16:56:40 +0500 Subject: [PATCH 02/29] test(Input): test input with mask, placeholder and width --- .../Input/__stories__/Input.stories.tsx | 107 +++++++++++++++--- 1 file changed, 89 insertions(+), 18 deletions(-) diff --git a/packages/retail-ui/components/Input/__stories__/Input.stories.tsx b/packages/retail-ui/components/Input/__stories__/Input.stories.tsx index 90cc892ad82..1264184f374 100644 --- a/packages/retail-ui/components/Input/__stories__/Input.stories.tsx +++ b/packages/retail-ui/components/Input/__stories__/Input.stories.tsx @@ -123,24 +123,95 @@ storiesOf('Input', module) )) - .add('Input with mask', () => ( - -

- Mask: +7 999 999-99-99{' '} - -

-

- Mask: 99aa9999{' '} - -

-
+ .add('Placeholder and Mask', () => ( +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ width: "auto"width: 100pxwidth: 350px
placeholder + + + + + +
mask + + + + + +
placeholder and mask + + + + + +
+ + + + + + + + + + +
+ focusedblured
placeholder and mask + + + +
+
)) .add('Input with phone mask', () => ( From 1c40f1dd7651e32fc57b179fdf9e430752d49d05 Mon Sep 17 00:00:00 2001 From: Egor Pogadaev Date: Tue, 26 Mar 2019 08:39:57 +0500 Subject: [PATCH 03/29] fix(Input): don't show placeholder if mask is visible --- packages/retail-ui/components/Input/Input.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/retail-ui/components/Input/Input.tsx b/packages/retail-ui/components/Input/Input.tsx index 0e60f35139e..5c8667657b3 100644 --- a/packages/retail-ui/components/Input/Input.tsx +++ b/packages/retail-ui/components/Input/Input.tsx @@ -193,6 +193,12 @@ class Input extends React.Component { this.input.setSelectionRange(start, end); } + public get isMaskVisible(): boolean { + const { mask, alwaysShowMask } = this.props; + const { focused } = this.state; + return Boolean(mask && (focused || alwaysShowMask)); + } + public render(): JSX.Element { const { onMouseEnter, @@ -255,7 +261,7 @@ class Input extends React.Component { style: { textAlign: align }, ref: this.refInput, type: 'text', - placeholder: !polyfillPlaceholder ? placeholder : undefined, + placeholder: !this.isMaskVisible && !polyfillPlaceholder ? placeholder : undefined, disabled, }; @@ -333,7 +339,7 @@ class Input extends React.Component { private renderPlaceholder() { let placeholder = null; - if (this.state.polyfillPlaceholder && this.props.placeholder && !this.props.alwaysShowMask && !this.props.value) { + if (this.state.polyfillPlaceholder && this.props.placeholder && !this.isMaskVisible && !this.props.value) { placeholder = (
{this.props.placeholder} From dadb9f81b9e04b85fe2d23458a29aaaa2e1bb87d Mon Sep 17 00:00:00 2001 From: Egor Pogadaev Date: Tue, 26 Mar 2019 08:53:12 +0500 Subject: [PATCH 04/29] test(Input): add screenshots for Input with placeholder and mask --- packages/react-ui-screenshot-tests/gemini/input.js | 7 +++++++ .../Input with placeholder and mask/Plain/chrome.png | 3 +++ .../Input with placeholder and mask/Plain/firefox.png | 3 +++ .../screens/Input with placeholder and mask/Plain/ie11.png | 3 +++ 4 files changed, 16 insertions(+) create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Input with placeholder and mask/Plain/chrome.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Input with placeholder and mask/Plain/firefox.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Input with placeholder and mask/Plain/ie11.png diff --git a/packages/react-ui-screenshot-tests/gemini/input.js b/packages/react-ui-screenshot-tests/gemini/input.js index bbcac25206b..b46f66c120e 100644 --- a/packages/react-ui-screenshot-tests/gemini/input.js +++ b/packages/react-ui-screenshot-tests/gemini/input.js @@ -124,6 +124,13 @@ gemini.suite('Input with mask', suite => { }); }); +gemini.suite('Input with placeholder and mask', suite => { + suite + .before(renderStory('Input', 'Placeholder and Mask')) + .setCaptureElements('#test-element') + .capture('Plain'); +}); + gemini.suite('Input with prefix and suffix', () => { gemini.suite('Size small', suite => { suite diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Input with placeholder and mask/Plain/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Input with placeholder and mask/Plain/chrome.png new file mode 100644 index 00000000000..7608d8635e6 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Input with placeholder and mask/Plain/chrome.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c61358508f92bbfa410ee38cf7056602d23575d20e7d0d2f1d948a9225f38bf8 +size 13316 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Input with placeholder and mask/Plain/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Input with placeholder and mask/Plain/firefox.png new file mode 100644 index 00000000000..dedb7fefe4a --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Input with placeholder and mask/Plain/firefox.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04f62819c0d3ef3a6cdeb0ca34443211b68edf9d955207d0e070ff0b519c757c +size 9276 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Input with placeholder and mask/Plain/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Input with placeholder and mask/Plain/ie11.png new file mode 100644 index 00000000000..db22bb3d285 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Input with placeholder and mask/Plain/ie11.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60c9f9287a50a1445ba00ca60fa957d115f37dff8f1bc8bad0be065d9d96ece9 +size 13959 From a006fdf0e0e65d5fde07134c6909870666e7947f Mon Sep 17 00:00:00 2001 From: Egor Pogadaev Date: Mon, 25 Mar 2019 16:34:40 +0500 Subject: [PATCH 05/29] test(DropdownContainer): fix flaky screenshot test --- .../gemini/dropdownContainer.js | 27 +++---------------- .../long Items/inner scroll/shot/chrome.png | 4 +-- .../long Items/inner scroll/shot/firefox.png | 4 +-- .../long Items/inner scroll/shot/ie11.png | 3 +++ .../long Items/items/shot/chrome.png | 4 +-- .../long Items/items/shot/firefox.png | 4 +-- .../long Items/items/shot/ie11.png | 4 +-- .../long Items/page scroll/shot/chrome.png | 3 --- .../long Items/page scroll/shot/firefox.png | 3 --- .../long Items/page scroll/shot/ie11.png | 3 --- .../short Items/inner scroll/shot/chrome.png | 4 +-- .../short Items/inner scroll/shot/firefox.png | 4 +-- .../short Items/inner scroll/shot/ie11.png | 3 +++ .../short Items/items/shot/chrome.png | 4 +-- .../short Items/items/shot/firefox.png | 4 +-- .../short Items/items/shot/ie11.png | 4 +-- .../short Items/page scroll/shot/chrome.png | 3 --- .../short Items/page scroll/shot/firefox.png | 3 --- .../short Items/page scroll/shot/ie11.png | 3 --- .../__stories__/DropdownContainer.stories.tsx | 12 ++++----- 20 files changed, 36 insertions(+), 67 deletions(-) create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/inner scroll/shot/ie11.png delete mode 100644 packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/page scroll/shot/chrome.png delete mode 100644 packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/page scroll/shot/firefox.png delete mode 100644 packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/page scroll/shot/ie11.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/inner scroll/shot/ie11.png delete mode 100644 packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/page scroll/shot/chrome.png delete mode 100644 packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/page scroll/shot/firefox.png delete mode 100644 packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/page scroll/shot/ie11.png diff --git a/packages/react-ui-screenshot-tests/gemini/dropdownContainer.js b/packages/react-ui-screenshot-tests/gemini/dropdownContainer.js index 6a7fdb90824..8a987e8a87b 100644 --- a/packages/react-ui-screenshot-tests/gemini/dropdownContainer.js +++ b/packages/react-ui-screenshot-tests/gemini/dropdownContainer.js @@ -15,36 +15,21 @@ var initTest = (suite, showLongItems) => } }); -var pageScrollTest = suite => +var innerScrollTest = suite => suite.capture('shot', actions => { actions.executeJS(function(window) { - var doc = window.document.documentElement; - doc.scrollTop = doc.scrollHeight - doc.offsetHeight; - doc.scrollLeft = doc.scrollWidth - doc.offsetWidth; + var innerScroll = window.document.querySelector('#inner-scroll'); + innerScroll.scrollTop = innerScroll.scrollHeight; + innerScroll.scrollLeft = innerScroll.scrollWidth; }); }); -var innerScrollTest = suite => - suite - .capture('shot', actions => { - actions.executeJS(function(window) { - var innerScroll = window.document.querySelector('#inner-scroll'); - innerScroll.scrollTop = innerScroll.scrollHeight - innerScroll.offsetHeight; - innerScroll.scrollLeft = innerScroll.scrollWidth - innerScroll.offsetWidth; - }); - }) - .skip.in('ie11', 'ie иногда не до конца скролит элемент (разница в пару px)'); - gemini.suite('DropdownContainer', () => { gemini.suite('short Items', () => { gemini.suite('items', suite => { initTest(suite).capture('shot'); }); - gemini.suite('page scroll', suite => { - pageScrollTest(initTest(suite)); - }); - gemini.suite('inner scroll', suite => { innerScrollTest(initTest(suite)); }); @@ -55,10 +40,6 @@ gemini.suite('DropdownContainer', () => { initTest(suite, true).capture('shot'); }); - gemini.suite('page scroll', suite => { - pageScrollTest(initTest(suite, true)); - }); - gemini.suite('inner scroll', suite => { innerScrollTest(initTest(suite, true)); }); diff --git a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/inner scroll/shot/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/inner scroll/shot/chrome.png index 8f788319fe0..79713513b8e 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/inner scroll/shot/chrome.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/inner scroll/shot/chrome.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ed052458b408d1bc630bdd025af0d956d04f1fdcdb3101868cc66b47a026e233 -size 81949 +oid sha256:efd7baadacbf75c18ca5f1a0c7fcdd2d938f4c6d37a80475ede954b325187f61 +size 107641 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/inner scroll/shot/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/inner scroll/shot/firefox.png index 53a7a0d465e..741f922fa37 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/inner scroll/shot/firefox.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/inner scroll/shot/firefox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:64876c491ec235bf9375c5c00a399ba3875f603508c043b4e41cb23634d74b3f -size 44648 +oid sha256:b345b3b4cc44e28b197dc4eb5b2d4b7619a735ca68942535220c2c6b1a37ab78 +size 60345 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/inner scroll/shot/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/inner scroll/shot/ie11.png new file mode 100644 index 00000000000..ba3e377b0a7 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/inner scroll/shot/ie11.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:95f3ba159003220e03fb7636ef3f6589773d5c55e88caefed4e5cd2bf0b4bd58 +size 100442 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/items/shot/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/items/shot/chrome.png index faeba7930da..f4af8a826d6 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/items/shot/chrome.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/items/shot/chrome.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ce6afe0de560e30cfca52a2335585694f53e770523d39ba0141ef085d72a8d00 -size 64424 +oid sha256:ce3e78e69a6a57155dd7a81e62f4769726e568cabab3a27bb88780bd16f775dd +size 99619 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/items/shot/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/items/shot/firefox.png index 812e2ec351e..9cac67e1bb4 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/items/shot/firefox.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/items/shot/firefox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bb985aafd49579adebde368c1b6eedf749f5a1e33d8d08c1788e531925bae161 -size 38110 +oid sha256:abe6db8256c50f8a9f391e8d23ab3a8b5fea540609f1673d9c1046629fcb23f1 +size 58194 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/items/shot/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/items/shot/ie11.png index e52fa7ce7de..0dfbbe4d657 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/items/shot/ie11.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/items/shot/ie11.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:311d885dce753595536cf02d414855d077ce87829c98536f11db671b2ad9905a -size 37440 +oid sha256:db086b2376470092994c21c924fe559c780a326e238e0be193bdd92ffe2c89aa +size 92160 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/page scroll/shot/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/page scroll/shot/chrome.png deleted file mode 100644 index 8a5d44416a6..00000000000 --- a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/page scroll/shot/chrome.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:566379092c94b73684c1e0824a42c7e8559387799ba5250b31d2f5e7ba473a72 -size 63203 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/page scroll/shot/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/page scroll/shot/firefox.png deleted file mode 100644 index c496b091bfa..00000000000 --- a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/page scroll/shot/firefox.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e59593fea0ca064efb27be16b2ecc88a8955e4469663cb3214ceb6be1941398f -size 38201 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/page scroll/shot/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/page scroll/shot/ie11.png deleted file mode 100644 index e52fa7ce7de..00000000000 --- a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/long Items/page scroll/shot/ie11.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:311d885dce753595536cf02d414855d077ce87829c98536f11db671b2ad9905a -size 37440 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/inner scroll/shot/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/inner scroll/shot/chrome.png index d4d22419e45..6722a8d64e5 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/inner scroll/shot/chrome.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/inner scroll/shot/chrome.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1c2fd21edee57acbcc7e038721782b86ff771d43e9bc5d852de66da4011e777f -size 56456 +oid sha256:0a691478f9b5b9a7c961eae156fabd06a2859d344e175d9941eaf8d81a93a628 +size 61392 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/inner scroll/shot/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/inner scroll/shot/firefox.png index d12782c18e8..81f6faea98d 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/inner scroll/shot/firefox.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/inner scroll/shot/firefox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:699a1a3c91d1544fda3fdf08dc218449a8ca4e5a1e48c5a63ce23291602c1893 -size 37637 +oid sha256:f958801faed51dc7a5d03d1f053c51fbb2168213b650141cd56e9b06916223cb +size 49255 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/inner scroll/shot/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/inner scroll/shot/ie11.png new file mode 100644 index 00000000000..ed8d30c2c6f --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/inner scroll/shot/ie11.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3863ef1fe6a8ea22c67de5d847e6596ba44668d60f6aa788968cec405eb75db +size 57680 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/items/shot/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/items/shot/chrome.png index 26c32880e25..d393a24a675 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/items/shot/chrome.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/items/shot/chrome.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a7e6088a13d7bc6d394788117dcf0083fb15e3c5bbdb92ea157076b495d90190 -size 46758 +oid sha256:a33ceb88931a057075307a7900b42ac24b8db026a14a6ddb04cbfbb6e5dde86c +size 61169 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/items/shot/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/items/shot/firefox.png index f70e84458d1..a43aafa8993 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/items/shot/firefox.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/items/shot/firefox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d996da3f05eb89aa686fc0535bc1bff395c17e1e21bf8e4dfc2350d458044ba7 -size 29953 +oid sha256:b6b97748b80ad25df1c75eb3cbdb3c022fb958fd99ec5f27068c59aca97ba16e +size 39791 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/items/shot/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/items/shot/ie11.png index e604379bf4c..2c0bb10ca7d 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/items/shot/ie11.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/items/shot/ie11.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c32890b7976333bbd8973250ab90164f43c311d30ff5549a3dd567763b1559d0 -size 29823 +oid sha256:b16b02fda29407439e0cf834593f9559915c8946b050fa205f81efde01a09f13 +size 53583 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/page scroll/shot/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/page scroll/shot/chrome.png deleted file mode 100644 index 416dcd29688..00000000000 --- a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/page scroll/shot/chrome.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fd0fd1ef0d52ad5ed595c8b90b81b3d59d47ab7071597ba45bd708130cc892ca -size 46651 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/page scroll/shot/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/page scroll/shot/firefox.png deleted file mode 100644 index 8a32ab805ce..00000000000 --- a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/page scroll/shot/firefox.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:31483c6fa1bf3ba162c6828212493dbd599205eeaa4b9c350634b6ba3b051ca1 -size 30457 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/page scroll/shot/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/page scroll/shot/ie11.png deleted file mode 100644 index cc812bfcd9e..00000000000 --- a/packages/react-ui-screenshot-tests/gemini/screens/DropdownContainer/short Items/page scroll/shot/ie11.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7304c7d9dae7c0a28fd200222a591d2e9063f92e3719b53ed3c45a7e6cf19711 -size 29805 diff --git a/packages/retail-ui/components/DropdownContainer/__stories__/DropdownContainer.stories.tsx b/packages/retail-ui/components/DropdownContainer/__stories__/DropdownContainer.stories.tsx index 2173d43f705..1c0cbd7dffa 100644 --- a/packages/retail-ui/components/DropdownContainer/__stories__/DropdownContainer.stories.tsx +++ b/packages/retail-ui/components/DropdownContainer/__stories__/DropdownContainer.stories.tsx @@ -17,8 +17,6 @@ class VariousAlignsPortalsItemsAndScrolls extends React.Component { public portals = [false, true]; public rows = ['top', 'middle', 'bottom']; public cols = ['left', 'center', 'right']; - public LONG_ITEM = 'LongItemLongItemLongItemLongItemLong LongItem LongItemLongItemLongItemLongItemLongItemLongItem'; - public SHORT_ITEM = 'ShortShortShort Short'; public dropdowns: { [id: string]: DropdownWithToggle | null; } = {}; @@ -59,14 +57,14 @@ class VariousAlignsPortalsItemsAndScrolls extends React.Component { public render() { return ( - +
{ - const { rows, cols, aligns, portals, LONG_ITEM, SHORT_ITEM } = this; + const { rows, cols, aligns, portals } = this; const { long, shown } = this.state; return ( @@ -110,7 +108,9 @@ class VariousAlignsPortalsItemsAndScrolls extends React.Component { dropdownProps={{ align, disablePortal }} > - {long ? LONG_ITEM : SHORT_ITEM} + + {`${row}/${col}/align-${align}/portal-${!disablePortal}; `.repeat(long ? 3 : 1)} +   From dd58f7498ce1f739c22650450e03b29d912126f0 Mon Sep 17 00:00:00 2001 From: Egor Pogadaev Date: Mon, 25 Mar 2019 18:33:18 +0500 Subject: [PATCH 06/29] test(Tooltip): fix flaky screenshots ignore blinking buttons --- .../01 - plain/chrome.png | 4 ++-- .../01 - plain/firefox.png | 4 ++-- .../Tooltip with external dynamic content/01 - plain/ie11.png | 4 ++-- .../02 - changes top position if does not fit/chrome.png | 4 ++-- .../02 - changes top position if does not fit/firefox.png | 4 ++-- .../02 - changes top position if does not fit/ie11.png | 4 ++-- .../03 - does not change position back on shrink/chrome.png | 4 ++-- .../03 - does not change position back on shrink/firefox.png | 4 ++-- .../03 - does not change position back on shrink/ie11.png | 4 ++-- .../04 - does not change top position if fits/chrome.png | 4 ++-- .../04 - does not change top position if fits/firefox.png | 4 ++-- .../04 - does not change top position if fits/ie11.png | 4 ++-- .../05 - does not change position on shrink/chrome.png | 4 ++-- .../05 - does not change position on shrink/firefox.png | 4 ++-- .../05 - does not change position on shrink/ie11.png | 4 ++-- .../06 - changes left position if does not fit/chrome.png | 4 ++-- .../06 - changes left position if does not fit/firefox.png | 4 ++-- .../06 - changes left position if does not fit/ie11.png | 4 ++-- .../07 - does not change position back on shrink/chrome.png | 4 ++-- .../07 - does not change position back on shrink/firefox.png | 4 ++-- .../07 - does not change position back on shrink/ie11.png | 4 ++-- .../08 - does not change bottom position if fits/chrome.png | 4 ++-- .../08 - does not change bottom position if fits/firefox.png | 4 ++-- .../08 - does not change bottom position if fits/ie11.png | 4 ++-- .../09 - does not change position on shrink/chrome.png | 4 ++-- .../09 - does not change position on shrink/firefox.png | 4 ++-- .../09 - does not change position on shrink/ie11.png | 4 ++-- .../chrome.png | 4 ++-- .../firefox.png | 4 ++-- .../ie11.png | 4 ++-- .../11 - does not change position on shrink/chrome.png | 4 ++-- .../11 - does not change position on shrink/firefox.png | 4 ++-- .../11 - does not change position on shrink/ie11.png | 4 ++-- packages/react-ui-screenshot-tests/gemini/tooltip.js | 1 + 34 files changed, 67 insertions(+), 66 deletions(-) diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/01 - plain/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/01 - plain/chrome.png index 22c4b84e3e0..0384c951dc5 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/01 - plain/chrome.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/01 - plain/chrome.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ed3e00ac7faeeee2a22398921b63160f2d34bc2470ee1d5c20e68fe718d6f599 -size 21066 +oid sha256:fc7578d5a019b8b1aab5fdb135a708e20f25867bccf5c152c4057d6ed5c8b4a2 +size 14074 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/01 - plain/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/01 - plain/firefox.png index 5dc45f2dc27..9a8c0bf014f 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/01 - plain/firefox.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/01 - plain/firefox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:56ba1016d8f590084d905aba62c438688209d10052b626b46a5e1bddfdff317c -size 17098 +oid sha256:27b2b76107fd0c95456209c29d3a1599bc79742fd685569e163317893d933868 +size 11810 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/01 - plain/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/01 - plain/ie11.png index bb1e3be1b62..71f1a6dcbc2 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/01 - plain/ie11.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/01 - plain/ie11.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7a51a716eb937cd9c07e2e8ed2f784748056c790b84d070e6248c65ae8aae2ad -size 17562 +oid sha256:fc06fc09187464cb163fb109d8400b5907feb83efa7cd4f282181f0ea2c257ab +size 11196 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/02 - changes top position if does not fit/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/02 - changes top position if does not fit/chrome.png index 1f7ec5e05ac..3a0eb32be94 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/02 - changes top position if does not fit/chrome.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/02 - changes top position if does not fit/chrome.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:298a6b9dd1678e7dccb067b749d015bb62f15f2ce61a10e1420f2991024b71c1 -size 27092 +oid sha256:6df4987ea8f48bf1a29b577d7bc8ecb80ce515f518618fa957fa79bca6e76537 +size 20206 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/02 - changes top position if does not fit/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/02 - changes top position if does not fit/firefox.png index 8cb8669d346..4e9d3c2e27d 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/02 - changes top position if does not fit/firefox.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/02 - changes top position if does not fit/firefox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:17e8be95fd1eb2b7b6c425e1b47a11385d134349b8f720a3adc5ecf14052878f -size 21132 +oid sha256:1ec45086ef1ef0e42c8519353d10094b56b2d9741aeb0a51ada2c1682e6cbc8e +size 15526 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/02 - changes top position if does not fit/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/02 - changes top position if does not fit/ie11.png index 830ec66436f..63b5888213f 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/02 - changes top position if does not fit/ie11.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/02 - changes top position if does not fit/ie11.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d00ef8b003d0f42a0c5574923c226fa0d6c2770ec0dd03c01faf12e0639e0c8f -size 24167 +oid sha256:bd8a89489a43b2abd1d09d14561820cef723df3ae1499e4dd7779a3644cc6ff0 +size 18157 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/03 - does not change position back on shrink/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/03 - does not change position back on shrink/chrome.png index 05f7c101c4c..5f208571e5a 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/03 - does not change position back on shrink/chrome.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/03 - does not change position back on shrink/chrome.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9e10cab59df87d5936872827e0827111d3f570921c0dc496dd2ace417f7b87d5 -size 21197 +oid sha256:e4e21e9ddefec8cf506b55b4e95b297aa5e3cbed4920b590f3f96ad53b134ae8 +size 13994 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/03 - does not change position back on shrink/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/03 - does not change position back on shrink/firefox.png index c1a16872e83..369a9771850 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/03 - does not change position back on shrink/firefox.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/03 - does not change position back on shrink/firefox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:443a50725fa467fc76bfc449e60e5359a115fa1864f279c3c5f50de771180967 -size 17229 +oid sha256:6744225812f67ec4ba74d3e6db07055b7a36cc086e6914ef8414b091df9751b8 +size 11810 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/03 - does not change position back on shrink/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/03 - does not change position back on shrink/ie11.png index a20213f336c..bd572acbd32 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/03 - does not change position back on shrink/ie11.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/03 - does not change position back on shrink/ie11.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2f7d9e44908ee3b252750e6634a559bb0e48fee547bcb82e3c46fc531e1136f5 -size 17548 +oid sha256:5209410d9203e11f632b72b6e49bf43b6c1dc995a43bf67957a046e2a74ec4b6 +size 11132 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/04 - does not change top position if fits/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/04 - does not change top position if fits/chrome.png index 89ca3cedd94..7ae33cef28d 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/04 - does not change top position if fits/chrome.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/04 - does not change top position if fits/chrome.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e2bd58752feab5f6d2537230d5e7c4547f12058965d18bf249e023b5c39687f9 -size 24876 +oid sha256:ac6dc5d9f230c45092f3449aedb21c00b70957b2c1f0dcdebebfdc11528d953e +size 18985 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/04 - does not change top position if fits/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/04 - does not change top position if fits/firefox.png index 7ffa2b1f225..5ecde984514 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/04 - does not change top position if fits/firefox.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/04 - does not change top position if fits/firefox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7a0a6f62f8d160ce10d4f27c242a806b80cb09049df0cf0a2607b01e9b25566a -size 19056 +oid sha256:8d882c468e0f3ea3562a5c4001c521b90eced6467c45791ff6bf75b57b7ff344 +size 14418 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/04 - does not change top position if fits/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/04 - does not change top position if fits/ie11.png index 3d0dc6588e4..24d34e9c9bd 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/04 - does not change top position if fits/ie11.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/04 - does not change top position if fits/ie11.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4837c8d19a14cd11a781491b32b227061586814eda041e14f6d3215e5c858bb6 -size 22166 +oid sha256:e24ead9498f7d57e3147c3cc139fd36a6b780f2e346af5c73e5b5e1969a5d18f +size 16940 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/05 - does not change position on shrink/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/05 - does not change position on shrink/chrome.png index 54853c37e57..5f208571e5a 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/05 - does not change position on shrink/chrome.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/05 - does not change position on shrink/chrome.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1aa5a05968182f6502ca09c25cf08dc7d98b6d5eedf128b138e5d4f98f756fee -size 21212 +oid sha256:e4e21e9ddefec8cf506b55b4e95b297aa5e3cbed4920b590f3f96ad53b134ae8 +size 13994 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/05 - does not change position on shrink/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/05 - does not change position on shrink/firefox.png index 9f0b3b2914c..369a9771850 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/05 - does not change position on shrink/firefox.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/05 - does not change position on shrink/firefox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:faa926596bd0af9ebb4530d1f7167a1ee5cd7149557fafd36792db753116aa1f -size 17175 +oid sha256:6744225812f67ec4ba74d3e6db07055b7a36cc086e6914ef8414b091df9751b8 +size 11810 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/05 - does not change position on shrink/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/05 - does not change position on shrink/ie11.png index a8a61d4f0d4..bd572acbd32 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/05 - does not change position on shrink/ie11.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/05 - does not change position on shrink/ie11.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:92bfd056b7253cc56f8418c15a2f8e7acd3e183fa8328022d7e016565e7467e9 -size 17522 +oid sha256:5209410d9203e11f632b72b6e49bf43b6c1dc995a43bf67957a046e2a74ec4b6 +size 11132 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/06 - changes left position if does not fit/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/06 - changes left position if does not fit/chrome.png index 618c07eeec2..e36cded806c 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/06 - changes left position if does not fit/chrome.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/06 - changes left position if does not fit/chrome.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:46d4de51de71b5363bc3078fcf77992c10667623450889ce399011ef7f9aa632 -size 28329 +oid sha256:68d634e54af9b919072bf94f5096b9566562a31637d7d82eb0bed07a5c40f029 +size 21057 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/06 - changes left position if does not fit/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/06 - changes left position if does not fit/firefox.png index 21f93271697..d023b79590f 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/06 - changes left position if does not fit/firefox.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/06 - changes left position if does not fit/firefox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d7eeda405c4e1622294710c22246767cc445d376456b0ae60dfad2d37b50aff2 -size 21730 +oid sha256:5d8b2ffb436df32db017ef72beab514530e42dabeac28097c81db766cb15a8da +size 16162 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/06 - changes left position if does not fit/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/06 - changes left position if does not fit/ie11.png index b672c4a4fb1..912c7d16460 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/06 - changes left position if does not fit/ie11.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/06 - changes left position if does not fit/ie11.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1829bc1b204a273ca997fc958c3454ab3a2e023af6fcfd329bf959c22550b74d -size 24605 +oid sha256:0822e227619ba24d4fe3d6cebee7b8336f9a1b8522aa51bf7da9123a50650415 +size 18450 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/07 - does not change position back on shrink/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/07 - does not change position back on shrink/chrome.png index 06a2a7c0026..a9421d5a883 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/07 - does not change position back on shrink/chrome.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/07 - does not change position back on shrink/chrome.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b66657ab9f92e136c132986f48872196eb6c7a05c520945fdfc8d4cc4438d839 -size 21204 +oid sha256:d7f009a68397a8c6cbb52bfdbe945c523ae089a10f2bd63a9ec294e085f01d43 +size 13943 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/07 - does not change position back on shrink/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/07 - does not change position back on shrink/firefox.png index 0693e53d88c..acb1fe4f7e0 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/07 - does not change position back on shrink/firefox.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/07 - does not change position back on shrink/firefox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:82ca11e97f6c7b0f227a42512630253bdf4fb009abb04c188bcc821d8565db90 -size 17240 +oid sha256:f3d7722b815656d4eaf18835b5d463193de1c62c65981fca221f81fdb877e55a +size 11841 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/07 - does not change position back on shrink/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/07 - does not change position back on shrink/ie11.png index a73bccb0b34..7beb3b6ebc5 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/07 - does not change position back on shrink/ie11.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/07 - does not change position back on shrink/ie11.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6813f9137476d0beed33fbe05398805a69831a9891a6a2d78b11e7089e4f5989 -size 17459 +oid sha256:0fbcaceb63ea70401eb359509b4a4d21aa4ea1461e9260a763c364f9099478b3 +size 11048 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/08 - does not change bottom position if fits/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/08 - does not change bottom position if fits/chrome.png index 73c5dbdc543..8b50007afca 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/08 - does not change bottom position if fits/chrome.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/08 - does not change bottom position if fits/chrome.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:40de61b3e123bb8a36625f1311e2718da7827cc92b974a6b6a14582f10cc7412 -size 27081 +oid sha256:f2d544f8053fdac504a0a16cdc963d64975d6dce798f16b221f59ab93286a4a8 +size 21236 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/08 - does not change bottom position if fits/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/08 - does not change bottom position if fits/firefox.png index 60a1aef73b9..16ad32f264d 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/08 - does not change bottom position if fits/firefox.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/08 - does not change bottom position if fits/firefox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fe4d176c9e04a95fee023a89775aeb570351078c37b64e705209f7993f40a2d8 -size 20908 +oid sha256:f82ba37f14fb388bed11619d5ac77de1fb3be6fd479c0b51b335ec5793a178c8 +size 16449 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/08 - does not change bottom position if fits/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/08 - does not change bottom position if fits/ie11.png index bf92cc99563..01970e5da23 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/08 - does not change bottom position if fits/ie11.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/08 - does not change bottom position if fits/ie11.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:430b8f9fad5c55c77eb269085b8ef545a1fe3ee748dc520bbd6b9877578cef13 -size 23404 +oid sha256:df2c976605582c3909a9d64c85c191ef6030c58bc70993317704386365e42c58 +size 18335 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/09 - does not change position on shrink/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/09 - does not change position on shrink/chrome.png index efbae819d28..a9421d5a883 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/09 - does not change position on shrink/chrome.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/09 - does not change position on shrink/chrome.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6868401d95fe1303026bfb37e435925fdf7da41d30345653f86ca65722eff566 -size 21213 +oid sha256:d7f009a68397a8c6cbb52bfdbe945c523ae089a10f2bd63a9ec294e085f01d43 +size 13943 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/09 - does not change position on shrink/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/09 - does not change position on shrink/firefox.png index 1d220e908d9..acb1fe4f7e0 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/09 - does not change position on shrink/firefox.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/09 - does not change position on shrink/firefox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f546423664e40863c332a0ab74d1bd2aa4632d45f46aac57048516cf91156493 -size 17188 +oid sha256:f3d7722b815656d4eaf18835b5d463193de1c62c65981fca221f81fdb877e55a +size 11841 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/09 - does not change position on shrink/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/09 - does not change position on shrink/ie11.png index c4100fd0844..7beb3b6ebc5 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/09 - does not change position on shrink/ie11.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/09 - does not change position on shrink/ie11.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ee04d7567b1ce66f009c5117d2ca81a5375fb6a636524d7208f017778c0da555 -size 17442 +oid sha256:0fbcaceb63ea70401eb359509b4a4d21aa4ea1461e9260a763c364f9099478b3 +size 11048 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/10 - does not change bottom position if does not fit/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/10 - does not change bottom position if does not fit/chrome.png index 8bb5bb3f694..edceab45947 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/10 - does not change bottom position if does not fit/chrome.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/10 - does not change bottom position if does not fit/chrome.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8822b7268167d945e35d3c02d360527a4d7c24bb1702cbc3d9d63c23fa97c366 -size 27501 +oid sha256:ec850fd30dd9996d7a80788e29a4f36b55ee539a69e0f0d9f409de9e96d2d494 +size 20374 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/10 - does not change bottom position if does not fit/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/10 - does not change bottom position if does not fit/firefox.png index e916359b855..a294748050d 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/10 - does not change bottom position if does not fit/firefox.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/10 - does not change bottom position if does not fit/firefox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:895e7b8185a83c12f2dbe92d9ef8bb1b919475c22ebfea55ae4235d431ac2059 -size 20877 +oid sha256:88eb751ed947998e34b574fcae84a0e85b4ad89bea840f4bdd5399de1e3cb2e5 +size 15778 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/10 - does not change bottom position if does not fit/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/10 - does not change bottom position if does not fit/ie11.png index da4fd946e7a..16afe8f8214 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/10 - does not change bottom position if does not fit/ie11.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/10 - does not change bottom position if does not fit/ie11.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8fb5359a662487875c353e4bc89d0968b9d91ab4967932059b5a4272b3a81690 -size 24054 +oid sha256:1c14ca52f1c25b1e562795183e6e7b617bed6731c28f93a01bdf502a1560916f +size 17992 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/11 - does not change position on shrink/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/11 - does not change position on shrink/chrome.png index 41a0ce35dfb..a9421d5a883 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/11 - does not change position on shrink/chrome.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/11 - does not change position on shrink/chrome.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cf9123aed2180c5e6ca435129823290087e589f1f215ea13ee249b811835aa62 -size 21073 +oid sha256:d7f009a68397a8c6cbb52bfdbe945c523ae089a10f2bd63a9ec294e085f01d43 +size 13943 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/11 - does not change position on shrink/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/11 - does not change position on shrink/firefox.png index cba748b7f28..acb1fe4f7e0 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/11 - does not change position on shrink/firefox.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/11 - does not change position on shrink/firefox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3e406379243288ae88ea4963b0d07c59ab490194897bef7c4293577ecc8703b9 -size 17186 +oid sha256:f3d7722b815656d4eaf18835b5d463193de1c62c65981fca221f81fdb877e55a +size 11841 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/11 - does not change position on shrink/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/11 - does not change position on shrink/ie11.png index 8c3707c14c0..7beb3b6ebc5 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/11 - does not change position on shrink/ie11.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip with external dynamic content/11 - does not change position on shrink/ie11.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0a12589a33496d9d74de6d00c2d1a205320f4cd1fd381bf5705649e5d165bbc8 -size 17403 +oid sha256:0fbcaceb63ea70401eb359509b4a4d21aa4ea1461e9260a763c364f9099478b3 +size 11048 diff --git a/packages/react-ui-screenshot-tests/gemini/tooltip.js b/packages/react-ui-screenshot-tests/gemini/tooltip.js index 48ffb70e2ea..31ba993f43e 100644 --- a/packages/react-ui-screenshot-tests/gemini/tooltip.js +++ b/packages/react-ui-screenshot-tests/gemini/tooltip.js @@ -77,6 +77,7 @@ gemini.suite('Tooltip with external dynamic content', suite => { suite .before(renderStory('Tooltip', 'Tooltip with external dynamic content')) .setCaptureElements('#test-element') + .ignoreElements({ every: 'button' }) .capture('01 - plain') .capture('02 - changes top position if does not fit', (actions, find) => { From 219bb36fa34fd2eb142dfc4e03053196826d7a2b Mon Sep 17 00:00:00 2001 From: Egor Pogadaev Date: Tue, 26 Mar 2019 09:09:27 +0500 Subject: [PATCH 07/29] test(Input): fix flaky screenshots --- packages/react-ui-screenshot-tests/gemini/input.js | 7 +------ .../gemini/screens/Input with mask/Blured/chrome.png | 4 ++-- .../gemini/screens/Input with mask/Blured/firefox.png | 4 ++-- .../gemini/screens/Input with mask/Blured/ie11.png | 4 ++-- .../gemini/screens/Input with mask/Editing/chrome.png | 4 ++-- .../gemini/screens/Input with mask/Editing/firefox.png | 4 ++-- .../gemini/screens/Input with mask/Editing/ie11.png | 4 ++-- 7 files changed, 13 insertions(+), 18 deletions(-) diff --git a/packages/react-ui-screenshot-tests/gemini/input.js b/packages/react-ui-screenshot-tests/gemini/input.js index bbcac25206b..d8df95f61f9 100644 --- a/packages/react-ui-screenshot-tests/gemini/input.js +++ b/packages/react-ui-screenshot-tests/gemini/input.js @@ -112,12 +112,7 @@ gemini.suite('Input with mask', suite => { action.click(input); }) .capture('Editing', action => { - /** NOTE: ухищрения, чтоб не мигал в ie */ - const sampleString = '912247'; - sampleString.split('').forEach(char => { - action.wait(500); - action.sendKeys(input, char); - }); + action.sendKeys(input, '9'); }) .capture('Blured', action => { action.sendKeys(input, gemini.TAB); diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Blured/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Blured/chrome.png index 8f430c2c931..d298bc6ad9e 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Blured/chrome.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Blured/chrome.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cfb76160c4aa32cd7ae7a0400b81bd2a5cbc3239b0f4204d48ef6ac684d8ab2d -size 982 +oid sha256:1490891c196663a14523f7e36cbbb3796d99fb8ab6f810c163a92f8004d7efca +size 740 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Blured/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Blured/firefox.png index 46fc694eddb..2f7d58a33d7 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Blured/firefox.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Blured/firefox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f99521384d77f11f2cfb74d52a68e1a9a81f033fea66f5227931681d264bf3ab -size 810 +oid sha256:fea0ecc0e571ba6abb4f373a17205539a8b2931cb3250945c59f0d9df452eca9 +size 664 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Blured/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Blured/ie11.png index dc392f8f5c8..30452b49c29 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Blured/ie11.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Blured/ie11.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:64aa79cfddfd8b4091e7e53dc0cb3f9d89f4eea06da418cdccab164a242198ea -size 958 +oid sha256:ba80017fcf6209fbbcda1eef169a13259a6ee9968d2a2355e7b5ca43aa519584 +size 770 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Editing/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Editing/chrome.png index 58966897c09..40132c22a28 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Editing/chrome.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Editing/chrome.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4e038fb3ce4ff10761058daed8d7018c15eb1f430a10a4d32ca76d6666549157 -size 997 +oid sha256:1e186d26b8a3553b8bd5324c822ff6432154a4d699707b605ed2ec3c73d52a7a +size 733 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Editing/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Editing/firefox.png index aec5374d20c..3e5f9a50f23 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Editing/firefox.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Editing/firefox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:678468b9992ac8e33f9afae3ca495cdf5cc2f878943e7ecc3ea2689f247fbe32 -size 857 +oid sha256:1c14832b0deb2cbe7d27d4aae32fe532837771befc4c96ccb280fb6d70cf03ba +size 642 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Editing/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Editing/ie11.png index 7b7aaa82fc6..4e65d17aacd 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Editing/ie11.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Editing/ie11.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:62b2370a798813233673816ac32270239605902274635b438eb46ea86191c30c -size 1001 +oid sha256:04bed21894618531b99fe5ccaca3f813cd3e136c4af3e7a5b06eb178a47b3f37 +size 756 From 4987f03de22fbdaa6d149763714e8b71e407d64c Mon Sep 17 00:00:00 2001 From: Egor Pogadaev Date: Tue, 26 Mar 2019 11:56:53 +0500 Subject: [PATCH 08/29] test(Input): update screenshots with both placeholder and mask --- .../gemini/screens/Input with mask/Plain/chrome.png | 4 ++-- .../gemini/screens/Input with mask/Plain/firefox.png | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Plain/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Plain/chrome.png index 017d0526188..de20851c039 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Plain/chrome.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Plain/chrome.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9ff522803b9e64af3464cf2063b977dfc5af957ffcbcdc2b07feb70a612b646d -size 633 +oid sha256:834187f230a042d905a2e33bb7dac53b625a56bd787ba39daf360d0e29ace773 +size 615 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Plain/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Plain/firefox.png index 08a07594971..7198cc2a984 100644 --- a/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Plain/firefox.png +++ b/packages/react-ui-screenshot-tests/gemini/screens/Input with mask/Plain/firefox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6f63cef9f2c1865e99399793ebe3ca7811ef33171547da2c7b9a818d61c2b428 -size 548 +oid sha256:c4e180b9920c4710f99d0c1133edf480f5b8a99373e0b7a1017de02db34a1faf +size 519 From 6272625d3a5a969bb052423f6425989b81ca0b4b Mon Sep 17 00:00:00 2001 From: wKich Date: Tue, 26 Mar 2019 16:55:34 +0500 Subject: [PATCH 09/29] docs(react-ui-validations): fix commit links --- packages/react-ui-validations/CHANGELOG.md | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/packages/react-ui-validations/CHANGELOG.md b/packages/react-ui-validations/CHANGELOG.md index 39ec14d24f2..fd6b2860625 100644 --- a/packages/react-ui-validations/CHANGELOG.md +++ b/packages/react-ui-validations/CHANGELOG.md @@ -3,26 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## [0.7.2](https://github.com/skbkontur/retail-ui/tree/master/packages/react-ui-validations/compare/react-ui-validations@0.7.1...react-ui-validations@0.7.2) (2019-03-26) +## [0.7.2](https://github.com/skbkontur/retail-ui/compare/react-ui-validations@0.7.1...react-ui-validations@0.7.2) (2019-03-26) **Note:** Version bump only for package react-ui-validations - - - - ## 0.7.1 (2019-03-26) - ### Bug Fixes -* **ComboBoxOld:** bring typings back ([65d26cd](https://github.com/skbkontur/retail-ui/tree/master/packages/react-ui-validations/commit/65d26cd)) -* **ValidationWrapper:** scroll to element even if child ref is empty ([58ad2fc](https://github.com/skbkontur/retail-ui/tree/master/packages/react-ui-validations/commit/58ad2fc)) -* **ValidationWrapper:** support different refs ([#1243](https://github.com/skbkontur/retail-ui/tree/master/packages/react-ui-validations/issues/1243)) ([b63038a](https://github.com/skbkontur/retail-ui/tree/master/packages/react-ui-validations/commit/b63038a)) - - - - +- **ComboBoxOld:** bring typings back ([65d26cd](https://github.com/skbkontur/retail-ui/commit/65d26cd)) +- **ValidationWrapper:** scroll to element even if child ref is empty ([58ad2fc](https://github.com/skbkontur/retail-ui/commit/58ad2fc)) +- **ValidationWrapper:** support different refs ([#1243](https://github.com/skbkontur/retail-ui/issues/1243)) ([b63038a](https://github.com/skbkontur/retail-ui/commit/b63038a)) v0.2.15 From 1c6954a71d8f07441de432e19b2b94fda61bd4a4 Mon Sep 17 00:00:00 2001 From: kga Date: Tue, 26 Mar 2019 17:06:02 +0500 Subject: [PATCH 10/29] refactor(Textarea): remove duplicate styles generation --- packages/retail-ui/components/Textarea/Textarea.common.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/retail-ui/components/Textarea/Textarea.common.less b/packages/retail-ui/components/Textarea/Textarea.common.less index 7d85e14a948..a4d0bc2563c 100644 --- a/packages/retail-ui/components/Textarea/Textarea.common.less +++ b/packages/retail-ui/components/Textarea/Textarea.common.less @@ -1,6 +1,6 @@ @import '../variables.less'; -.commonStyles { +.commonStyles() { .root { position: relative; display: inline-block; From 33030706d2700d4b3b3376ba5c3b91c81f6de17a Mon Sep 17 00:00:00 2001 From: kga Date: Tue, 26 Mar 2019 17:06:49 +0500 Subject: [PATCH 11/29] refactor(Input): remove duplicate styles generation --- packages/retail-ui/components/Input/Input.common.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/retail-ui/components/Input/Input.common.less b/packages/retail-ui/components/Input/Input.common.less index 39fb97ad63d..97684a2ceab 100644 --- a/packages/retail-ui/components/Input/Input.common.less +++ b/packages/retail-ui/components/Input/Input.common.less @@ -1,6 +1,6 @@ @import '../variables.less'; -.commonStyles { +.commonStyles() { .root { .reset-text(); From 85312d96522f6f484f892be33cb7480162330c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B0=D0=B7=D0=B0=D1=80=D0=B5=D0=B2=D0=B0=20=D0=9E?= =?UTF-8?q?=D0=BB=D1=8C=D0=B3=D0=B0=20=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0?= =?UTF-8?q?=D0=B5=D0=B2=D0=BD=D0=B0?= Date: Tue, 26 Mar 2019 17:58:08 +0500 Subject: [PATCH 12/29] fix(Logotype): async load products widget script --- packages/retail-ui/components/Logotype/ProductWidget.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/retail-ui/components/Logotype/ProductWidget.tsx b/packages/retail-ui/components/Logotype/ProductWidget.tsx index 609d43c481a..dfdb9a8a4d4 100644 --- a/packages/retail-ui/components/Logotype/ProductWidget.tsx +++ b/packages/retail-ui/components/Logotype/ProductWidget.tsx @@ -10,7 +10,7 @@ export default { const script = document.createElement('script'); script.src = 'https://widget-product.kontur.ru/widget/loader?' + 'product=&type=service'; - document.getElementsByTagName('head')[0].appendChild(script); + setTimeout(() => document.getElementsByTagName('head')[0].appendChild(script)); }; if (window.jQuery) { From 93c74c493f5b2ee2453e8e8264aef28ffe3bbb2c Mon Sep 17 00:00:00 2001 From: wKich Date: Wed, 27 Mar 2019 09:49:34 +0500 Subject: [PATCH 13/29] docs(retail-ui): fix export components for styleguidist --- packages/retail-ui/components/CurrencyLabel/CurrencyLabel.tsx | 2 +- packages/retail-ui/components/Token/Token.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/retail-ui/components/CurrencyLabel/CurrencyLabel.tsx b/packages/retail-ui/components/CurrencyLabel/CurrencyLabel.tsx index b45ebd637a4..9a809cd1ed6 100644 --- a/packages/retail-ui/components/CurrencyLabel/CurrencyLabel.tsx +++ b/packages/retail-ui/components/CurrencyLabel/CurrencyLabel.tsx @@ -8,7 +8,7 @@ export interface CurrencyLabelProps { currencySymbol?: React.ReactNode | null; } -const CurrencyLabel: React.SFC = ({ +export const CurrencyLabel: React.SFC = ({ value, fractionDigits = 2, currencySymbol = null, diff --git a/packages/retail-ui/components/Token/Token.tsx b/packages/retail-ui/components/Token/Token.tsx index 3908dbaa037..e62e9133442 100644 --- a/packages/retail-ui/components/Token/Token.tsx +++ b/packages/retail-ui/components/Token/Token.tsx @@ -44,7 +44,7 @@ export interface TokenProps { warning?: boolean; } -const Token: React.SFC = ({ +export const Token: React.SFC = ({ children, isActive, colors, From c9763125e0e682c5e66aa663cc77f61477b3e7e6 Mon Sep 17 00:00:00 2001 From: wKich Date: Wed, 27 Mar 2019 11:27:25 +0500 Subject: [PATCH 14/29] fix(Popup): children is not required by prop-types fix #1292 --- packages/retail-ui/components/Popup/Popup.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/retail-ui/components/Popup/Popup.tsx b/packages/retail-ui/components/Popup/Popup.tsx index b89870c5e23..0b1ff999ad4 100644 --- a/packages/retail-ui/components/Popup/Popup.tsx +++ b/packages/retail-ui/components/Popup/Popup.tsx @@ -108,7 +108,7 @@ export default class Popup extends React.Component { */ backgroundColor: PropTypes.string, - children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired, + children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), /** * Показывать ли пин From 8dabe6dd5f51a8641a6b50fc2f368bbdde17797e Mon Sep 17 00:00:00 2001 From: Egor Pogadaev Date: Wed, 27 Mar 2019 11:45:27 +0500 Subject: [PATCH 15/29] chore(release): publish - react-ui-screenshot-tests@1.1.6 - retail-ui@0.44.3 --- packages/react-ui-screenshot-tests/CHANGELOG.md | 8 ++++++++ packages/react-ui-screenshot-tests/package.json | 2 +- packages/retail-ui/CHANGELOG.md | 12 ++++++++++++ packages/retail-ui/package.json | 2 +- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/packages/react-ui-screenshot-tests/CHANGELOG.md b/packages/react-ui-screenshot-tests/CHANGELOG.md index cd0d799692b..da98a0febf6 100644 --- a/packages/react-ui-screenshot-tests/CHANGELOG.md +++ b/packages/react-ui-screenshot-tests/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.1.6](https://github.com/skbkontur/retail-ui/compare/react-ui-screenshot-tests@1.1.5...react-ui-screenshot-tests@1.1.6) (2019-03-27) + +**Note:** Version bump only for package react-ui-screenshot-tests + + + + + ## [1.1.5](https://github.com/skbkontur/retail-ui/compare/react-ui-screenshot-tests@1.1.4...react-ui-screenshot-tests@1.1.5) (2019-03-26) **Note:** Version bump only for package react-ui-screenshot-tests diff --git a/packages/react-ui-screenshot-tests/package.json b/packages/react-ui-screenshot-tests/package.json index c1fbd9227dd..b66b85532c7 100644 --- a/packages/react-ui-screenshot-tests/package.json +++ b/packages/react-ui-screenshot-tests/package.json @@ -1,6 +1,6 @@ { "name": "react-ui-screenshot-tests", - "version": "1.1.5", + "version": "1.1.6", "main": "index.js", "license": "MIT", "private": true, diff --git a/packages/retail-ui/CHANGELOG.md b/packages/retail-ui/CHANGELOG.md index 3f4fa9f3633..14ac443249e 100644 --- a/packages/retail-ui/CHANGELOG.md +++ b/packages/retail-ui/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.44.3](https://github.com/skbkontur/retail-ui/compare/retail-ui@0.44.2...retail-ui@0.44.3) (2019-03-27) + + +### Bug Fixes + +* **Input:** don't show placeholder if mask is visible ([1c40f1d](https://github.com/skbkontur/retail-ui/commit/1c40f1d)) +* **Input:** fix placeholder width for masked input ([8696f40](https://github.com/skbkontur/retail-ui/commit/8696f40)), closes [#1272](https://github.com/skbkontur/retail-ui/issues/1272) + + + + + ## [0.44.2](https://github.com/skbkontur/retail-ui/compare/retail-ui@0.44.1...retail-ui@0.44.2) (2019-03-26) diff --git a/packages/retail-ui/package.json b/packages/retail-ui/package.json index a10d0d4c9d0..7cbe406b105 100644 --- a/packages/retail-ui/package.json +++ b/packages/retail-ui/package.json @@ -1,6 +1,6 @@ { "name": "retail-ui", - "version": "0.44.2", + "version": "0.44.3", "description": "UI Components", "main": "dist/index.js", "repository": { From 1b3bd4ef5fad32c2d0632f9020522bb3f29f47de Mon Sep 17 00:00:00 2001 From: Egor Pogadaev Date: Wed, 27 Mar 2019 16:57:58 +0500 Subject: [PATCH 16/29] revert(Popup): fix regress with dynamically changing callbacks #1297 --- packages/retail-ui/components/Popup/Popup.tsx | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/packages/retail-ui/components/Popup/Popup.tsx b/packages/retail-ui/components/Popup/Popup.tsx index b89870c5e23..21017f27e17 100644 --- a/packages/retail-ui/components/Popup/Popup.tsx +++ b/packages/retail-ui/components/Popup/Popup.tsx @@ -258,22 +258,11 @@ export default class Popup extends React.Component { private addEventListeners(element: Nullable) { if (element && element instanceof HTMLElement) { - const props = this.props; - if (props.onMouseEnter) { - element.addEventListener('mouseenter', this.handleMouseEnter); - } - if (props.onMouseLeave) { - element.addEventListener('mouseleave', this.handleMouseLeave); - } - if (props.onClick) { - element.addEventListener('click', this.handleClick); - } - if (props.onFocus) { - element.addEventListener('focusin', this.handleFocus as EventListener); - } - if (props.onBlur) { - element.addEventListener('focusout', this.handleBlur as EventListener); - } + element.addEventListener('mouseenter', this.handleMouseEnter); + element.addEventListener('mouseleave', this.handleMouseLeave); + element.addEventListener('click', this.handleClick); + element.addEventListener('focusin', this.handleFocus as EventListener); + element.addEventListener('focusout', this.handleBlur as EventListener); } } From 88cf16a36ecf7dbdbc8c2cc24856738da61c4f8b Mon Sep 17 00:00:00 2001 From: Egor Pogadaev Date: Wed, 27 Mar 2019 17:01:51 +0500 Subject: [PATCH 17/29] test(Tooltip): add story with dynamic triggers --- .../Tooltip/__stories__/Tooltip.stories.tsx | 40 ++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/packages/retail-ui/components/Tooltip/__stories__/Tooltip.stories.tsx b/packages/retail-ui/components/Tooltip/__stories__/Tooltip.stories.tsx index 085fce0c1b8..36990e903fe 100644 --- a/packages/retail-ui/components/Tooltip/__stories__/Tooltip.stories.tsx +++ b/packages/retail-ui/components/Tooltip/__stories__/Tooltip.stories.tsx @@ -169,7 +169,8 @@ storiesOf('Tooltip', module) .add('Tooltip with trigger=click', () => ) .add('Tooltip with dynamic anchor', () => ) .add('Multiple tooltips with useWrapper=false', () => ) - .add('Tooltip with Input and switchable content', () => ); + .add('Tooltip with Input and switchable content', () => ) + .add('dynamic triggers', () => ); class TooltipWithInput extends React.Component { public state = { show: false }; @@ -453,3 +454,40 @@ function MultipleTooltips() {
); } + +interface DynamicTriggersState { + trigger?: TooltipTrigger; +} + +class DynamicTriggers extends React.Component<{}, DynamicTriggersState> { + public state: DynamicTriggersState = {}; + + public render() { + const triggers: TooltipTrigger[] = ['hover', 'click', 'focus', 'opened', 'closed', 'hoverAnchor']; + return ( +
+
+ {triggers.map(trigger => ( + + ))} +
+ + + +
+ ); + } + + private setTrigger = (trigger: TooltipTrigger) => { + this.setState({ + trigger, + }); + }; +} From dd9c9127433e41a0200074f5a4a88ba014cb4cf6 Mon Sep 17 00:00:00 2001 From: Egor Pogadaev Date: Wed, 27 Mar 2019 17:03:50 +0500 Subject: [PATCH 18/29] test(Tooltip): add screenshots with dynamic triggers --- .../click - click anchor/chrome.png | 3 ++ .../click - click anchor/firefox.png | 3 ++ .../click - click anchor/ie11.png | 3 ++ .../click - click outside/chrome.png | 3 ++ .../click - click outside/firefox.png | 3 ++ .../click - click outside/ie11.png | 3 ++ .../closed/chrome.png | 3 ++ .../closed/firefox.png | 3 ++ .../closed/ie11.png | 3 ++ .../focus - blur/chrome.png | 3 ++ .../focus - blur/firefox.png | 3 ++ .../focus - blur/ie11.png | 3 ++ .../focus - focus/chrome.png | 3 ++ .../focus - focus/firefox.png | 3 ++ .../focus - focus/ie11.png | 3 ++ .../hover - mouseEnter/chrome.png | 3 ++ .../hover - mouseEnter/firefox.png | 3 ++ .../hover - mouseEnter/ie11.png | 3 ++ .../hover - mouseLeave/chrome.png | 3 ++ .../hover - mouseLeave/firefox.png | 3 ++ .../hover - mouseLeave/ie11.png | 3 ++ .../opened/chrome.png | 3 ++ .../opened/firefox.png | 3 ++ .../opened/ie11.png | 3 ++ .../without trigger/chrome.png | 3 ++ .../without trigger/firefox.png | 3 ++ .../without trigger/ie11.png | 3 ++ .../gemini/tooltip.js | 45 +++++++++++++++++++ 28 files changed, 126 insertions(+) create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click anchor/chrome.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click anchor/firefox.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click anchor/ie11.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click outside/chrome.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click outside/firefox.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click outside/ie11.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/closed/chrome.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/closed/firefox.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/closed/ie11.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - blur/chrome.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - blur/firefox.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - blur/ie11.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - focus/chrome.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - focus/firefox.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - focus/ie11.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseEnter/chrome.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseEnter/firefox.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseEnter/ie11.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseLeave/chrome.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseLeave/firefox.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseLeave/ie11.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/opened/chrome.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/opened/firefox.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/opened/ie11.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/without trigger/chrome.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/without trigger/firefox.png create mode 100644 packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/without trigger/ie11.png diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click anchor/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click anchor/chrome.png new file mode 100644 index 00000000000..530e3e851a3 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click anchor/chrome.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ad0a1dbe8d2bba672c69c3aa5ea20fddc16ee0761dacf9e64e6b9e404e1188f +size 3309 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click anchor/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click anchor/firefox.png new file mode 100644 index 00000000000..3acab6f44fe --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click anchor/firefox.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25e9566590bbc26bd9eb29ee5754b4ccba55361ebc1574d4525f57280780ce00 +size 2962 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click anchor/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click anchor/ie11.png new file mode 100644 index 00000000000..d926c9e85e7 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click anchor/ie11.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0529a8b27765db7ade56f6acc687e160c3cd3b4a169bc698c00bf75444f2f4c5 +size 2851 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click outside/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click outside/chrome.png new file mode 100644 index 00000000000..ccd0dd3d29f --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click outside/chrome.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2bee4d8a81d426002ff77a643f746346314abe704ff4aaf42c8110caf3735e8a +size 1355 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click outside/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click outside/firefox.png new file mode 100644 index 00000000000..300ed14a224 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click outside/firefox.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:015a1e73fc2e666927b119633b7986eee08bcc94093afcb9001ee3f1049e6013 +size 1362 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click outside/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click outside/ie11.png new file mode 100644 index 00000000000..afaadefcc50 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/click - click outside/ie11.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a67b097a82358c256e202b35f402a6d48cd3385aae36dd1dee1196cd438c540 +size 1285 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/closed/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/closed/chrome.png new file mode 100644 index 00000000000..ccd0dd3d29f --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/closed/chrome.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2bee4d8a81d426002ff77a643f746346314abe704ff4aaf42c8110caf3735e8a +size 1355 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/closed/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/closed/firefox.png new file mode 100644 index 00000000000..300ed14a224 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/closed/firefox.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:015a1e73fc2e666927b119633b7986eee08bcc94093afcb9001ee3f1049e6013 +size 1362 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/closed/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/closed/ie11.png new file mode 100644 index 00000000000..afaadefcc50 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/closed/ie11.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a67b097a82358c256e202b35f402a6d48cd3385aae36dd1dee1196cd438c540 +size 1285 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - blur/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - blur/chrome.png new file mode 100644 index 00000000000..ccd0dd3d29f --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - blur/chrome.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2bee4d8a81d426002ff77a643f746346314abe704ff4aaf42c8110caf3735e8a +size 1355 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - blur/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - blur/firefox.png new file mode 100644 index 00000000000..300ed14a224 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - blur/firefox.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:015a1e73fc2e666927b119633b7986eee08bcc94093afcb9001ee3f1049e6013 +size 1362 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - blur/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - blur/ie11.png new file mode 100644 index 00000000000..afaadefcc50 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - blur/ie11.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a67b097a82358c256e202b35f402a6d48cd3385aae36dd1dee1196cd438c540 +size 1285 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - focus/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - focus/chrome.png new file mode 100644 index 00000000000..8193b252415 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - focus/chrome.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:10b397099c42f03f5e5a835ce9da9609cd5b53d03214b2cbe625c4080fb5465f +size 3148 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - focus/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - focus/firefox.png new file mode 100644 index 00000000000..300ed14a224 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - focus/firefox.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:015a1e73fc2e666927b119633b7986eee08bcc94093afcb9001ee3f1049e6013 +size 1362 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - focus/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - focus/ie11.png new file mode 100644 index 00000000000..42c1be8be93 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/focus - focus/ie11.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e00fbe4a285123625a3aafcd3fcc899719fdee92493b90a3773e474128a0c726 +size 2695 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseEnter/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseEnter/chrome.png new file mode 100644 index 00000000000..32582b15a0c --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseEnter/chrome.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:acc5cad15917d45b96c10beb5aab167e54e9a30dc240398c733ca91bbb0dd00e +size 3180 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseEnter/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseEnter/firefox.png new file mode 100644 index 00000000000..ea32b442dc2 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseEnter/firefox.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:69e4d35d2b6013be0080a45676d9718022d58031bec438d231a3705c45e8296a +size 2820 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseEnter/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseEnter/ie11.png new file mode 100644 index 00000000000..42c1be8be93 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseEnter/ie11.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e00fbe4a285123625a3aafcd3fcc899719fdee92493b90a3773e474128a0c726 +size 2695 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseLeave/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseLeave/chrome.png new file mode 100644 index 00000000000..ccd0dd3d29f --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseLeave/chrome.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2bee4d8a81d426002ff77a643f746346314abe704ff4aaf42c8110caf3735e8a +size 1355 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseLeave/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseLeave/firefox.png new file mode 100644 index 00000000000..300ed14a224 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseLeave/firefox.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:015a1e73fc2e666927b119633b7986eee08bcc94093afcb9001ee3f1049e6013 +size 1362 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseLeave/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseLeave/ie11.png new file mode 100644 index 00000000000..afaadefcc50 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/hover - mouseLeave/ie11.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a67b097a82358c256e202b35f402a6d48cd3385aae36dd1dee1196cd438c540 +size 1285 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/opened/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/opened/chrome.png new file mode 100644 index 00000000000..fa2758ddbf4 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/opened/chrome.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b60e55e7e914a5ad9931097439f71e3bb6e6ee1ae5d4f8a5177f415f2a6776a0 +size 3341 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/opened/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/opened/firefox.png new file mode 100644 index 00000000000..3acab6f44fe --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/opened/firefox.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25e9566590bbc26bd9eb29ee5754b4ccba55361ebc1574d4525f57280780ce00 +size 2962 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/opened/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/opened/ie11.png new file mode 100644 index 00000000000..d926c9e85e7 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/opened/ie11.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0529a8b27765db7ade56f6acc687e160c3cd3b4a169bc698c00bf75444f2f4c5 +size 2851 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/without trigger/chrome.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/without trigger/chrome.png new file mode 100644 index 00000000000..ccd0dd3d29f --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/without trigger/chrome.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2bee4d8a81d426002ff77a643f746346314abe704ff4aaf42c8110caf3735e8a +size 1355 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/without trigger/firefox.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/without trigger/firefox.png new file mode 100644 index 00000000000..300ed14a224 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/without trigger/firefox.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:015a1e73fc2e666927b119633b7986eee08bcc94093afcb9001ee3f1049e6013 +size 1362 diff --git a/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/without trigger/ie11.png b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/without trigger/ie11.png new file mode 100644 index 00000000000..afaadefcc50 --- /dev/null +++ b/packages/react-ui-screenshot-tests/gemini/screens/Tooltip/with dynamically changing triggers/without trigger/ie11.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a67b097a82358c256e202b35f402a6d48cd3385aae36dd1dee1196cd438c540 +size 1285 diff --git a/packages/react-ui-screenshot-tests/gemini/tooltip.js b/packages/react-ui-screenshot-tests/gemini/tooltip.js index ffa756d3162..07ad398a87f 100644 --- a/packages/react-ui-screenshot-tests/gemini/tooltip.js +++ b/packages/react-ui-screenshot-tests/gemini/tooltip.js @@ -115,6 +115,7 @@ gemini.suite('Tooltip', () => { actions.click(find('#Container-4 button')); }); }); + gemini.suite('with Input and switchable content', suite => { suite .before(renderStory('Tooltip', 'Tooltip with Input and switchable content')) @@ -129,4 +130,48 @@ gemini.suite('Tooltip', () => { actions.sendKeys(find('input'), [gemini.BACK_SPACE, gemini.BACK_SPACE]); }); }); + + gemini.suite('with dynamically changing triggers', suite => { + suite + .before(renderStory('Tooltip', 'dynamic triggers')) + .before((actions, find) => { + this.anchor = find('#anchor'); + }) + .setCaptureElements('#test-element') + .ignoreElements({ every: 'button' }) + + .capture('without trigger') + + .capture('hover - mouseEnter', (actions, find) => { + actions.click(find('#hover')); + actions.mouseMove(this.anchor); + }) + .capture('hover - mouseLeave', (actions, find) => { + actions.mouseMove(find('body', [0, 0])); + }) + + .capture('click - click anchor', (actions, find) => { + actions.click(find('#click')); + actions.click(this.anchor); + }) + .capture('click - click outside', (actions, find) => { + actions.click(find('body')); + }) + + .capture('focus - focus', (actions, find) => { + actions.click(find('#focus')); + actions.focus(this.anchor); + }) + .capture('focus - blur', (actions, find) => { + actions.focus(find('body')); + }) + + .capture('opened', (actions, find) => { + actions.click(find('#opened')); + }) + + .capture('closed', (actions, find) => { + actions.click(find('#closed')); + }); + }); }); From 42f8fed3423f2982917b189c43a9116f1a7dc578 Mon Sep 17 00:00:00 2001 From: Eazymov Date: Thu, 28 Mar 2019 00:13:06 +0500 Subject: [PATCH 19/29] feat(flow): add typings --- .../components/DateInput/DateInput.js.flow | 60 +++++++++ .../DateInputHelpers/UnknownDatePart.js.flow | 3 + .../DateInputHelpers/clearDatePart.js.flow | 4 + .../DateInputHelpers/dateFormat.js.flow | 8 ++ .../DateInputHelpers/fillEmptyParts.js.flow | 13 ++ .../DateInput/DateInputHelpers/index.js.flow | 8 ++ .../DateInputHelpers/inputNumber.js.flow | 4 + .../DateInputHelpers/maskChar.js.flow | 2 + .../DateInputHelpers/setSelection.js.flow | 5 + .../tryParseDateString.js.flow | 6 + .../DateInputHelpers/udpateDatePartBy.js.flow | 4 + .../DateInputKeyboardActions.js.flow | 17 +++ .../components/DateInput/DatePart.js.flow | 10 ++ .../components/DateInput/MaskedValue.js.flow | 9 ++ .../DateInput/SelectionHelpers.js.flow | 3 + .../components/DateInput/index.js.flow | 2 + .../components/DatePicker/DatePicker.js.flow | 45 +++++++ .../DatePicker/DatePickerHelpers.js.flow | 7 + .../components/DatePicker/DateShape.js.flow | 11 ++ .../components/DatePicker/Picker.js.flow | 23 ++++ .../components/DatePicker/index.js.flow | 2 + .../retail-ui/components/Fias/Fias.js.flow | 36 ++++++ .../components/Fias/FiasModal.js.flow | 14 ++ .../components/Fias/Form/FiasComboBox.js.flow | 25 ++++ .../components/Fias/Form/FiasForm.js.flow | 22 ++++ .../components/Fias/Form/FiasSearch.js.flow | 15 +++ .../Fias/api/APIResultFactory.js.flow | 7 + .../components/Fias/api/FiasAPI.js.flow | 13 ++ .../components/Fias/api/MockAPI.js.flow | 13 ++ .../Fias/constants/abbreviations.js.flow | 7 + .../components/Fias/constants/locale.js.flow | 39 ++++++ .../retail-ui/components/Fias/index.js.flow | 2 + .../components/Fias/logger/Logger.js.flow | 13 ++ .../components/Fias/models/Address.js.flow | 50 +++++++ .../Fias/models/AddressElement.js.flow | 15 +++ .../components/Fias/models/FiasData.js.flow | 10 ++ .../retail-ui/components/Fias/types.js.flow | 122 ++++++++++++++++++ .../components/Modal/Modal.adapter.js.flow | 4 + .../retail-ui/components/Modal/Modal.js.flow | 29 +++++ .../components/Modal/ModalBody.js.flow | 3 + .../components/Modal/ModalClose.js.flow | 6 + .../components/Modal/ModalContext.js.flow | 26 ++++ .../components/Modal/ModalFooter.js.flow | 10 ++ .../components/Modal/ModalHeader.js.flow | 10 ++ .../retail-ui/components/Modal/index.js.flow | 2 + .../components/ModalStack/ModalStack.js.flow | 10 ++ .../components/ModalStack/index.js.flow | 2 + .../Paging/NavigationHelper.js.flow | 13 ++ .../components/Paging/Paging.js.flow | 38 ++++++ .../components/Paging/PagingHelper.js.flow | 10 ++ .../retail-ui/components/Paging/index.js.flow | 2 + .../PasswordInput/PasswordInput.js.flow | 26 ++++ .../PasswordInputFallback.js.flow | 13 ++ .../PasswordInput/getCharHelper.js.flow | 4 + .../components/PasswordInput/index.js.flow | 2 + .../retail-ui/components/Radio/Radio.js.flow | 33 +++++ .../retail-ui/components/Radio/index.js.flow | 2 + .../components/RadioGroup/Prevent.js.flow | 9 ++ .../RadioGroup/RadioGroup.adapter.js.flow | 4 + .../components/RadioGroup/RadioGroup.js.flow | 41 ++++++ .../components/RadioGroup/index.js.flow | 2 + .../RenderLayer/RenderLayer.js.flow | 12 ++ .../components/RenderLayer/index.js.flow | 2 + .../ScrollContainer/ScrollContainer.js.flow | 24 ++++ .../components/ScrollContainer/index.js.flow | 2 + .../retail-ui/components/Select/Item.js.flow | 7 + .../components/Select/Select.adapter.js.flow | 4 + .../components/Select/Select.js.flow | 81 ++++++++++++ .../retail-ui/components/Select/index.js.flow | 2 + .../components/SidePage/SidePage.js.flow | 33 +++++ .../components/SidePage/SidePageBody.js.flow | 13 ++ .../SidePage/SidePageContainer.js.flow | 5 + .../SidePage/SidePageContext.js.flow | 26 ++++ .../SidePage/SidePageFooter.js.flow | 16 +++ .../SidePage/SidePageHeader.js.flow | 11 ++ .../components/SidePage/index.js.flow | 2 + .../components/Sticky/Sticky.js.flow | 22 ++++ .../retail-ui/components/Sticky/index.js.flow | 2 + .../components/Switcher/Switcher.js.flow | 26 ++++ .../components/Switcher/index.js.flow | 2 + .../components/Tabs/Indicator.js.flow | 21 +++ .../retail-ui/components/Tabs/Tab.js.flow | 48 +++++++ .../retail-ui/components/Tabs/Tabs.js.flow | 28 ++++ .../retail-ui/components/Tabs/index.js.flow | 2 + .../Textarea/Textarea.adapter.js.flow | 11 ++ .../components/Textarea/Textarea.js.flow | 33 +++++ .../Textarea/TextareaHelpers.js.flow | 6 + .../components/Textarea/index.js.flow | 2 + .../retail-ui/components/Toast/Toast.js.flow | 29 +++++ .../components/Toast/ToastStatic.js.flow | 10 ++ .../components/Toast/ToastView.js.flow | 16 +++ .../retail-ui/components/Toast/index.js.flow | 2 + 92 files changed, 1450 insertions(+) create mode 100644 packages/retail-ui/components/DateInput/DateInput.js.flow create mode 100644 packages/retail-ui/components/DateInput/DateInputHelpers/UnknownDatePart.js.flow create mode 100644 packages/retail-ui/components/DateInput/DateInputHelpers/clearDatePart.js.flow create mode 100644 packages/retail-ui/components/DateInput/DateInputHelpers/dateFormat.js.flow create mode 100644 packages/retail-ui/components/DateInput/DateInputHelpers/fillEmptyParts.js.flow create mode 100644 packages/retail-ui/components/DateInput/DateInputHelpers/index.js.flow create mode 100644 packages/retail-ui/components/DateInput/DateInputHelpers/inputNumber.js.flow create mode 100644 packages/retail-ui/components/DateInput/DateInputHelpers/maskChar.js.flow create mode 100644 packages/retail-ui/components/DateInput/DateInputHelpers/setSelection.js.flow create mode 100644 packages/retail-ui/components/DateInput/DateInputHelpers/tryParseDateString.js.flow create mode 100644 packages/retail-ui/components/DateInput/DateInputHelpers/udpateDatePartBy.js.flow create mode 100644 packages/retail-ui/components/DateInput/DateInputKeyboardActions.js.flow create mode 100644 packages/retail-ui/components/DateInput/DatePart.js.flow create mode 100644 packages/retail-ui/components/DateInput/MaskedValue.js.flow create mode 100644 packages/retail-ui/components/DateInput/SelectionHelpers.js.flow create mode 100644 packages/retail-ui/components/DateInput/index.js.flow create mode 100644 packages/retail-ui/components/DatePicker/DatePicker.js.flow create mode 100644 packages/retail-ui/components/DatePicker/DatePickerHelpers.js.flow create mode 100644 packages/retail-ui/components/DatePicker/DateShape.js.flow create mode 100644 packages/retail-ui/components/DatePicker/Picker.js.flow create mode 100644 packages/retail-ui/components/DatePicker/index.js.flow create mode 100644 packages/retail-ui/components/Fias/Fias.js.flow create mode 100644 packages/retail-ui/components/Fias/FiasModal.js.flow create mode 100644 packages/retail-ui/components/Fias/Form/FiasComboBox.js.flow create mode 100644 packages/retail-ui/components/Fias/Form/FiasForm.js.flow create mode 100644 packages/retail-ui/components/Fias/Form/FiasSearch.js.flow create mode 100644 packages/retail-ui/components/Fias/api/APIResultFactory.js.flow create mode 100644 packages/retail-ui/components/Fias/api/FiasAPI.js.flow create mode 100644 packages/retail-ui/components/Fias/api/MockAPI.js.flow create mode 100644 packages/retail-ui/components/Fias/constants/abbreviations.js.flow create mode 100644 packages/retail-ui/components/Fias/constants/locale.js.flow create mode 100644 packages/retail-ui/components/Fias/index.js.flow create mode 100644 packages/retail-ui/components/Fias/logger/Logger.js.flow create mode 100644 packages/retail-ui/components/Fias/models/Address.js.flow create mode 100644 packages/retail-ui/components/Fias/models/AddressElement.js.flow create mode 100644 packages/retail-ui/components/Fias/models/FiasData.js.flow create mode 100644 packages/retail-ui/components/Fias/types.js.flow create mode 100644 packages/retail-ui/components/Modal/Modal.adapter.js.flow create mode 100644 packages/retail-ui/components/Modal/Modal.js.flow create mode 100644 packages/retail-ui/components/Modal/ModalBody.js.flow create mode 100644 packages/retail-ui/components/Modal/ModalClose.js.flow create mode 100644 packages/retail-ui/components/Modal/ModalContext.js.flow create mode 100644 packages/retail-ui/components/Modal/ModalFooter.js.flow create mode 100644 packages/retail-ui/components/Modal/ModalHeader.js.flow create mode 100644 packages/retail-ui/components/Modal/index.js.flow create mode 100644 packages/retail-ui/components/ModalStack/ModalStack.js.flow create mode 100644 packages/retail-ui/components/ModalStack/index.js.flow create mode 100644 packages/retail-ui/components/Paging/NavigationHelper.js.flow create mode 100644 packages/retail-ui/components/Paging/Paging.js.flow create mode 100644 packages/retail-ui/components/Paging/PagingHelper.js.flow create mode 100644 packages/retail-ui/components/Paging/index.js.flow create mode 100644 packages/retail-ui/components/PasswordInput/PasswordInput.js.flow create mode 100644 packages/retail-ui/components/PasswordInput/PasswordInputFallback.js.flow create mode 100644 packages/retail-ui/components/PasswordInput/getCharHelper.js.flow create mode 100644 packages/retail-ui/components/PasswordInput/index.js.flow create mode 100644 packages/retail-ui/components/Radio/Radio.js.flow create mode 100644 packages/retail-ui/components/Radio/index.js.flow create mode 100644 packages/retail-ui/components/RadioGroup/Prevent.js.flow create mode 100644 packages/retail-ui/components/RadioGroup/RadioGroup.adapter.js.flow create mode 100644 packages/retail-ui/components/RadioGroup/RadioGroup.js.flow create mode 100644 packages/retail-ui/components/RadioGroup/index.js.flow create mode 100644 packages/retail-ui/components/RenderLayer/RenderLayer.js.flow create mode 100644 packages/retail-ui/components/RenderLayer/index.js.flow create mode 100644 packages/retail-ui/components/ScrollContainer/ScrollContainer.js.flow create mode 100644 packages/retail-ui/components/ScrollContainer/index.js.flow create mode 100644 packages/retail-ui/components/Select/Item.js.flow create mode 100644 packages/retail-ui/components/Select/Select.adapter.js.flow create mode 100644 packages/retail-ui/components/Select/Select.js.flow create mode 100644 packages/retail-ui/components/Select/index.js.flow create mode 100644 packages/retail-ui/components/SidePage/SidePage.js.flow create mode 100644 packages/retail-ui/components/SidePage/SidePageBody.js.flow create mode 100644 packages/retail-ui/components/SidePage/SidePageContainer.js.flow create mode 100644 packages/retail-ui/components/SidePage/SidePageContext.js.flow create mode 100644 packages/retail-ui/components/SidePage/SidePageFooter.js.flow create mode 100644 packages/retail-ui/components/SidePage/SidePageHeader.js.flow create mode 100644 packages/retail-ui/components/SidePage/index.js.flow create mode 100644 packages/retail-ui/components/Sticky/Sticky.js.flow create mode 100644 packages/retail-ui/components/Sticky/index.js.flow create mode 100644 packages/retail-ui/components/Switcher/Switcher.js.flow create mode 100644 packages/retail-ui/components/Switcher/index.js.flow create mode 100644 packages/retail-ui/components/Tabs/Indicator.js.flow create mode 100644 packages/retail-ui/components/Tabs/Tab.js.flow create mode 100644 packages/retail-ui/components/Tabs/Tabs.js.flow create mode 100644 packages/retail-ui/components/Tabs/index.js.flow create mode 100644 packages/retail-ui/components/Textarea/Textarea.adapter.js.flow create mode 100644 packages/retail-ui/components/Textarea/Textarea.js.flow create mode 100644 packages/retail-ui/components/Textarea/TextareaHelpers.js.flow create mode 100644 packages/retail-ui/components/Textarea/index.js.flow create mode 100644 packages/retail-ui/components/Toast/Toast.js.flow create mode 100644 packages/retail-ui/components/Toast/ToastStatic.js.flow create mode 100644 packages/retail-ui/components/Toast/ToastView.js.flow create mode 100644 packages/retail-ui/components/Toast/index.js.flow diff --git a/packages/retail-ui/components/DateInput/DateInput.js.flow b/packages/retail-ui/components/DateInput/DateInput.js.flow new file mode 100644 index 00000000000..b3c0569eb63 --- /dev/null +++ b/packages/retail-ui/components/DateInput/DateInput.js.flow @@ -0,0 +1,60 @@ +/* @flow */ +import type { CalendarDateShape } from '../Calendar/CalendarDateShape'; + +declare export var DateInputConfig: {| + polyfillInput: boolean, +|}; + +declare export var DateParts: {| + Date: number, + Month: number, + Year: number, + All: number, +|}; + +export type DateInputState = {| + selected: number | null, + editingCharIndex: number, + date: string | null, + month: string | null, + year: string | null, + minDate: ?CalendarDateShape, + maxDate: ?CalendarDateShape, + notify: boolean, +|}; + +export type DateInputProps = {| + value?: string, + error?: boolean, + warning?: boolean, + disabled?: boolean, + minDate?: ?string, + maxDate?: ?string, + width?: string | number, + withIcon?: boolean, + size?: 'small' | 'large' | 'medium', + onBlur?: (x0: SyntheticFocusEvent) => void, + onFocus?: (x0: SyntheticFocusEvent) => void, + onChange?: ( + x0: {| + target: {| + value: string, + |}, + |}, + x1: string, + ) => void, + onKeyDown?: (x0: SyntheticKeyboardEvent) => void, +|}; + +export type DateInputSetStateCallBack = ( + prevState: $ReadOnly, + props?: DateInputProps, +) => DateInputState | null; + +declare class DateInput extends React$Component { + blur(): void, + focus(): void, + blink(): void, +} + +export default DateInput; diff --git a/packages/retail-ui/components/DateInput/DateInputHelpers/UnknownDatePart.js.flow b/packages/retail-ui/components/DateInput/DateInputHelpers/UnknownDatePart.js.flow new file mode 100644 index 00000000000..00f65834bf6 --- /dev/null +++ b/packages/retail-ui/components/DateInput/DateInputHelpers/UnknownDatePart.js.flow @@ -0,0 +1,3 @@ +/* @flow */ + +declare export class UnknownDatePart extends Error {} diff --git a/packages/retail-ui/components/DateInput/DateInputHelpers/clearDatePart.js.flow b/packages/retail-ui/components/DateInput/DateInputHelpers/clearDatePart.js.flow new file mode 100644 index 00000000000..7d1265ae11e --- /dev/null +++ b/packages/retail-ui/components/DateInput/DateInputHelpers/clearDatePart.js.flow @@ -0,0 +1,4 @@ +/* @flow */ +import type { DateInputState } from '../DateInput'; + +declare export var clearDatePart: (state: DateInputState) => DateInputState; diff --git a/packages/retail-ui/components/DateInput/DateInputHelpers/dateFormat.js.flow b/packages/retail-ui/components/DateInput/DateInputHelpers/dateFormat.js.flow new file mode 100644 index 00000000000..04c50ec44ba --- /dev/null +++ b/packages/retail-ui/components/DateInput/DateInputHelpers/dateFormat.js.flow @@ -0,0 +1,8 @@ +/* @flow */ +declare export var parseValue: (value: string | null | void) => {| + date: string | null, + month: string | null, + year: string | null, +|}; + +declare export var formatDate: (date: string | null | void, month: string | null | void, year: string | null | void) => string; diff --git a/packages/retail-ui/components/DateInput/DateInputHelpers/fillEmptyParts.js.flow b/packages/retail-ui/components/DateInput/DateInputHelpers/fillEmptyParts.js.flow new file mode 100644 index 00000000000..311f995c601 --- /dev/null +++ b/packages/retail-ui/components/DateInput/DateInputHelpers/fillEmptyParts.js.flow @@ -0,0 +1,13 @@ +/* @flow */ + +type DateShape = {| + date: ?string, + month: ?string, + year: ?string, +|}; + +declare export function fillEmptyParts(props: DateShape, now?: Date): {| + date: string, + month: string, + year: string, +|}; diff --git a/packages/retail-ui/components/DateInput/DateInputHelpers/index.js.flow b/packages/retail-ui/components/DateInput/DateInputHelpers/index.js.flow new file mode 100644 index 00000000000..58ae3b7e7d5 --- /dev/null +++ b/packages/retail-ui/components/DateInput/DateInputHelpers/index.js.flow @@ -0,0 +1,8 @@ +/* @flow */ +import { clearDatePart } from './clearDatePart'; +import { updateDatePartBy } from './udpateDatePartBy'; +import { inputNumber } from './inputNumber'; +import { setSelection, moveSelectionBy } from './setSelection'; +import { tryParseDateString } from './tryParseDateString'; + +export { clearDatePart, inputNumber, updateDatePartBy, setSelection, moveSelectionBy, tryParseDateString }; diff --git a/packages/retail-ui/components/DateInput/DateInputHelpers/inputNumber.js.flow b/packages/retail-ui/components/DateInput/DateInputHelpers/inputNumber.js.flow new file mode 100644 index 00000000000..86c7f1e9791 --- /dev/null +++ b/packages/retail-ui/components/DateInput/DateInputHelpers/inputNumber.js.flow @@ -0,0 +1,4 @@ +/* @flow */ +import type { DateInputState } from '../DateInput'; + +declare export var inputNumber: (key: string) => (state: DateInputState) => DateInputState; diff --git a/packages/retail-ui/components/DateInput/DateInputHelpers/maskChar.js.flow b/packages/retail-ui/components/DateInput/DateInputHelpers/maskChar.js.flow new file mode 100644 index 00000000000..0b383689d32 --- /dev/null +++ b/packages/retail-ui/components/DateInput/DateInputHelpers/maskChar.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +declare export var maskChar: "_"; diff --git a/packages/retail-ui/components/DateInput/DateInputHelpers/setSelection.js.flow b/packages/retail-ui/components/DateInput/DateInputHelpers/setSelection.js.flow new file mode 100644 index 00000000000..8f7ec05b54f --- /dev/null +++ b/packages/retail-ui/components/DateInput/DateInputHelpers/setSelection.js.flow @@ -0,0 +1,5 @@ +/* @flow */ +import type { DateInputState } from '../DateInput'; + +declare export var setSelection: (index: number | null) => (state: $ReadOnly) => DateInputState; +declare export var moveSelectionBy: (step: number) => (state: DateInputState) => DateInputState; diff --git a/packages/retail-ui/components/DateInput/DateInputHelpers/tryParseDateString.js.flow b/packages/retail-ui/components/DateInput/DateInputHelpers/tryParseDateString.js.flow new file mode 100644 index 00000000000..c078a7af7ea --- /dev/null +++ b/packages/retail-ui/components/DateInput/DateInputHelpers/tryParseDateString.js.flow @@ -0,0 +1,6 @@ +/* @flow */ +declare export var tryParseDateString: (value: string) => {| + date: string, + month: string, + year: string, +|} | null; diff --git a/packages/retail-ui/components/DateInput/DateInputHelpers/udpateDatePartBy.js.flow b/packages/retail-ui/components/DateInput/DateInputHelpers/udpateDatePartBy.js.flow new file mode 100644 index 00000000000..c2c073b0815 --- /dev/null +++ b/packages/retail-ui/components/DateInput/DateInputHelpers/udpateDatePartBy.js.flow @@ -0,0 +1,4 @@ +/* @flow */ +import type { DateInputState } from '../DateInput'; + +declare export var updateDatePartBy: (step: number) => (state: DateInputState) => DateInputState; diff --git a/packages/retail-ui/components/DateInput/DateInputKeyboardActions.js.flow b/packages/retail-ui/components/DateInput/DateInputKeyboardActions.js.flow new file mode 100644 index 00000000000..8b957b1ac92 --- /dev/null +++ b/packages/retail-ui/components/DateInput/DateInputKeyboardActions.js.flow @@ -0,0 +1,17 @@ +/* @flow */ + +declare export var Actions: {| + Unknown: number, + Ignore: number, + MoveSelectionLeft: number, + MoveSelectionRight: number, + Decrement: number, + Increment: number, + FullSelection: number, + ClearSelection: number, + Digit: number, + Separator: number, + WrongInput: number, +|}; + +declare export var extractAction: (x0: SyntheticKeyboardEvent) => number | {}; diff --git a/packages/retail-ui/components/DateInput/DatePart.js.flow b/packages/retail-ui/components/DateInput/DatePart.js.flow new file mode 100644 index 00000000000..bd2568e90dd --- /dev/null +++ b/packages/retail-ui/components/DateInput/DatePart.js.flow @@ -0,0 +1,10 @@ +/* @flow */ + +export type DatePartProps = {| + selected?: boolean, + children?: React$Node, + onDoubleClick?: (event: SyntheticMouseEvent) => void, + onMouseDown?: (event: SyntheticMouseEvent) => void, +|}; + +declare export class DatePart extends React$Component {} diff --git a/packages/retail-ui/components/DateInput/MaskedValue.js.flow b/packages/retail-ui/components/DateInput/MaskedValue.js.flow new file mode 100644 index 00000000000..7a86ad2a764 --- /dev/null +++ b/packages/retail-ui/components/DateInput/MaskedValue.js.flow @@ -0,0 +1,9 @@ +/* @flow */ + +type MaskedValueProps = {| + value: string | null, + length: number, +|}; + +// eslint-disable-next-line flowtype/no-weak-types +declare export var MaskedValue: (props: MaskedValueProps) => React$Element; diff --git a/packages/retail-ui/components/DateInput/SelectionHelpers.js.flow b/packages/retail-ui/components/DateInput/SelectionHelpers.js.flow new file mode 100644 index 00000000000..03e4e8ddfac --- /dev/null +++ b/packages/retail-ui/components/DateInput/SelectionHelpers.js.flow @@ -0,0 +1,3 @@ +/* @flow */ +declare export var selectNodeContents: (node: HTMLElement) => void; +declare export var removeAllSelections: () => void; diff --git a/packages/retail-ui/components/DateInput/index.js.flow b/packages/retail-ui/components/DateInput/index.js.flow new file mode 100644 index 00000000000..7ed05c5356d --- /dev/null +++ b/packages/retail-ui/components/DateInput/index.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +export { default, DateInputProps, DateInputState } from './DateInput'; diff --git a/packages/retail-ui/components/DatePicker/DatePicker.js.flow b/packages/retail-ui/components/DatePicker/DatePicker.js.flow new file mode 100644 index 00000000000..fb3358a3077 --- /dev/null +++ b/packages/retail-ui/components/DatePicker/DatePicker.js.flow @@ -0,0 +1,45 @@ +/* @flow */ + +export type DatePickerProps = {| + autoFocus?: boolean, + disabled?: boolean, + enableTodayLink?: boolean, + error?: boolean, + minDate?: T, + maxDate?: T, + menuAlign?: 'left' | 'right', + size?: 'small' | 'medium' | 'large', + value: T | null, + warning?: boolean, + width?: number | string, + onBlur?: () => void, + onChange: (e: {| + target: {| + value: T, + |}, + |}, v: T) => void, + onFocus?: () => void, + /* eslint-disable flowtype/no-weak-types */ + onKeyDown?: (e: SyntheticKeyboardEvent) => void, + onMouseEnter?: (e: SyntheticMouseEvent) => void, + onMouseLeave?: (e: SyntheticMouseEvent) => void, + onMouseOver?: (e: SyntheticMouseEvent) => void, + /* eslint-enable flowtype/no-weak-types */ + isHoliday?: (day: T, isWeekend: boolean) => boolean, +|}; + +export type DatePickerState = {| + opened: boolean, +|}; + +declare type DatePickerValue = string; + +declare class DatePicker extends React$Component, DatePickerState> { + static validate: (value: string | null | void) => boolean, + + blur(): void, + focus(): void, + close(): void, +} + +export default DatePicker; diff --git a/packages/retail-ui/components/DatePicker/DatePickerHelpers.js.flow b/packages/retail-ui/components/DatePicker/DatePickerHelpers.js.flow new file mode 100644 index 00000000000..141fb3e9570 --- /dev/null +++ b/packages/retail-ui/components/DatePicker/DatePickerHelpers.js.flow @@ -0,0 +1,7 @@ +/* @flow */ +import type { CalendarDateShape } from '../Calendar'; +import type { DateShape } from './DateShape'; + +declare export function formatDate(props: CalendarDateShape): string; + +declare export function parseDateString(value: string): DateShape; diff --git a/packages/retail-ui/components/DatePicker/DateShape.js.flow b/packages/retail-ui/components/DatePicker/DateShape.js.flow new file mode 100644 index 00000000000..ff6a4575465 --- /dev/null +++ b/packages/retail-ui/components/DatePicker/DateShape.js.flow @@ -0,0 +1,11 @@ +/* @flow */ +import type { CalendarDateShape } from '../Calendar'; + +export type DateShape = {| + date: ?number, + month: ?number, + year: ?number, +|}; + +declare export function isValidDate(props: DateShape): boolean; +declare export function tryGetValidDateShape(x: DateShape): CalendarDateShape | null; diff --git a/packages/retail-ui/components/DatePicker/Picker.js.flow b/packages/retail-ui/components/DatePicker/Picker.js.flow new file mode 100644 index 00000000000..e0b0c4237dd --- /dev/null +++ b/packages/retail-ui/components/DatePicker/Picker.js.flow @@ -0,0 +1,23 @@ +/* @flow */ +import type { CalendarDateShape } from '../Calendar'; + +type Props = {| + maxDate?: CalendarDateShape, + minDate?: CalendarDateShape, + value: ?CalendarDateShape, + onPick: (date: CalendarDateShape) => void, + onSelect?: (date: CalendarDateShape) => void, + enableTodayLink?: boolean, + isHoliday?: (day: CalendarDateShape & {| + isWeekend: boolean, + |}) => boolean, +|}; + +type State = {| + date: CalendarDateShape, + today: CalendarDateShape, +|}; + +declare class Picker extends React$Component {} + +export default Picker; diff --git a/packages/retail-ui/components/DatePicker/index.js.flow b/packages/retail-ui/components/DatePicker/index.js.flow new file mode 100644 index 00000000000..ffea9c59484 --- /dev/null +++ b/packages/retail-ui/components/DatePicker/index.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +export { default, DatePickerProps, DatePickerState } from './DatePicker'; diff --git a/packages/retail-ui/components/Fias/Fias.js.flow b/packages/retail-ui/components/Fias/Fias.js.flow new file mode 100644 index 00000000000..dab2810e852 --- /dev/null +++ b/packages/retail-ui/components/Fias/Fias.js.flow @@ -0,0 +1,36 @@ +/* @flow */ +import type { FiasValue, FormValidation, FiasLocale, APIProvider } from './types'; +import { Address } from './models/Address'; + +export type FiasProps = {| + value?: FiasValue, + error?: boolean, + warning?: boolean, + feedback?: string, + showAddressText?: boolean, + label?: string, + // eslint-disable-next-line flowtype/no-weak-types + icon?: React$Element, + readonly?: boolean, + baseUrl?: string, + api?: APIProvider, + onInit?: (value: FiasValue) => void, + onChange?: (value: FiasValue) => void, + onClose?: () => void, + search?: boolean, + limit?: number, + locale?: FiasLocale, + formValidation?: FormValidation, + allowNotVerified?: boolean, + version?: string, +|}; + +export type FiasState = {| + opened: boolean, + address: Address, + locale: FiasLocale, +|}; + +declare export class Fias extends React$Component {} + +export default Fias; diff --git a/packages/retail-ui/components/Fias/FiasModal.js.flow b/packages/retail-ui/components/Fias/FiasModal.js.flow new file mode 100644 index 00000000000..7413c1a30ae --- /dev/null +++ b/packages/retail-ui/components/Fias/FiasModal.js.flow @@ -0,0 +1,14 @@ +/* @flow */ +import type { FiasLocale } from './types'; + +type FiasModalProps = {| + locale: FiasLocale, + /* eslint-disable flowtype/no-weak-types */ + onClose?: () => any, + onSave?: () => any, + /* eslint-enable flowtype/no-weak-types */ +|}; + +declare export class FiasModal extends React$Component {} + +export default FiasModal; diff --git a/packages/retail-ui/components/Fias/Form/FiasComboBox.js.flow b/packages/retail-ui/components/Fias/Form/FiasComboBox.js.flow new file mode 100644 index 00000000000..828e9d3a958 --- /dev/null +++ b/packages/retail-ui/components/Fias/Form/FiasComboBox.js.flow @@ -0,0 +1,25 @@ +/* @flow */ +import type { ComboBoxProps } from '../../ComboBox'; +import type { Address } from '../models/Address'; + +export type FiasComboBoxProps = {| + ...$Exact>, + limit?: number, +|}; + +export type FiasComboBoxChangeEvent = {| + target: {| + value: Address, + |}, +|}; + +type FiasComboBoxState = {| + searchText: string, + totalCount: number, +|}; + +declare export class FiasComboBox extends React$Component { + +hasItems: boolean, +} + +export default FiasComboBox; diff --git a/packages/retail-ui/components/Fias/Form/FiasForm.js.flow b/packages/retail-ui/components/Fias/Form/FiasForm.js.flow new file mode 100644 index 00000000000..b8718a77461 --- /dev/null +++ b/packages/retail-ui/components/Fias/Form/FiasForm.js.flow @@ -0,0 +1,22 @@ +/* @flow */ +import type { FormValidation, FiasLocale, APIProvider } from '../types'; +import type { Address } from '../models/Address'; + +type FiasFormProps = {| + api: APIProvider, + address: Address, + locale: FiasLocale, + search?: boolean, + limit?: number, + validationLevel?: FormValidation, +|}; + +type FiasFormState = {| + address: Address, +|}; + +declare export class FiasForm extends React$Component { + submit: () => Promise
, +} + +export default FiasForm; diff --git a/packages/retail-ui/components/Fias/Form/FiasSearch.js.flow b/packages/retail-ui/components/Fias/Form/FiasSearch.js.flow new file mode 100644 index 00000000000..f90990f7eee --- /dev/null +++ b/packages/retail-ui/components/Fias/Form/FiasSearch.js.flow @@ -0,0 +1,15 @@ +/* @flow */ +import type { Address } from '../models/Address'; +import type { FiasLocale } from '../types'; + +type FiasSearchProps = {| + source: (query: string) => Promise, + address: Address, + onChange: (value: Address) => void, + limit?: number, + locale?: FiasLocale, +|}; + +declare export class FiasSearch extends React$Component {} + +export default FiasSearch; diff --git a/packages/retail-ui/components/Fias/api/APIResultFactory.js.flow b/packages/retail-ui/components/Fias/api/APIResultFactory.js.flow new file mode 100644 index 00000000000..2c4bee523f1 --- /dev/null +++ b/packages/retail-ui/components/Fias/api/APIResultFactory.js.flow @@ -0,0 +1,7 @@ +/* @flow */ +import type { APIResult } from '../types'; + +declare export class APIResultFactory { + static success: (data: Data) => APIResult, + static fail: (message?: string) => APIResult, +} diff --git a/packages/retail-ui/components/Fias/api/FiasAPI.js.flow b/packages/retail-ui/components/Fias/api/FiasAPI.js.flow new file mode 100644 index 00000000000..57eb8fd164f --- /dev/null +++ b/packages/retail-ui/components/Fias/api/FiasAPI.js.flow @@ -0,0 +1,13 @@ +/* @flow */ +import type { AddressValue, AddressResponse, SearchOptions, APIResult } from '../types'; + +declare export class FiasAPI { + verify: (address: AddressValue) => Promise>, + search: (props: SearchOptions) => Promise>, +} + +export default FiasAPI; diff --git a/packages/retail-ui/components/Fias/api/MockAPI.js.flow b/packages/retail-ui/components/Fias/api/MockAPI.js.flow new file mode 100644 index 00000000000..a83c5bdd663 --- /dev/null +++ b/packages/retail-ui/components/Fias/api/MockAPI.js.flow @@ -0,0 +1,13 @@ +/* @flow */ +import type { AddressValue, AddressResponse, SearchOptions, APIResult } from '../types'; + +declare export class MockAPI { + verify: (address: AddressValue) => Promise>, + search: (props: SearchOptions) => Promise>, +} + +export default MockAPI; diff --git a/packages/retail-ui/components/Fias/constants/abbreviations.js.flow b/packages/retail-ui/components/Fias/constants/abbreviations.js.flow new file mode 100644 index 00000000000..815096ee9ea --- /dev/null +++ b/packages/retail-ui/components/Fias/constants/abbreviations.js.flow @@ -0,0 +1,7 @@ +/* @flow */ + +declare export var abbreviations: { + [key: string]: string, +}; + +export default abbreviations; diff --git a/packages/retail-ui/components/Fias/constants/locale.js.flow b/packages/retail-ui/components/Fias/constants/locale.js.flow new file mode 100644 index 00000000000..a240978a035 --- /dev/null +++ b/packages/retail-ui/components/Fias/constants/locale.js.flow @@ -0,0 +1,39 @@ +/* @flow */ + +declare export var defaultLocale: {| + modalTitle: string, + modalButtonOk: string, + modalButtonCancel: string, + addressFill: string, + addressEdit: string, + addressNotVerified: string, + addressNotFound: string, + addressFillParentOrSearch: string, + addressSelectItemFromList: string, + searchNotFound: string, + searchPlaceholder: string, + regionNotFound: string, + regionPlaceholder: string, + districtNotFound: string, + districtPlaceholder: string, + cityNotFound: string, + cityPlaceholder: string, + intracityareaNotFound: string, + intracityareaPlaceholder: string, + settlementNotFound: string, + settlementPlaceholder: string, + planningstructureNotFound: string, + planningstructurePlaceholder: string, + streetNotFound: string, + streetFillBefore: string, + streetPlaceholder: string, + steadNotFound: string, + steadFillBefore: string, + steadPlaceholder: string, + houseNotFound: string, + houseFillBefore: string, + housePlaceholder: string, + roomPlaceholder: string, +|}; + +export default defaultLocale; diff --git a/packages/retail-ui/components/Fias/index.js.flow b/packages/retail-ui/components/Fias/index.js.flow new file mode 100644 index 00000000000..51473cbe70c --- /dev/null +++ b/packages/retail-ui/components/Fias/index.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +export { Fias, FiasProps, FiasState, Fias as default } from './Fias'; diff --git a/packages/retail-ui/components/Fias/logger/Logger.js.flow b/packages/retail-ui/components/Fias/logger/Logger.js.flow new file mode 100644 index 00000000000..41475d9a780 --- /dev/null +++ b/packages/retail-ui/components/Fias/logger/Logger.js.flow @@ -0,0 +1,13 @@ +/* @flow */ + +declare export class Logger { + static warnings: {| + baseUrlOrApiIsRequired: string, + noBaseUrl: string, + fetchError: string, + |}, + + static log: (message: string, details?: string | void) => void, +} + +export default Logger; diff --git a/packages/retail-ui/components/Fias/models/Address.js.flow b/packages/retail-ui/components/Fias/models/Address.js.flow new file mode 100644 index 00000000000..629bff7a2f6 --- /dev/null +++ b/packages/retail-ui/components/Fias/models/Address.js.flow @@ -0,0 +1,50 @@ +/* @flow */ +import type { AddressErrors, AddressFields, AddressResponse, AddressValue, FiasValue, Fields } from '../types'; + +declare export class Address { + static ALL_FIELDS: Fields[], + static VERIFIABLE_FIELDS: Fields[], + static FULL_ADDRESS_SEARCH_FIELDS: Fields[], + static ALL_PARENTS_SEARCH_FIELDS: Fields[], + static createFromResponse: (response: AddressResponse) => Address, + static createFromAddressValue: (addressValue: AddressValue) => Address, + static verify: (address: Address, response: {| + address: AddressResponse, + isValid: boolean, + invalidLevel?: string | void, + |}[], notVerifiedMessage: string) => Address, + static getParentFields: (field: Fields) => Fields[], + + +isEmpty: boolean, + +hasErrors: boolean, + + fields: AddressFields, + errors: AddressErrors, + + hasError(field: Fields): boolean, + getError(field: Fields): string | void, + getAddressErrors: () => {| + region?: string | void, + district?: string | void, + city?: string | void, + intracityarea?: string | void, + settlement?: string | void, + planningstructure?: string | void, + street?: string | void, + stead?: string | void, + house?: string | void, + room?: string | void, + |}, + getText: (minField?: Fields | void, skipTypes?: boolean, connector?: string) => string, + isAllowedToFill: (field: ?Fields) => boolean, + isAllowedToSearchFullAddress: (field?: Fields | void) => boolean, + isAllowedToSearchThroughAllParents: (field?: Fields | void) => boolean, + hasOnlyIndirectParent: (field: ?Fields) => boolean, + getClosestParentFiasId: (field?: Fields | void) => string | void, + getFiasId: () => string, + getAddressValue: () => AddressValue, + getValue: () => FiasValue, + convertForVerification: () => {}, +} + +export default Address; diff --git a/packages/retail-ui/components/Fias/models/AddressElement.js.flow b/packages/retail-ui/components/Fias/models/AddressElement.js.flow new file mode 100644 index 00000000000..b2329a5a84c --- /dev/null +++ b/packages/retail-ui/components/Fias/models/AddressElement.js.flow @@ -0,0 +1,15 @@ +/* @flow */ +import type { Fields } from '../types'; +import type { FiasData } from './FiasData'; + +declare export class AddressElement { + type: Fields, + name: string, + data?: ?FiasData, + + +isFederalCity: boolean, + +verifiableData: $Shape, + + getText(withoutType?: boolean): string, + isTypeMatchField: (field: Fields) => boolean, +} diff --git a/packages/retail-ui/components/Fias/models/FiasData.js.flow b/packages/retail-ui/components/Fias/models/FiasData.js.flow new file mode 100644 index 00000000000..e0f2b912631 --- /dev/null +++ b/packages/retail-ui/components/Fias/models/FiasData.js.flow @@ -0,0 +1,10 @@ +/* @flow */ +import type { FiasObject } from '../types'; + +declare export class FiasData { + static isAddressObject: (data: FiasObject) => boolean, + static isStead: (data: FiasObject) => boolean, + static isHouse: (data: FiasObject) => boolean, + + data: FiasObject, +} diff --git a/packages/retail-ui/components/Fias/types.js.flow b/packages/retail-ui/components/Fias/types.js.flow new file mode 100644 index 00000000000..4440cdbcc34 --- /dev/null +++ b/packages/retail-ui/components/Fias/types.js.flow @@ -0,0 +1,122 @@ +/* @flow */ +import type { AddressElement } from './models/AddressElement'; +import { defaultLocale } from './constants/locale'; + +export type FiasId = string; + +export type FiasEntity = {| + id: string, + fiasId: FiasId, + parentFiasId?: FiasId, +|}; + +export type AddressObject = {| + ...$Exact, + name: string, + abbreviation: string, + code: string, +|}; + +export type Stead = {| + ...$Exact, + number: string, + liveStatus: LiveStatuses, +|}; + +export type House = {| + ...$Exact, + estateStatus: EstateStatuses, + structureStatus: StructureStatuses, + number?: string, + structureNumber?: string, + buildingNumber?: string, +|}; + +export type Room = {| + ...$Exact, + flatNumber: string, + flatType: number, + liveStatus: LiveStatuses, +|}; + +export type EstateStatuses = "Hold" | "House" | "HouseHold" | "None"; + +export type StructureStatuses = "Structure" | "Construction" | "Liter" | "None"; + +export type LiveStatuses = "active" | "inactive"; + +export type FiasObject = AddressObject | Stead | House | Room; + +export type Fields = "region" | "district" | "city" | "intracityarea" | "settlement" | "planningstructure" | "street" | "stead" | "house" | "room"; + +export type AddressFields = { + [key: Fields]: ?AddressElement, +}; + +export type FiasValue = {| + address?: AddressValue, + addressString?: string, + addressErrors?: AddressErrors, + fiasId?: FiasId, +|}; + +export type AddressValue = {| + [key: Fields]: void | {| + name: string, + data?: FiasObject, + |}, +|}; + +export type AddressResponse = {| + [key: Fields]: void | FiasObject, +|}; + +export type SearchResponse = AddressResponse[]; + +export type VerifyResponse = Array<{| + address: AddressResponse, + isValid: boolean, + invalidLevel?: string, +|}>; + +export type AddressErrors = { + [key: Fields]: void | string, +}; + +export type FormValidation = 'Error' | 'Warning' | 'None'; + +export type FiasLocale = typeof defaultLocale; + +export type SearchOptions = {| + fiasId?: FiasId, + searchText?: string, + field?: Fields, + parentFiasId?: FiasId, + limit?: number, + fullAddress?: boolean, + directParent?: boolean, +|}; + +export type APIProvider = {| + search: (options: SearchOptions) => Promise>, + verify: (address: AddressValue) => Promise>, +|}; + +export type APIResult = {| + success: boolean, + data?: Data, + error?: Error, +|}; + +export type FetchFn = (uri: string, options: {| + method?: 'GET' | 'POST', + body?: string, +|}) => Promise; + +export type FetchResponse = {| + ok: boolean, + status: number, + statusText: string, + // eslint-disable-next-line flowtype/no-weak-types + json: () => Promise, +|}; diff --git a/packages/retail-ui/components/Modal/Modal.adapter.js.flow b/packages/retail-ui/components/Modal/Modal.adapter.js.flow new file mode 100644 index 00000000000..d8738b8e646 --- /dev/null +++ b/packages/retail-ui/components/Modal/Modal.adapter.js.flow @@ -0,0 +1,4 @@ +/* @flow */ +import Modal from './Modal.js'; + +export default Modal; diff --git a/packages/retail-ui/components/Modal/Modal.js.flow b/packages/retail-ui/components/Modal/Modal.js.flow new file mode 100644 index 00000000000..756e387dac4 --- /dev/null +++ b/packages/retail-ui/components/Modal/Modal.js.flow @@ -0,0 +1,29 @@ +/* @flow */ +import * as CSS from 'csstype'; + +import { Header } from './ModalHeader'; +import { Body } from './ModalBody'; +import { Footer } from './ModalFooter'; + +export type ModalProps = {| + disableClose?: boolean, + alignTop?: boolean, + ignoreBackgroundClick?: boolean, + noClose?: boolean, + width?: number | string, + onClose?: () => void, +|}; + +export type ModalState = {| + stackPosition: number, + horizontalScroll: boolean, + clickTrapHeight?: CSS.HeightProperty, +|}; + +declare class Modal extends React$Component { + static Header: typeof Header, + static Body: typeof Body, + static Footer: typeof Footer, +} + +export default Modal; diff --git a/packages/retail-ui/components/Modal/ModalBody.js.flow b/packages/retail-ui/components/Modal/ModalBody.js.flow new file mode 100644 index 00000000000..67e9415f119 --- /dev/null +++ b/packages/retail-ui/components/Modal/ModalBody.js.flow @@ -0,0 +1,3 @@ +/* @flow */ + +declare export class Body extends React$Component<{}> {} diff --git a/packages/retail-ui/components/Modal/ModalClose.js.flow b/packages/retail-ui/components/Modal/ModalClose.js.flow new file mode 100644 index 00000000000..c7ed93aba99 --- /dev/null +++ b/packages/retail-ui/components/Modal/ModalClose.js.flow @@ -0,0 +1,6 @@ +/* @flow */ +import type { CloseProps } from './ModalContext'; + +declare var Close: (props: CloseProps) => React$Node; + +export default Close; diff --git a/packages/retail-ui/components/Modal/ModalContext.js.flow b/packages/retail-ui/components/Modal/ModalContext.js.flow new file mode 100644 index 00000000000..48147e9fd56 --- /dev/null +++ b/packages/retail-ui/components/Modal/ModalContext.js.flow @@ -0,0 +1,26 @@ +/* @flow */ + +export type CloseProps = {| + disableClose?: boolean, + requestClose: () => void, +|}; + +export type ModalContextProps = {| + additionalPadding?: boolean, + hasHeader?: boolean, + close?: CloseProps, + horizontalScroll?: boolean, +|}; + +declare export var ModalContext: {| + Provider: React$ComponentType<{| + value: ModalContextProps, + children: React$Node, + // eslint-disable-next-line flowtype/no-weak-types + |}, any>, + Consumer: React$ComponentType<{| + children: ((value: ModalContextProps) => React$Node) | [(value: ModalContextProps) => React$Node], + observedBits?: number | void, + // eslint-disable-next-line flowtype/no-weak-types + |}, any>, +|}; diff --git a/packages/retail-ui/components/Modal/ModalFooter.js.flow b/packages/retail-ui/components/Modal/ModalFooter.js.flow new file mode 100644 index 00000000000..904b01edd8b --- /dev/null +++ b/packages/retail-ui/components/Modal/ModalFooter.js.flow @@ -0,0 +1,10 @@ +/* @flow */ + +export type FooterProps = {| + panel?: boolean, + sticky?: boolean, +|}; + +declare export function isFooter(child: React$Node): boolean; + +declare export class Footer extends React$Component {} diff --git a/packages/retail-ui/components/Modal/ModalHeader.js.flow b/packages/retail-ui/components/Modal/ModalHeader.js.flow new file mode 100644 index 00000000000..854cc13c49c --- /dev/null +++ b/packages/retail-ui/components/Modal/ModalHeader.js.flow @@ -0,0 +1,10 @@ +/* @flow */ + +export type HeaderProps = {| + close?: boolean, + sticky?: boolean, +|}; + +declare export function isHeader(child: React$Node): boolean; + +declare export class Header extends React$Component {} diff --git a/packages/retail-ui/components/Modal/index.js.flow b/packages/retail-ui/components/Modal/index.js.flow new file mode 100644 index 00000000000..3bfe2c472b7 --- /dev/null +++ b/packages/retail-ui/components/Modal/index.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +export { default, ModalProps, ModalState } from './Modal'; diff --git a/packages/retail-ui/components/ModalStack/ModalStack.js.flow b/packages/retail-ui/components/ModalStack/ModalStack.js.flow new file mode 100644 index 00000000000..bc68958ef67 --- /dev/null +++ b/packages/retail-ui/components/ModalStack/ModalStack.js.flow @@ -0,0 +1,10 @@ +/* @flow */ + +declare class ModalStack { + // eslint-disable-next-line flowtype/no-weak-types + static add(component: React$Component, onChange: (stack: $ReadOnlyArray>) => void): any, + // eslint-disable-next-line flowtype/no-weak-types + static remove(component: React$Component): void, +} + +export default ModalStack; diff --git a/packages/retail-ui/components/ModalStack/index.js.flow b/packages/retail-ui/components/ModalStack/index.js.flow new file mode 100644 index 00000000000..d8a2e48334e --- /dev/null +++ b/packages/retail-ui/components/ModalStack/index.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +export { default } from './ModalStack'; diff --git a/packages/retail-ui/components/Paging/NavigationHelper.js.flow b/packages/retail-ui/components/Paging/NavigationHelper.js.flow new file mode 100644 index 00000000000..cecd35d09ce --- /dev/null +++ b/packages/retail-ui/components/Paging/NavigationHelper.js.flow @@ -0,0 +1,13 @@ +/* @flow */ + +export type KeyDescriptionType = {| + name: string, + checkPressed: (event: SyntheticKeyboardEvent | KeyboardEvent) => boolean, +|}; + +declare var _default: {| + getKeyName(): string, + checkKeyPressed(event: SyntheticKeyboardEvent | KeyboardEvent): boolean, +|}; + +export default _default; diff --git a/packages/retail-ui/components/Paging/Paging.js.flow b/packages/retail-ui/components/Paging/Paging.js.flow new file mode 100644 index 00000000000..26ec4baa3de --- /dev/null +++ b/packages/retail-ui/components/Paging/Paging.js.flow @@ -0,0 +1,38 @@ +/* @flow */ + +type ItemComponentProps = {| + active: boolean, + children?: React$Node, + className: string, + onClick: () => void, + pageNumber: number | 'forward', + tabIndex: number, +|}; + +export type PagingProps = {| + activePage: number, + component?: React$ComponentType, + onPageChange: (pageNumber: number) => void, + pagesCount: number, + disabled?: boolean, + strings?: {| + forward: string, + |}, + withoutNavigationHint?: boolean, + caption?: string, + useGlobalListener?: boolean, +|}; + +export type PagingState = {| + focusedByTab: boolean, + focusedItem: ?ItemType, + keyboardControl: boolean, +|}; + +export type ItemType = number | '.' | 'forward'; + +declare class Paging extends React$Component { + static isForward(pageNumber: number | 'forward'): boolean, +} + +export default Paging; diff --git a/packages/retail-ui/components/Paging/PagingHelper.js.flow b/packages/retail-ui/components/Paging/PagingHelper.js.flow new file mode 100644 index 00000000000..5d674e6c753 --- /dev/null +++ b/packages/retail-ui/components/Paging/PagingHelper.js.flow @@ -0,0 +1,10 @@ +/* @flow */ +import type { ItemType } from './Paging'; + +declare function getItems(active: number, total: number): ItemType[]; + +declare var _default: {| + getItems: typeof getItems, +|}; + +export default _default; diff --git a/packages/retail-ui/components/Paging/index.js.flow b/packages/retail-ui/components/Paging/index.js.flow new file mode 100644 index 00000000000..2aeddcb431d --- /dev/null +++ b/packages/retail-ui/components/Paging/index.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +export { default, PagingProps, PagingState } from './Paging.js'; diff --git a/packages/retail-ui/components/PasswordInput/PasswordInput.js.flow b/packages/retail-ui/components/PasswordInput/PasswordInput.js.flow new file mode 100644 index 00000000000..885d1c8be5c --- /dev/null +++ b/packages/retail-ui/components/PasswordInput/PasswordInput.js.flow @@ -0,0 +1,26 @@ +/* @flow */ +import type { InputProps as BaseInputProps } from '../Input/Input'; + +export type PasswordInputProps = {| + ...$Exact, + detectCapsLock?: boolean, +|}; + +export type PasswordInputState = {| + visible: boolean, + capsLockEnabled?: boolean | null, +|}; + +export type InputProps = {| + ...$Exact, + onKeyDown: (event: SyntheticKeyboardEvent) => void, + onKeyPress: (event: SyntheticKeyboardEvent) => void, + rightIcon: () => React$Node, +|}; + + +declare class PasswordInput extends React$Component { + focus: () => void, +} + +export default PasswordInput; diff --git a/packages/retail-ui/components/PasswordInput/PasswordInputFallback.js.flow b/packages/retail-ui/components/PasswordInput/PasswordInputFallback.js.flow new file mode 100644 index 00000000000..615a7672adc --- /dev/null +++ b/packages/retail-ui/components/PasswordInput/PasswordInputFallback.js.flow @@ -0,0 +1,13 @@ +/* @flow */ +import Input, { type InputProps } from '../Input'; + +export type PasswordInputFallbackProps = {| + ...$Exact, + visible?: boolean, + size?: string, + refInput: (element: Input) => void, +|}; + +declare class PasswordInputFallback extends React$Component {} + +export default PasswordInputFallback; diff --git a/packages/retail-ui/components/PasswordInput/getCharHelper.js.flow b/packages/retail-ui/components/PasswordInput/getCharHelper.js.flow new file mode 100644 index 00000000000..9b7e8a69ebf --- /dev/null +++ b/packages/retail-ui/components/PasswordInput/getCharHelper.js.flow @@ -0,0 +1,4 @@ +/* @flow */ +declare function getCharHelper(e: SyntheticKeyboardEvent): string | null; + +export default getCharHelper; diff --git a/packages/retail-ui/components/PasswordInput/index.js.flow b/packages/retail-ui/components/PasswordInput/index.js.flow new file mode 100644 index 00000000000..31476b162d8 --- /dev/null +++ b/packages/retail-ui/components/PasswordInput/index.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +export { default, PasswordInputProps, PasswordInputState } from './PasswordInput'; diff --git a/packages/retail-ui/components/Radio/Radio.js.flow b/packages/retail-ui/components/Radio/Radio.js.flow new file mode 100644 index 00000000000..9dbd64aefa7 --- /dev/null +++ b/packages/retail-ui/components/Radio/Radio.js.flow @@ -0,0 +1,33 @@ +/* @flow */ + +export type SyntheticRadioEvent = {| + target: {| + id: ?string, + name: ?string, + checked: ?boolean, + disabled: ?boolean, + value: T, + |}, +|}; + +export type RadioProps = { + error?: boolean, + warning?: boolean, + focused?: boolean, + pressed?: boolean, + hovered?: boolean, + active?: boolean, + onChange?: (event: SyntheticRadioEvent, value: T) => void, + onMouseEnter?: (event: SyntheticRadioEvent) => void, + onMouseLeave?: (event: SyntheticRadioEvent) => void, + onMouseOver?: (event: SyntheticRadioEvent) => void, + value: T, +}; + + +declare class Radio extends React$Component> { + focus(): void, + blur(): void, +} + +export default Radio; diff --git a/packages/retail-ui/components/Radio/index.js.flow b/packages/retail-ui/components/Radio/index.js.flow new file mode 100644 index 00000000000..3ddf8dfa67e --- /dev/null +++ b/packages/retail-ui/components/Radio/index.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +export { default, RadioProps, SyntheticRadioEvent } from './Radio'; diff --git a/packages/retail-ui/components/RadioGroup/Prevent.js.flow b/packages/retail-ui/components/RadioGroup/Prevent.js.flow new file mode 100644 index 00000000000..69aff63e0c9 --- /dev/null +++ b/packages/retail-ui/components/RadioGroup/Prevent.js.flow @@ -0,0 +1,9 @@ +/* @flow */ + +export type PreventProps = {| + children?: React$Node, +|}; + +declare class Prevent extends React$Component {} + +export default Prevent; diff --git a/packages/retail-ui/components/RadioGroup/RadioGroup.adapter.js.flow b/packages/retail-ui/components/RadioGroup/RadioGroup.adapter.js.flow new file mode 100644 index 00000000000..efc3c8d612f --- /dev/null +++ b/packages/retail-ui/components/RadioGroup/RadioGroup.adapter.js.flow @@ -0,0 +1,4 @@ +/* @flow */ +import RadioGroup from './RadioGroup.js'; + +export default RadioGroup; diff --git a/packages/retail-ui/components/RadioGroup/RadioGroup.js.flow b/packages/retail-ui/components/RadioGroup/RadioGroup.js.flow new file mode 100644 index 00000000000..004d139fe4a --- /dev/null +++ b/packages/retail-ui/components/RadioGroup/RadioGroup.js.flow @@ -0,0 +1,41 @@ +/* @flow */ +import * as CSS from 'csstype'; + +import Prevent from './Prevent'; +import type { SyntheticRadioEvent } from '../Radio'; + +export type ItemType = T | [T, React$Node]; + +export type RadioGroupProps = {| + defaultValue?: T, + value?: T, + items?: Array>, + name?: string, + disabled?: boolean, + warning?: boolean, + error?: boolean, + inline?: boolean, + width?: CSS.WidthProperty, + renderItem?: (itemValue: T, data: React$Node) => React$Node, + /* eslint-disable flowtype/no-weak-types */ + onChange?: (event: SyntheticRadioEvent, value: T) => any, + onMouseLeave?: () => any, + onMouseOver?: () => any, + onMouseEnter?: () => any, + /* eslint-enable flowtype/no-weak-types */ +|}; + +export type RadioGroupState = {| + activeItem?: T, +|}; + +declare class RadioGroup extends React$Component, RadioGroupState> { + static Prevent: typeof Prevent, + + focus(): void, +} + +export default RadioGroup; + +// eslint-disable-next-line flowtype/no-weak-types +declare function renderItem(_value: any, data: React$Node): React$Node; diff --git a/packages/retail-ui/components/RadioGroup/index.js.flow b/packages/retail-ui/components/RadioGroup/index.js.flow new file mode 100644 index 00000000000..47a82fd3066 --- /dev/null +++ b/packages/retail-ui/components/RadioGroup/index.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +export { default, RadioGroupProps, RadioGroupState, ItemType } from './RadioGroup'; diff --git a/packages/retail-ui/components/RenderLayer/RenderLayer.js.flow b/packages/retail-ui/components/RenderLayer/RenderLayer.js.flow new file mode 100644 index 00000000000..d717c9e5c02 --- /dev/null +++ b/packages/retail-ui/components/RenderLayer/RenderLayer.js.flow @@ -0,0 +1,12 @@ +/* @flow */ + +export type RenderLayerProps = {| + children: React$Node, + onClickOutside?: (e: Event) => void, + onFocusOutside?: (e: Event) => void, + active?: boolean, +|}; + +declare class RenderLayer extends React$Component {} + +export default RenderLayer; diff --git a/packages/retail-ui/components/RenderLayer/index.js.flow b/packages/retail-ui/components/RenderLayer/index.js.flow new file mode 100644 index 00000000000..6b03b5abbac --- /dev/null +++ b/packages/retail-ui/components/RenderLayer/index.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +export { default, RenderLayerProps } from './RenderLayer'; diff --git a/packages/retail-ui/components/ScrollContainer/ScrollContainer.js.flow b/packages/retail-ui/components/ScrollContainer/ScrollContainer.js.flow new file mode 100644 index 00000000000..bdd867e2252 --- /dev/null +++ b/packages/retail-ui/components/ScrollContainer/ScrollContainer.js.flow @@ -0,0 +1,24 @@ +/* @flow */ +import * as CSS from 'csstype'; + +export type ScrollContainerProps = {| + invert?: boolean, + maxHeight?: CSS.MaxHeightProperty, + preventWindowScroll?: boolean, +|}; + +export type ScrollContainerState = {| + scrollActive: boolean, + hover: boolean, + scrolling: boolean, + scrollSize: number, + scrollPos: number, +|}; + +declare class ScrollContainer extends React$Component { + scrollTo(element: HTMLElement): void, + scrollToTop(): void, + scrollToBottom(): void, +} + +export default ScrollContainer; diff --git a/packages/retail-ui/components/ScrollContainer/index.js.flow b/packages/retail-ui/components/ScrollContainer/index.js.flow new file mode 100644 index 00000000000..9b00a78b00f --- /dev/null +++ b/packages/retail-ui/components/ScrollContainer/index.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +export { default, ScrollContainerProps, ScrollContainerState } from './ScrollContainer'; diff --git a/packages/retail-ui/components/Select/Item.js.flow b/packages/retail-ui/components/Select/Item.js.flow new file mode 100644 index 00000000000..760cdd6dcfa --- /dev/null +++ b/packages/retail-ui/components/Select/Item.js.flow @@ -0,0 +1,7 @@ +/* @flow */ + +declare class Item extends React$Component<{| + children?: React$Node, +|}> {} + +export default Item; diff --git a/packages/retail-ui/components/Select/Select.adapter.js.flow b/packages/retail-ui/components/Select/Select.adapter.js.flow new file mode 100644 index 00000000000..949de5f5cdd --- /dev/null +++ b/packages/retail-ui/components/Select/Select.adapter.js.flow @@ -0,0 +1,4 @@ +/* @flow */ +import Select from './Select.js'; + +export default Select; diff --git a/packages/retail-ui/components/Select/Select.js.flow b/packages/retail-ui/components/Select/Select.js.flow new file mode 100644 index 00000000000..910b9cfd1b5 --- /dev/null +++ b/packages/retail-ui/components/Select/Select.js.flow @@ -0,0 +1,81 @@ +/* @flow */ +import * as CSS from 'csstype'; + +import Item from './Item'; +import type { FocusEventHandler } from '../eventHandlers'; +import type { ButtonUse, ButtonSize } from '../Button/Button'; + +export type ButtonParams = {| + disabled?: boolean, + label: React$Node, + onClick: () => void, + onKeyDown: (event: SyntheticKeyboardEvent) => void, + opened: boolean, + isPlaceholder: boolean, +|}; + +export type SelectProps = {| + // eslint-disable-next-line flowtype/no-weak-types + _icon?: React$Element, + _renderButton?: (params: ButtonParams) => React$Node, + defaultValue?: TValue, + // eslint-disable-next-line flowtype/no-weak-types + diadocLinkIcon?: React$Element, + disablePortal?: boolean, + disabled?: boolean, + error?: boolean, + filterItem?: (value: TValue, item: TItem, pattern: string) => boolean, + // eslint-disable-next-line flowtype/no-weak-types + items?: Array<[TValue, TItem] | TItem | React$Element | (() => React$Element)>, + maxMenuHeight?: number, + maxWidth?: CSS.MaxWidthProperty, + menuAlign?: 'left' | 'right', + menuWidth?: CSS.WidthProperty, + onChange?: (e: {| + target: {| + value: TValue, + |}, + |}, value: TValue) => void, + onClose?: () => void, + onMouseEnter?: (e: SyntheticMouseEvent) => void, + onMouseLeave?: (e: SyntheticMouseEvent) => void, + onMouseOver?: (e: SyntheticMouseEvent) => void, + onOpen?: () => void, + placeholder?: React$Node, + renderItem?: (value: TValue, item?: TItem) => React$Node, + renderValue?: (value: TValue, item?: TItem) => React$Node, + areValuesEqual?: (value1: TValue, value2: TValue) => boolean, + search?: boolean, + value?: TValue, + width?: number | string, + warning?: boolean, + use?: ButtonUse, + size?: ButtonSize, + onFocus?: FocusEventHandler, + onBlur?: FocusEventHandler, +|}; + +export type SelectState = {| + opened: boolean, + searchPattern?: string, + value: ?TValue, +|}; + +declare class Select extends React$Component, SelectState> { + static Item: typeof Item, + static SEP: () => React$Node, + // eslint-disable-next-line flowtype/no-weak-types + static static: (element: string | number | boolean | {} | React$Element | React$Node | React$Portal | (() => React$Node) | null | void) => {} | null | void, + open: () => void, + close: () => void, + focus(): void, +} + +/* eslint-disable flowtype/no-weak-types */ +declare function renderValue(value: any, item: any): any; +declare function renderItem(value: any, item: any): any; +declare function areValuesEqual(value1: any, value2: any): boolean; +declare function filterItem(value: any, item: any, pattern: string): boolean; +/* eslint-enable flowtype/no-weak-types */ + +export default Select; diff --git a/packages/retail-ui/components/Select/index.js.flow b/packages/retail-ui/components/Select/index.js.flow new file mode 100644 index 00000000000..d2eb9f7282b --- /dev/null +++ b/packages/retail-ui/components/Select/index.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +export { default, SelectProps, SelectState } from './Select'; diff --git a/packages/retail-ui/components/SidePage/SidePage.js.flow b/packages/retail-ui/components/SidePage/SidePage.js.flow new file mode 100644 index 00000000000..120720c3852 --- /dev/null +++ b/packages/retail-ui/components/SidePage/SidePage.js.flow @@ -0,0 +1,33 @@ +/* @flow */ +import SidePageContainer from './SidePageContainer'; +import SidePageHeader from './SidePageHeader'; +import SidePageBody from './SidePageBody'; +import SidePageFooter from './SidePageFooter'; + +export type SidePageProps = {| + blockBackground?: boolean, + disableClose?: boolean, + ignoreBackgroundClick?: boolean, + width?: number, + onClose?: () => void, + fromLeft?: boolean, + disableAnimations?: boolean, +|}; + +export type SidePageState = {| + stackPosition?: number, + hasMargin?: boolean, + hasShadow?: boolean, + hasBackground?: boolean, +|}; + +declare class SidePage extends React$Component { + static Header: typeof SidePageHeader, + static Body: typeof SidePageBody, + static Footer: typeof SidePageFooter, + static Container: typeof SidePageContainer, + + updateLayout: () => void, +} + +export default SidePage; diff --git a/packages/retail-ui/components/SidePage/SidePageBody.js.flow b/packages/retail-ui/components/SidePage/SidePageBody.js.flow new file mode 100644 index 00000000000..558330df5bc --- /dev/null +++ b/packages/retail-ui/components/SidePage/SidePageBody.js.flow @@ -0,0 +1,13 @@ +/* @flow */ +import type { SidePageContextType } from './SidePageContext'; + +export type SidePageBodyProps = {| + children?: React$Node, + context?: SidePageContextType, +|}; + +declare export class SidePageBody extends React$Component {} + +declare export var SidePageBodyWithContext: (props: SidePageBodyProps) => React$Node; + +export default SidePageBodyWithContext; diff --git a/packages/retail-ui/components/SidePage/SidePageContainer.js.flow b/packages/retail-ui/components/SidePage/SidePageContainer.js.flow new file mode 100644 index 00000000000..73d9f084ef8 --- /dev/null +++ b/packages/retail-ui/components/SidePage/SidePageContainer.js.flow @@ -0,0 +1,5 @@ +/* @flow */ + +declare class SidePageContainer extends React$Component<{}> {} + +export default SidePageContainer; diff --git a/packages/retail-ui/components/SidePage/SidePageContext.js.flow b/packages/retail-ui/components/SidePage/SidePageContext.js.flow new file mode 100644 index 00000000000..9ef5880766b --- /dev/null +++ b/packages/retail-ui/components/SidePage/SidePageContext.js.flow @@ -0,0 +1,26 @@ +/* @flow */ +import { SidePageFooter } from './SidePageFooter'; + +export type SidePageContextType = {| + requestClose: () => void, + width: number | string, + updateLayout: () => void, + footerRef: (ref: SidePageFooter | null) => void, +|}; + +declare export var SidePageContext: {| + Provider: React$ComponentType<{| + value: SidePageContextType, + children: React$Node, + // eslint-disable-next-line flowtype/no-weak-types + |}, any>, + Consumer: React$ComponentType<{| + children: ((value: SidePageContextType) => React$Node) | [(value: SidePageContextType) => React$Node], + observedBits?: number | void, + // eslint-disable-next-line flowtype/no-weak-types + |}, any>, +|}; + +declare export var withContext: (BaseComponent: React$ComponentType

) => (props: P) => React$Node; diff --git a/packages/retail-ui/components/SidePage/SidePageFooter.js.flow b/packages/retail-ui/components/SidePage/SidePageFooter.js.flow new file mode 100644 index 00000000000..c945d8dd359 --- /dev/null +++ b/packages/retail-ui/components/SidePage/SidePageFooter.js.flow @@ -0,0 +1,16 @@ +/* @flow */ +import type { SidePageContextType } from './SidePageContext'; + +export type SidePageFooterProps = {| + children?: React$Node | ((fixed: boolean) => React$Node), + context?: SidePageContextType, + panel?: boolean, +|}; + +declare export class SidePageFooter extends React$Component { + update: () => void, +} + +declare export var SidePageFooterWithContext: (props: SidePageFooterProps) => React$Node; + +export default SidePageFooterWithContext; diff --git a/packages/retail-ui/components/SidePage/SidePageHeader.js.flow b/packages/retail-ui/components/SidePage/SidePageHeader.js.flow new file mode 100644 index 00000000000..81d20eb661a --- /dev/null +++ b/packages/retail-ui/components/SidePage/SidePageHeader.js.flow @@ -0,0 +1,11 @@ +/* @flow */ + +export type SidePageHeaderProps = {| + children?: React$Node | ((fixed: boolean) => React$Node), +|}; + +declare class SidePageHeader extends React$Component { + renderClose(): React$Node, +} + +export default SidePageHeader; diff --git a/packages/retail-ui/components/SidePage/index.js.flow b/packages/retail-ui/components/SidePage/index.js.flow new file mode 100644 index 00000000000..b93604e65cf --- /dev/null +++ b/packages/retail-ui/components/SidePage/index.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +export { default, SidePageProps, SidePageState } from './SidePage'; diff --git a/packages/retail-ui/components/Sticky/Sticky.js.flow b/packages/retail-ui/components/Sticky/Sticky.js.flow new file mode 100644 index 00000000000..a948aec21a8 --- /dev/null +++ b/packages/retail-ui/components/Sticky/Sticky.js.flow @@ -0,0 +1,22 @@ +/* @flow */ + +export type StickyProps = {| + side: 'top' | 'bottom', + offset?: number, + getStop?: () => ?HTMLElement, + children?: React$Node | ((fixed: boolean) => React$Node), + allowChildWithMargins?: boolean, +|}; + +export type StickyState = {| + fixed: boolean, + height: number, + left: number | string, + width: number | string, + stopped: boolean, + relativeTop: number, +|}; + +declare class Sticky extends React$Component {} + +export default Sticky; diff --git a/packages/retail-ui/components/Sticky/index.js.flow b/packages/retail-ui/components/Sticky/index.js.flow new file mode 100644 index 00000000000..4d1486e8f30 --- /dev/null +++ b/packages/retail-ui/components/Sticky/index.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +export { default, StickyProps, StickyState } from './Sticky'; diff --git a/packages/retail-ui/components/Switcher/Switcher.js.flow b/packages/retail-ui/components/Switcher/Switcher.js.flow new file mode 100644 index 00000000000..6b544ef4f62 --- /dev/null +++ b/packages/retail-ui/components/Switcher/Switcher.js.flow @@ -0,0 +1,26 @@ +/* @flow */ + +export type SwitcherProps = {| + items: Array, + value?: string, + onChange?: (event: {| + target: {| + value: string, + |}, + |}, value: string) => void, + label?: string, + error?: boolean, +|}; + +export type SwitcherState = {| + focusedIndex: ?number, +|}; + +type SwitcherItem = {| + label: string, + value: string, +|}; + +declare class Switcher extends React$Component {} + +export default Switcher; diff --git a/packages/retail-ui/components/Switcher/index.js.flow b/packages/retail-ui/components/Switcher/index.js.flow new file mode 100644 index 00000000000..7d56b8d1b42 --- /dev/null +++ b/packages/retail-ui/components/Switcher/index.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +export { default, SwitcherProps, SwitcherState } from './Switcher'; diff --git a/packages/retail-ui/components/Tabs/Indicator.js.flow b/packages/retail-ui/components/Tabs/Indicator.js.flow new file mode 100644 index 00000000000..f4f36a876dc --- /dev/null +++ b/packages/retail-ui/components/Tabs/Indicator.js.flow @@ -0,0 +1,21 @@ +/* @flow */ +import * as CSS from 'csstype'; + +import Tab from './Tab'; + +export type IndicatorProps = {| + className?: string, + getAnchorNode: () => Tab | null, + tabUpdates: {| + on: (x0: () => void) => () => void, + |}, + vertical: boolean, +|}; + +export type IndicatorState = {| + styles: CSS.Properties, +|}; + +declare class Indicator extends React$Component {} + +export default Indicator; diff --git a/packages/retail-ui/components/Tabs/Tab.js.flow b/packages/retail-ui/components/Tabs/Tab.js.flow new file mode 100644 index 00000000000..ce605e15c89 --- /dev/null +++ b/packages/retail-ui/components/Tabs/Tab.js.flow @@ -0,0 +1,48 @@ +/* @flow */ +import * as CSS from 'csstype'; + +export type TabIndicators = {| + error: boolean, + warning: boolean, + success: boolean, + primary: boolean, + disabled: boolean, +|}; + +export type TabProps = {| + children?: React$Node, + // eslint-disable-next-line flowtype/no-weak-types + component?: React$ComponentType | string, + href?: string, + id?: string, + onClick?: (event: SyntheticMouseEvent) => void, + onKeyDown?: (event: SyntheticKeyboardEvent) => void, + disabled?: boolean, + error?: boolean, + warning?: boolean, + success?: boolean, + primary?: boolean, + style?: CSS.Properties, +|}; + +export type TabContext = {| + activeTab: string, + // eslint-disable-next-line flowtype/no-weak-types + addTab: (id: string, getNode: () => any) => void, + notifyUpdate: () => void, + removeTab: (id: string) => void, + shiftFocus: (fromTab: string, delta: number) => void, + switchTab: (id: string) => void, + vertical: boolean, +|}; + +export type TabState = {| + focusedByKeyboard: boolean, +|}; + +declare class Tab extends React$Component { + // eslint-disable-next-line flowtype/no-weak-types + getUnderlyingNode: () => ?React$Element, +} + +export default Tab; diff --git a/packages/retail-ui/components/Tabs/Tabs.js.flow b/packages/retail-ui/components/Tabs/Tabs.js.flow new file mode 100644 index 00000000000..e8402d9c9d8 --- /dev/null +++ b/packages/retail-ui/components/Tabs/Tabs.js.flow @@ -0,0 +1,28 @@ +/* @flow */ +import Tab from './Tab'; + +export type TabsProps = {| + children?: React$Node, + indicatorClassName?: string, + onChange?: (ev: {| + target: {| + value: string, + |}, + |}, value: string) => void, + value: string, + vertical?: boolean, + width?: number | string, +|}; + +export type TabsState = {| + tabs: Array<{| + getNode: () => Tab | null, + id: string, + |}>, +|}; + +declare class Tabs extends React$Component { + static Tab: typeof Tab, +} + +export default Tabs; diff --git a/packages/retail-ui/components/Tabs/index.js.flow b/packages/retail-ui/components/Tabs/index.js.flow new file mode 100644 index 00000000000..531da1576e6 --- /dev/null +++ b/packages/retail-ui/components/Tabs/index.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +export { default, TabsProps, TabsState } from './Tabs'; diff --git a/packages/retail-ui/components/Textarea/Textarea.adapter.js.flow b/packages/retail-ui/components/Textarea/Textarea.adapter.js.flow new file mode 100644 index 00000000000..b8cda23677f --- /dev/null +++ b/packages/retail-ui/components/Textarea/Textarea.adapter.js.flow @@ -0,0 +1,11 @@ +/* @flow */ +import Textarea from './Textarea.js'; + +declare var TextareaAdapter: {| + getValue(inst: Textarea): string | number | string[] | void, + setValue(inst: Textarea, value: string): void, +|}; + +export { TextareaAdapter }; + +export default Textarea; diff --git a/packages/retail-ui/components/Textarea/Textarea.js.flow b/packages/retail-ui/components/Textarea/Textarea.js.flow new file mode 100644 index 00000000000..e21e93b26be --- /dev/null +++ b/packages/retail-ui/components/Textarea/Textarea.js.flow @@ -0,0 +1,33 @@ +/* @flow */ +import * as CSS from 'csstype'; + +import { TextareaAdapter } from './Textarea.adapter'; + +export type TextareaProps = { + error?: boolean, + warning?: boolean, + disabled?: boolean, + autoResize?: boolean, + rows?: number, + maxRows?: string | number, + resize?: CSS.ResizeProperty, + width?: CSS.WidthProperty, + onChange?: (event: SyntheticInputEvent, value: string) => void, + selectAllOnFocus?: boolean, +}; + +export type TextareaState = {| + polyfillPlaceholder: boolean, + rows: number | string, +|}; + +declare class Textarea extends React$Component { + static __ADAPTER__: typeof TextareaAdapter, + + focus(): void, + blur(): void, + setSelectionRange: (start: number, end: number) => void, + selectAll: () => void, +} + +export default Textarea; diff --git a/packages/retail-ui/components/Textarea/TextareaHelpers.js.flow b/packages/retail-ui/components/Textarea/TextareaHelpers.js.flow new file mode 100644 index 00000000000..fe2285a434a --- /dev/null +++ b/packages/retail-ui/components/Textarea/TextareaHelpers.js.flow @@ -0,0 +1,6 @@ +/* @flow */ + +declare export function getTextAreaHeight(node: HTMLTextAreaElement, minRows: number, maxRows: number): {| + height: number, + exceededMaxHeight: boolean, +|}; diff --git a/packages/retail-ui/components/Textarea/index.js.flow b/packages/retail-ui/components/Textarea/index.js.flow new file mode 100644 index 00000000000..18b971e09cc --- /dev/null +++ b/packages/retail-ui/components/Textarea/index.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +export { default, TextareaProps, TextareaState } from './Textarea'; diff --git a/packages/retail-ui/components/Toast/Toast.js.flow b/packages/retail-ui/components/Toast/Toast.js.flow new file mode 100644 index 00000000000..a14569adaf9 --- /dev/null +++ b/packages/retail-ui/components/Toast/Toast.js.flow @@ -0,0 +1,29 @@ +/* @flow */ +import ToastView from './ToastView'; + +export type Action = {| + label: string, + handler: () => void, +|}; + +export type ToastState = {| + notification: ?string, + action: ?Action, + id: number, +|}; + +export type ToastProps = {| + onPush?: (notification: string, action?: Action) => void, + onClose?: (notification: string, action?: Action) => void, +|}; + +declare class Toast extends React$Component { + static push(notification: string, action?: Action): void, + static close(): void, + + _toast: ?ToastView, + push(notification: string, action?: Action): void, + close: () => void, +} + +export default Toast; diff --git a/packages/retail-ui/components/Toast/ToastStatic.js.flow b/packages/retail-ui/components/Toast/ToastStatic.js.flow new file mode 100644 index 00000000000..96c1cf26386 --- /dev/null +++ b/packages/retail-ui/components/Toast/ToastStatic.js.flow @@ -0,0 +1,10 @@ +/* @flow */ +import type { Action } from './Toast'; + +declare class ToastStatic { + static push: (notification: string, action?: Action | void) => void, + static _push: (notification: string, action?: Action | void) => void, + static close: () => void, +} + +export default ToastStatic; diff --git a/packages/retail-ui/components/Toast/ToastView.js.flow b/packages/retail-ui/components/Toast/ToastView.js.flow new file mode 100644 index 00000000000..7928de5d528 --- /dev/null +++ b/packages/retail-ui/components/Toast/ToastView.js.flow @@ -0,0 +1,16 @@ +/* @flow */ + +export type ToastViewProps = {| + children?: string, + action?: ?{| + label: string, + handler: () => void, + |}, + onClose?: () => void, + onMouseEnter?: () => void, + onMouseLeave?: () => void, +|}; + +declare class ToastView extends React$Component {} + +export default ToastView; diff --git a/packages/retail-ui/components/Toast/index.js.flow b/packages/retail-ui/components/Toast/index.js.flow new file mode 100644 index 00000000000..14d7b3fc6cb --- /dev/null +++ b/packages/retail-ui/components/Toast/index.js.flow @@ -0,0 +1,2 @@ +/* @flow */ +export { default, ToastProps, ToastState } from './Toast'; From 6120efb3cb699be9ee103564bf3ec718d7040d05 Mon Sep 17 00:00:00 2001 From: wKich Date: Fri, 29 Mar 2019 13:32:39 +0500 Subject: [PATCH 20/29] test(Autocomplete): refactor tests --- .../__tests__/Autocomplete-test.tsx | 55 ++++++++++--------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/packages/retail-ui/components/Autocomplete/__tests__/Autocomplete-test.tsx b/packages/retail-ui/components/Autocomplete/__tests__/Autocomplete-test.tsx index 7737b89e451..b6db6780f1e 100644 --- a/packages/retail-ui/components/Autocomplete/__tests__/Autocomplete-test.tsx +++ b/packages/retail-ui/components/Autocomplete/__tests__/Autocomplete-test.tsx @@ -1,27 +1,25 @@ // tslint:disable:jsx-no-lambda import * as React from 'react'; +import { mount } from 'enzyme'; import OkIcon from '@skbkontur/react-icons/Ok'; import Autocomplete, { AutocompleteProps } from '../Autocomplete'; -import * as Enzyme from 'enzyme'; - -const render = (props: Partial): Enzyme.ReactWrapper => - Enzyme.mount(); - -const renderUnc = (props: Partial) => - Enzyme.mount(React.createElement(UncontrolledAutocomplete, props as AutocompleteProps)); +import { Omit } from '../../../typings/utility-types'; +import { delay } from '../../../lib/utils'; describe('', () => { it('renders with given value', () => { const onChange = jest.fn(); const source: any[] = []; - const wrapper = render({ value: 'hello', onChange, source }); + const props = { value: 'hello', onChange, source }; + const wrapper = mount(); expect(wrapper.find('Input').prop('value')).toBe('hello'); }); it('triggers onChange on input change', () => { const onChange = jest.fn(); const source: any[] = []; - const wrapper = render({ value: 'hello', onChange, source }); + const props = { value: 'hello', onChange, source }; + const wrapper = mount(); wrapper.find('input').simulate('change', { target: { value: 'world' } }); const [event, value] = onChange.mock.calls[0]; expect(event.target.value).toBe('world'); @@ -31,7 +29,8 @@ describe('', () => { it('resolves sources as arrays', async () => { const onChange = jest.fn(); const source = ['One', 'Two']; - const wrapper = renderUnc({ source, onChange }); + const props = { source, onChange }; + const wrapper = mount(); wrapper.find('input').simulate('change', { target: { value: 'two' } }); await new Promise(resolve => setTimeout(resolve)); @@ -45,7 +44,8 @@ describe('', () => { it('resolves sources as promises', async () => { const onChange = jest.fn(); const source = () => Promise.resolve(['One', 'Two']); - const wrapper = renderUnc({ source, onChange }); + const props = { source, onChange }; + const wrapper = mount(); wrapper.find('input').simulate('change', { target: { value: 'two' } }); // wait for react batch updates @@ -62,7 +62,8 @@ describe('', () => { it('passes pattern to source', async () => { const onChange = jest.fn(); const source = jest.fn(() => Promise.resolve([])); - const wrapper = renderUnc({ source, onChange }); + const props = { source, onChange }; + const wrapper = mount(); wrapper.find('input').simulate('change', { target: { value: 'two' } }); // wait for react batch updates @@ -75,11 +76,8 @@ describe('', () => { it('uses renderItem prop to render items', async () => { const onChange = jest.fn(); const source = () => Promise.resolve(['One', 'Two']); - const wrapper = renderUnc({ - source, - renderItem: x => x.toUpperCase(), - onChange, - }); + const props = { source, renderItem: (x: string) => x.toUpperCase(), onChange }; + const wrapper = mount(); wrapper.find('input').simulate('change', { target: { value: 'two' } }); // wait for react batch updates @@ -94,8 +92,8 @@ describe('', () => { }); it('passes props to input', async () => { - const props: Partial = { - align: 'center', + const props = { + align: 'center' as AutocompleteProps['align'], alwaysShowMask: true, borderless: true, disabled: true, @@ -107,9 +105,9 @@ describe('', () => { maxLength: 3, placeholder: 'OOO', rightIcon: , - size: 'medium', + size: 'medium' as AutocompleteProps['size'], title: 'string', - type: 'text', + type: 'text' as AutocompleteProps['type'], value: 'hel', warning: true, width: 300, @@ -124,19 +122,18 @@ describe('', () => { onMouseOver: () => undefined, }; - const wrapper = render({ ...props, onChange: () => undefined, source: [] }); + const wrapper = mount( undefined} source={[]} />); const inputProps = wrapper.find('Input').props(); - Object.keys(props).forEach(prop => { - expect(inputProps[prop as keyof Enzyme.HTMLAttributes]).toBe(props[prop as keyof AutocompleteProps]); - }); + expect(inputProps).toMatchObject(props); }); it('handles onKeyDown prop', () => { const onChange = () => undefined; const onKeyDown = jest.fn(); const source: any[] = []; - const wrapper = render({ value: 'hello', onChange, source, onKeyDown }); + const props = { value: 'hello', onChange, source, onKeyDown }; + const wrapper = mount(); wrapper.find('input').simulate('keydown', { key: 'a' }); const [event] = onKeyDown.mock.calls[0]; expect(event.key).toBe('a'); @@ -147,7 +144,11 @@ interface UncontrolledAutocompleteState { value: string; } -class UncontrolledAutocomplete extends React.Component { +class UncontrolledAutocomplete extends React.Component< + Omit, + UncontrolledAutocompleteState +> { + public static defaultProps = Autocomplete.defaultProps; public state = { value: '', }; From dd07ef47170eecea129da2ca24b5b7d802a2bac0 Mon Sep 17 00:00:00 2001 From: wKich Date: Fri, 29 Mar 2019 13:36:40 +0500 Subject: [PATCH 21/29] fix(Autocomplete): handle concurrent requests fix #1299 --- packages/retail-ui/components/Autocomplete/Autocomplete.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/retail-ui/components/Autocomplete/Autocomplete.tsx b/packages/retail-ui/components/Autocomplete/Autocomplete.tsx index 3e737744e03..59f9461eeff 100644 --- a/packages/retail-ui/components/Autocomplete/Autocomplete.tsx +++ b/packages/retail-ui/components/Autocomplete/Autocomplete.tsx @@ -91,6 +91,7 @@ class Autocomplete extends React.Component; private focused: boolean = false; + private requestId: number = 0; private getProps = createPropsGetter(Autocomplete.defaultProps); @@ -298,13 +299,14 @@ class Autocomplete extends React.Component { - if (this.opened) { + if (this.opened && expectingId === this.requestId) { this.setState({ items, selected: -1, From 0c50381083fab2f9650a52c40e9f63c6e4dc000c Mon Sep 17 00:00:00 2001 From: wKich Date: Fri, 29 Mar 2019 13:37:13 +0500 Subject: [PATCH 22/29] test(Autocomplete): add concurrency test --- .../__tests__/Autocomplete-test.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/retail-ui/components/Autocomplete/__tests__/Autocomplete-test.tsx b/packages/retail-ui/components/Autocomplete/__tests__/Autocomplete-test.tsx index b6db6780f1e..40f4a5ff8db 100644 --- a/packages/retail-ui/components/Autocomplete/__tests__/Autocomplete-test.tsx +++ b/packages/retail-ui/components/Autocomplete/__tests__/Autocomplete-test.tsx @@ -138,6 +138,24 @@ describe('', () => { const [event] = onKeyDown.mock.calls[0]; expect(event.key).toBe('a'); }); + + it('handle concurrent source requests', async () => { + const items = Array.from({ length: 5 }).map((_, i) => String(i + 1)); + const onChange = jest.fn(); + const source = jest.fn(async (query: string) => { + const diff = items.length - Number(query); + await delay(Math.max(100, diff * 100)); + return items.slice(0, diff); + }); + const props = { value: '1', onChange, source }; + const wrapper = mount(); + wrapper.find('input').simulate('change', { target: { value: '' } }); + items.forEach((_, i) => { + wrapper.setProps({ value: String(i) }); + }); + await delay(500); + expect(wrapper.state('items')).toEqual(['1']); + }); }); interface UncontrolledAutocompleteState { From ad5c81cebf82f6430564562ccb3c16ad6aabed59 Mon Sep 17 00:00:00 2001 From: Egor Pogadaev Date: Thu, 28 Mar 2019 16:46:18 +0500 Subject: [PATCH 23/29] test(Tooltip): test onCloseRequest call on clickOutside --- .../Tooltip/__tests__/Tooltip-test.tsx | 47 ++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/packages/retail-ui/components/Tooltip/__tests__/Tooltip-test.tsx b/packages/retail-ui/components/Tooltip/__tests__/Tooltip-test.tsx index 21478e705ae..fc1f0f779d0 100644 --- a/packages/retail-ui/components/Tooltip/__tests__/Tooltip-test.tsx +++ b/packages/retail-ui/components/Tooltip/__tests__/Tooltip-test.tsx @@ -1,8 +1,15 @@ // tslint:disable:jsx-no-lambda -import { mount } from 'enzyme'; +import { mount, ReactWrapper } from 'enzyme'; import * as React from 'react'; import Button from '../../Button'; -import Tooltip, { TooltipProps } from '../Tooltip'; +import Tooltip, { TooltipProps, TooltipState } from '../Tooltip'; + +function clickOutside() { + const event = document.createEvent('HTMLEvents'); + event.initEvent('mousedown', true, true); + + document.body.dispatchEvent(event); +} describe('Tooltip', () => { const render = () => ''; @@ -118,4 +125,40 @@ describe('Tooltip', () => { wrapper.setProps({ trigger: 'hover' }); expect(wrapper.find(Content).length).toBe(0); }); + + describe('calls onCloseRequest on clickOutside when tooltip is opened', () => { + const Content = () =>

; + const onCloseRequest = jest.fn(); + let wrapper: ReactWrapper; + + beforeEach(() => { + onCloseRequest.mockClear(); + wrapper = mount( + } onCloseRequest={onCloseRequest}> + + , + ); + }); + + it('with "click" trigger', () => { + wrapper.setProps({ trigger: 'click' }); + wrapper.setState({ opened: true }); + wrapper.update(); + expect(wrapper.find(Content).length).toBe(1); + + clickOutside(); + + expect(onCloseRequest).toHaveBeenCalledTimes(1); + }); + + it('with "opened" trigger', () => { + wrapper.setProps({ trigger: 'opened' }); + wrapper.update(); + expect(wrapper.find(Content).length).toBe(1); + + clickOutside(); + + expect(onCloseRequest).toHaveBeenCalledTimes(1); + }); + }); }); From 08189733a5b4d0c8ad3f48aacfe70e3b62f90b79 Mon Sep 17 00:00:00 2001 From: Egor Pogadaev Date: Fri, 29 Mar 2019 13:04:50 +0500 Subject: [PATCH 24/29] fix(Tooltip): deactivate RenderLayer by default fix #1304 --- packages/retail-ui/components/Tooltip/Tooltip.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/retail-ui/components/Tooltip/Tooltip.tsx b/packages/retail-ui/components/Tooltip/Tooltip.tsx index 96605cee90b..1e46a607500 100644 --- a/packages/retail-ui/components/Tooltip/Tooltip.tsx +++ b/packages/retail-ui/components/Tooltip/Tooltip.tsx @@ -181,7 +181,7 @@ class Tooltip extends React.Component { public render() { const props = this.props; const content = this.renderContent(); - const { popupProps, layerProps = {} } = this.getProps(); + const { popupProps, layerProps = { active: false } } = this.getProps(); const anchorElement = props.children || props.anchorElement; const popup = this.renderPopup(anchorElement, popupProps, content); From 8e492e85c0547d1043ab6df041c4f30e4efcb31d Mon Sep 17 00:00:00 2001 From: Egor Pogadaev Date: Fri, 29 Mar 2019 13:27:23 +0500 Subject: [PATCH 25/29] revert(RenderLayer): "perf(RenderLayer): less event subscriptions" Perf optimization didn't take into account that callbacks may change independently from the "active" prop. #1304 --- .../retail-ui/components/RenderLayer/RenderLayer.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/retail-ui/components/RenderLayer/RenderLayer.tsx b/packages/retail-ui/components/RenderLayer/RenderLayer.tsx index 94e7c5e73c9..ea2e353fb0d 100644 --- a/packages/retail-ui/components/RenderLayer/RenderLayer.tsx +++ b/packages/retail-ui/components/RenderLayer/RenderLayer.tsx @@ -44,14 +44,9 @@ class RenderLayer extends React.Component { } private attachListeners() { - if (this.props.onFocusOutside) { - this.focusOutsideListenerToken = listenFocusOutside(() => [this.getDomNode()], this.handleFocusOutside); - window.addEventListener('blur', this.handleFocusOutside); - } - - if (this.props.onClickOutside) { - document.addEventListener('mousedown', this.handleNativeDocClick); - } + this.focusOutsideListenerToken = listenFocusOutside(() => [this.getDomNode()], this.handleFocusOutside); + window.addEventListener('blur', this.handleFocusOutside); + document.addEventListener('mousedown', this.handleNativeDocClick); } private detachListeners() { From 1e400fd4fc3b2011119ee8cfea014cfcf67275b6 Mon Sep 17 00:00:00 2001 From: Egor Pogadaev Date: Fri, 29 Mar 2019 13:37:27 +0500 Subject: [PATCH 26/29] chore(RenderLayer): add warning for not specified callback --- .../retail-ui/components/RenderLayer/RenderLayer.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/retail-ui/components/RenderLayer/RenderLayer.tsx b/packages/retail-ui/components/RenderLayer/RenderLayer.tsx index ea2e353fb0d..c1efe69c1e5 100644 --- a/packages/retail-ui/components/RenderLayer/RenderLayer.tsx +++ b/packages/retail-ui/components/RenderLayer/RenderLayer.tsx @@ -10,6 +10,17 @@ export interface RenderLayerProps { } class RenderLayer extends React.Component { + public static propTypes = { + active(props: RenderLayerProps, propName: keyof RenderLayerProps, componentName: string) { + const { active, onClickOutside, onFocusOutside } = props; + if (active && !(onClickOutside || onFocusOutside)) { + return new Error( + `[${componentName}]: using active ${componentName} without specifing either 'onClickOutside' or 'onFocusOutside' callback is incorrect.`, + ); + } + }, + }; + public static defaultProps = { active: true, }; From 65edd48126ecf428fd42f5adf10f07d658b681eb Mon Sep 17 00:00:00 2001 From: wKich Date: Fri, 29 Mar 2019 14:46:36 +0500 Subject: [PATCH 27/29] docs(retail-ui): improve props filter, don't pass aria attrs --- packages/retail-ui/styleguide.config.js | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/packages/retail-ui/styleguide.config.js b/packages/retail-ui/styleguide.config.js index a423a0b498e..04dd6c9510f 100644 --- a/packages/retail-ui/styleguide.config.js +++ b/packages/retail-ui/styleguide.config.js @@ -1,25 +1,7 @@ const fs = require('fs'); const path = require('path'); const parseTsComponent = require('react-docgen-typescript').withCustomConfig('./tsconfig.json', { - propFilter: (prop, component) => { - const FILTERED_COMPONENTS = [ - 'Link', - 'Input', - 'Center', - 'Autocomplete', - 'Checkbox', - 'CurrencyInput', - 'FxInput', - 'Radio', - 'Textarea', - ]; - - if (FILTERED_COMPONENTS.indexOf(component.name) > -1) { - return !!prop.description; - } - - return true; - }, + propFilter: prop => !(prop.parent && /node_modules/.test(prop.parent.fileName)), }).parse; const parseJsComponent = require('react-docgen').parse; const libraryVersion = require('./package.json').version; From 118b34711d80b67e96dfb9d8f0206cc54d96757b Mon Sep 17 00:00:00 2001 From: Alexander Kuzmin <21alexander21@gmail.com> Date: Fri, 29 Mar 2019 17:05:50 +0500 Subject: [PATCH 28/29] fix(ScrollContainer): multiple scrollbars on OSX (#827) * fix(Select): fix multiple scroll-bars * chore(ScrollContainer): improve styles * Revert "chore(ScrollContainer): improve styles" This reverts commit 0e9fb8f0ec27ec360ed8f107ba6f2e5d70c5f3a3. * refactor(ScrollContainer): replace display: none to visibility: hidden to reduce width changes * refactor(ScrollContainer): always use zero width scrollbar on mac os x * refactor(retail-ui): add browser detection functions * refactor(ScrollContainer): better support webkit browsers * refactor(retail-ui): remove unused file * refactor(retail-ui): replace browser detection functions to consts --- .../ScrollContainer/ScrollContainer.less | 5 +++++ .../ScrollContainer/ScrollContainer.tsx | 5 ++++- packages/retail-ui/lib/browserNormalizer.tsx | 15 --------------- packages/retail-ui/lib/utils.ts | 11 +++++++++++ 4 files changed, 20 insertions(+), 16 deletions(-) delete mode 100644 packages/retail-ui/lib/browserNormalizer.tsx diff --git a/packages/retail-ui/components/ScrollContainer/ScrollContainer.less b/packages/retail-ui/components/ScrollContainer/ScrollContainer.less index 9d5858ac095..423da7bc64d 100644 --- a/packages/retail-ui/components/ScrollContainer/ScrollContainer.less +++ b/packages/retail-ui/components/ScrollContainer/ScrollContainer.less @@ -12,6 +12,11 @@ /* IE sometimes enabled scroll: http://codepen.io/anon/pen/RRrLNX */ padding-bottom: 1px; overflow-y: scroll; + + &::-webkit-scrollbar { + visibility: hidden; + width: 0; + } } .scroll { diff --git a/packages/retail-ui/components/ScrollContainer/ScrollContainer.tsx b/packages/retail-ui/components/ScrollContainer/ScrollContainer.tsx index 47b88e0fc74..f942a3211de 100644 --- a/packages/retail-ui/components/ScrollContainer/ScrollContainer.tsx +++ b/packages/retail-ui/components/ScrollContainer/ScrollContainer.tsx @@ -8,9 +8,12 @@ import getScrollWidth from '../../lib/dom/getScrollWidth'; import styles from './ScrollContainer.less'; import { Nullable } from '../../typings/utility-types'; +import { isChrome, isOpera, isSafari } from '../../lib/utils'; const PADDING_RIGHT = 30; const MIN_SCROLL_SIZE = 20; +const SCROLL_HIDDEN = isChrome || isOpera || isSafari; +const SCROLL_WIDTH = SCROLL_HIDDEN ? 0 : getScrollWidth(); export type ScrollContainerScrollState = 'top' | 'scroll' | 'bottom'; @@ -82,7 +85,7 @@ export default class ScrollContainer extends React.Component new Promise(resolve => setTimeout(resolve, ms)); export const emptyHandler = () => undefined; @@ -23,3 +28,9 @@ export function taskWithDelay(task: () => void, ms: number) { export function isFunction(x: T | Function): x is Function { return typeof x === 'function'; } + +export const isMac = /mac/.test(platform); +export const isSafari = /version\/(\d+).+?safari/.test(userAgent); +export const isFirefox = /(?:firefox|fxios)\/(\d+)/.test(userAgent); +export const isOpera = /(?:^opera.+?version|opr)\/(\d+)/.test(userAgent); +export const isChrome = /google inc/.test(vendor) && /(?:chrome|crios)\/(\d+)/.test(userAgent) && !isOpera; From 56df93da7308304698344a8e79fd4791837e03ab Mon Sep 17 00:00:00 2001 From: Egor Pogadaev Date: Fri, 29 Mar 2019 18:41:56 +0500 Subject: [PATCH 29/29] chore(RenderLayer): change propType's warning message --- packages/retail-ui/components/RenderLayer/RenderLayer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/retail-ui/components/RenderLayer/RenderLayer.tsx b/packages/retail-ui/components/RenderLayer/RenderLayer.tsx index c1efe69c1e5..c0955137725 100644 --- a/packages/retail-ui/components/RenderLayer/RenderLayer.tsx +++ b/packages/retail-ui/components/RenderLayer/RenderLayer.tsx @@ -15,7 +15,7 @@ class RenderLayer extends React.Component { const { active, onClickOutside, onFocusOutside } = props; if (active && !(onClickOutside || onFocusOutside)) { return new Error( - `[${componentName}]: using active ${componentName} without specifing either 'onClickOutside' or 'onFocusOutside' callback is incorrect.`, + `[${componentName}]: using the component without either 'onClickOutside' or 'onFocusOutside' callback is pointless.`, ); } },