From 494300b366ef446ccee8811f518ba224c923909e Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Mon, 16 Sep 2019 20:05:50 +0200 Subject: [PATCH] [react-ui] Move experimental event+a11y work to react-ui package (#16794) --- .../src/__tests__/ReactScope-test.internal.js | 4 ++-- packages/react-ui/README.md | 4 ++++ .../accessibility/src}/FocusGrid.js | 4 ++-- .../accessibility/src}/ReactTabFocus.js | 4 ++-- .../accessibility/src}/TabbableScope.js | 0 .../src}/__tests__/FocusGrid-test.internal.js | 2 +- .../TabFocusController-test.internal.js | 2 +- .../__tests__/TabbableScope-test.internal.js | 0 .../events}/README.md | 2 +- .../events}/context-menu.js | 0 .../events}/docs/ContextMenu.md | 0 .../events}/docs/Focus.md | 0 .../events}/docs/FocusWithin.md | 0 .../events}/docs/Hover.md | 0 .../events}/docs/Press.md | 0 .../{react-events => react-ui/events}/drag.js | 0 .../events}/focus.js | 0 .../events}/hover.js | 0 .../events}/input.js | 0 .../events}/keyboard.js | 0 .../events}/press.js | 0 .../events}/scroll.js | 0 .../events}/src/dom/ContextMenu.js | 0 .../events}/src/dom/Drag.js | 0 .../events}/src/dom/Focus.js | 0 .../events}/src/dom/Hover.js | 0 .../events}/src/dom/Input.js | 0 .../events}/src/dom/Keyboard.js | 0 .../events}/src/dom/Press.js | 0 .../events}/src/dom/Scroll.js | 0 .../events}/src/dom/Swipe.js | 0 .../events}/src/dom/Tap.js | 0 .../__tests__/ContextMenu-test.internal.js | 2 +- .../src/dom/__tests__/Drag-test.internal.js | 2 +- .../src/dom/__tests__/Focus-test.internal.js | 4 ++-- .../__tests__/FocusWithin-test.internal.js | 4 ++-- .../src/dom/__tests__/Hover-test.internal.js | 4 ++-- .../src/dom/__tests__/Input-test.internal.js | 4 ++-- .../dom/__tests__/Keyboard-test.internal.js | 2 +- .../MixedResponders-test-internal.js | 10 ++++---- .../src/dom/__tests__/Press-test.internal.js | 4 ++-- .../src/dom/__tests__/Scroll-test.internal.js | 2 +- .../src/dom/__tests__/Tap-test.internal.js | 2 +- .../events}/src/dom/shared/index.js | 0 .../src/dom/testing-library/domEnvironment.js | 0 .../dom/testing-library/domEventSequences.js | 0 .../src/dom/testing-library/domEvents.js | 0 .../events}/src/dom/testing-library/index.js | 0 .../events}/src/rn/Press.js | 0 .../events}/swipe.js | 0 .../{react-events => react-ui/events}/tap.js | 0 .../{react-events => react-ui}/npm/drag.js | 0 .../{react-events => react-ui}/npm/focus.js | 0 .../{react-events => react-ui}/npm/hover.js | 0 .../{react-events => react-ui}/npm/input.js | 0 .../npm/keyboard.js | 0 .../{react-events => react-ui}/npm/press.js | 0 .../{react-events => react-ui}/npm/scroll.js | 0 .../{react-events => react-ui}/npm/swipe.js | 0 .../{react-events => react-ui}/npm/tap.js | 0 .../{react-events => react-ui}/package.json | 23 ++++++++++--------- scripts/rollup/bundles.js | 20 ++++++++-------- scripts/shared/pathsByLanguageVersion.js | 1 + 63 files changed, 56 insertions(+), 50 deletions(-) create mode 100644 packages/react-ui/README.md rename packages/{react-dom/src/client/focus => react-ui/accessibility/src}/FocusGrid.js (96%) rename packages/{react-dom/src/client/focus => react-ui/accessibility/src}/ReactTabFocus.js (97%) rename packages/{react-dom/src/client/focus => react-ui/accessibility/src}/TabbableScope.js (100%) rename packages/{react-dom/src/client/focus => react-ui/accessibility/src}/__tests__/FocusGrid-test.internal.js (98%) rename packages/{react-dom/src/client/focus => react-ui/accessibility/src}/__tests__/TabFocusController-test.internal.js (99%) rename packages/{react-dom/src/client/focus => react-ui/accessibility/src}/__tests__/TabbableScope-test.internal.js (100%) rename packages/{react-events => react-ui/events}/README.md (99%) rename packages/{react-events => react-ui/events}/context-menu.js (100%) rename packages/{react-events => react-ui/events}/docs/ContextMenu.md (100%) rename packages/{react-events => react-ui/events}/docs/Focus.md (100%) rename packages/{react-events => react-ui/events}/docs/FocusWithin.md (100%) rename packages/{react-events => react-ui/events}/docs/Hover.md (100%) rename packages/{react-events => react-ui/events}/docs/Press.md (100%) rename packages/{react-events => react-ui/events}/drag.js (100%) rename packages/{react-events => react-ui/events}/focus.js (100%) rename packages/{react-events => react-ui/events}/hover.js (100%) rename packages/{react-events => react-ui/events}/input.js (100%) rename packages/{react-events => react-ui/events}/keyboard.js (100%) rename packages/{react-events => react-ui/events}/press.js (100%) rename packages/{react-events => react-ui/events}/scroll.js (100%) rename packages/{react-events => react-ui/events}/src/dom/ContextMenu.js (100%) rename packages/{react-events => react-ui/events}/src/dom/Drag.js (100%) rename packages/{react-events => react-ui/events}/src/dom/Focus.js (100%) rename packages/{react-events => react-ui/events}/src/dom/Hover.js (100%) rename packages/{react-events => react-ui/events}/src/dom/Input.js (100%) rename packages/{react-events => react-ui/events}/src/dom/Keyboard.js (100%) rename packages/{react-events => react-ui/events}/src/dom/Press.js (100%) rename packages/{react-events => react-ui/events}/src/dom/Scroll.js (100%) rename packages/{react-events => react-ui/events}/src/dom/Swipe.js (100%) rename packages/{react-events => react-ui/events}/src/dom/Tap.js (100%) rename packages/{react-events => react-ui/events}/src/dom/__tests__/ContextMenu-test.internal.js (98%) rename packages/{react-events => react-ui/events}/src/dom/__tests__/Drag-test.internal.js (98%) rename packages/{react-events => react-ui/events}/src/dom/__tests__/Focus-test.internal.js (98%) rename packages/{react-events => react-ui/events}/src/dom/__tests__/FocusWithin-test.internal.js (98%) rename packages/{react-events => react-ui/events}/src/dom/__tests__/Hover-test.internal.js (98%) rename packages/{react-events => react-ui/events}/src/dom/__tests__/Input-test.internal.js (99%) rename packages/{react-events => react-ui/events}/src/dom/__tests__/Keyboard-test.internal.js (99%) rename packages/{react-events => react-ui/events}/src/dom/__tests__/MixedResponders-test-internal.js (96%) rename packages/{react-events => react-ui/events}/src/dom/__tests__/Press-test.internal.js (99%) rename packages/{react-events => react-ui/events}/src/dom/__tests__/Scroll-test.internal.js (98%) rename packages/{react-events => react-ui/events}/src/dom/__tests__/Tap-test.internal.js (99%) rename packages/{react-events => react-ui/events}/src/dom/shared/index.js (100%) rename packages/{react-events => react-ui/events}/src/dom/testing-library/domEnvironment.js (100%) rename packages/{react-events => react-ui/events}/src/dom/testing-library/domEventSequences.js (100%) rename packages/{react-events => react-ui/events}/src/dom/testing-library/domEvents.js (100%) rename packages/{react-events => react-ui/events}/src/dom/testing-library/index.js (100%) rename packages/{react-events => react-ui/events}/src/rn/Press.js (100%) rename packages/{react-events => react-ui/events}/swipe.js (100%) rename packages/{react-events => react-ui/events}/tap.js (100%) rename packages/{react-events => react-ui}/npm/drag.js (100%) rename packages/{react-events => react-ui}/npm/focus.js (100%) rename packages/{react-events => react-ui}/npm/hover.js (100%) rename packages/{react-events => react-ui}/npm/input.js (100%) rename packages/{react-events => react-ui}/npm/keyboard.js (100%) rename packages/{react-events => react-ui}/npm/press.js (100%) rename packages/{react-events => react-ui}/npm/scroll.js (100%) rename packages/{react-events => react-ui}/npm/swipe.js (100%) rename packages/{react-events => react-ui}/npm/tap.js (100%) rename packages/{react-events => react-ui}/package.json (72%) diff --git a/packages/react-reconciler/src/__tests__/ReactScope-test.internal.js b/packages/react-reconciler/src/__tests__/ReactScope-test.internal.js index ee0af6be0efa3..3bb77586871e9 100644 --- a/packages/react-reconciler/src/__tests__/ReactScope-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactScope-test.internal.js @@ -9,7 +9,7 @@ 'use strict'; -import {createEventTarget} from 'react-events/src/dom/testing-library'; +import {createEventTarget} from 'react-ui/events/src/dom/testing-library'; let React; let ReactFeatureFlags; @@ -204,7 +204,7 @@ describe('ReactScope', () => { let onKeyDown = jest.fn(); const TestScope = React.unstable_createScope((type, props) => true); const ref = React.createRef(); - const useKeyboard = require('react-events/keyboard').useKeyboard; + const useKeyboard = require('react-ui/events/keyboard').useKeyboard; let Component = () => { const listener = useKeyboard({ onKeyDown, diff --git a/packages/react-ui/README.md b/packages/react-ui/README.md new file mode 100644 index 0000000000000..09fe6c8e8bbef --- /dev/null +++ b/packages/react-ui/README.md @@ -0,0 +1,4 @@ +# `react-ui` + +This package is experimental. It is intended for use with the experimental React +flags for internal testing. \ No newline at end of file diff --git a/packages/react-dom/src/client/focus/FocusGrid.js b/packages/react-ui/accessibility/src/FocusGrid.js similarity index 96% rename from packages/react-dom/src/client/focus/FocusGrid.js rename to packages/react-ui/accessibility/src/FocusGrid.js index 5d04c1054e971..c0de9c1d052aa 100644 --- a/packages/react-dom/src/client/focus/FocusGrid.js +++ b/packages/react-ui/accessibility/src/FocusGrid.js @@ -7,11 +7,11 @@ * @flow */ -import type {KeyboardEvent} from 'react-events/src/dom/Keyboard'; +import type {KeyboardEvent} from 'react-ui/events/src/dom/Keyboard'; import React from 'react'; import {tabFocusableImpl} from './TabbableScope'; -import {useKeyboard} from 'react-events/keyboard'; +import {useKeyboard} from '../../events/keyboard'; type GridComponentProps = { children: React.Node, diff --git a/packages/react-dom/src/client/focus/ReactTabFocus.js b/packages/react-ui/accessibility/src/ReactTabFocus.js similarity index 97% rename from packages/react-dom/src/client/focus/ReactTabFocus.js rename to packages/react-ui/accessibility/src/ReactTabFocus.js index ecc5680ed7e4f..3d39251c9bb84 100644 --- a/packages/react-dom/src/client/focus/ReactTabFocus.js +++ b/packages/react-ui/accessibility/src/ReactTabFocus.js @@ -8,11 +8,11 @@ */ import type {ReactScopeMethods} from 'shared/ReactTypes'; -import type {KeyboardEvent} from 'react-events/src/dom/Keyboard'; +import type {KeyboardEvent} from 'react-ui/events/src/dom/Keyboard'; import React from 'react'; import {TabbableScope} from './TabbableScope'; -import {useKeyboard} from 'react-events/keyboard'; +import {useKeyboard} from '../../events/keyboard'; type TabFocusControllerProps = { children: React.Node, diff --git a/packages/react-dom/src/client/focus/TabbableScope.js b/packages/react-ui/accessibility/src/TabbableScope.js similarity index 100% rename from packages/react-dom/src/client/focus/TabbableScope.js rename to packages/react-ui/accessibility/src/TabbableScope.js diff --git a/packages/react-dom/src/client/focus/__tests__/FocusGrid-test.internal.js b/packages/react-ui/accessibility/src/__tests__/FocusGrid-test.internal.js similarity index 98% rename from packages/react-dom/src/client/focus/__tests__/FocusGrid-test.internal.js rename to packages/react-ui/accessibility/src/__tests__/FocusGrid-test.internal.js index 677c64b2d1b7d..abcbb8b134516 100644 --- a/packages/react-dom/src/client/focus/__tests__/FocusGrid-test.internal.js +++ b/packages/react-ui/accessibility/src/__tests__/FocusGrid-test.internal.js @@ -7,7 +7,7 @@ * @flow */ -import {createEventTarget} from 'react-events/src/dom/testing-library'; +import {createEventTarget} from 'react-ui/events/src/dom/testing-library'; let React; let ReactFeatureFlags; diff --git a/packages/react-dom/src/client/focus/__tests__/TabFocusController-test.internal.js b/packages/react-ui/accessibility/src/__tests__/TabFocusController-test.internal.js similarity index 99% rename from packages/react-dom/src/client/focus/__tests__/TabFocusController-test.internal.js rename to packages/react-ui/accessibility/src/__tests__/TabFocusController-test.internal.js index b9846f4054120..6edc23c634e87 100644 --- a/packages/react-dom/src/client/focus/__tests__/TabFocusController-test.internal.js +++ b/packages/react-ui/accessibility/src/__tests__/TabFocusController-test.internal.js @@ -7,7 +7,7 @@ * @flow */ -import {createEventTarget} from 'react-events/src/dom/testing-library'; +import {createEventTarget} from 'react-ui/events/src/dom/testing-library'; let React; let ReactFeatureFlags; diff --git a/packages/react-dom/src/client/focus/__tests__/TabbableScope-test.internal.js b/packages/react-ui/accessibility/src/__tests__/TabbableScope-test.internal.js similarity index 100% rename from packages/react-dom/src/client/focus/__tests__/TabbableScope-test.internal.js rename to packages/react-ui/accessibility/src/__tests__/TabbableScope-test.internal.js diff --git a/packages/react-events/README.md b/packages/react-ui/events/README.md similarity index 99% rename from packages/react-events/README.md rename to packages/react-ui/events/README.md index 3d4e2b008fa37..e40aca7cc1cfb 100644 --- a/packages/react-events/README.md +++ b/packages/react-ui/events/README.md @@ -1,4 +1,4 @@ -# `react-events` +# `react-ui/events` *This package is experimental. It is intended for use with the experimental React events API that is not available in open source builds.* diff --git a/packages/react-events/context-menu.js b/packages/react-ui/events/context-menu.js similarity index 100% rename from packages/react-events/context-menu.js rename to packages/react-ui/events/context-menu.js diff --git a/packages/react-events/docs/ContextMenu.md b/packages/react-ui/events/docs/ContextMenu.md similarity index 100% rename from packages/react-events/docs/ContextMenu.md rename to packages/react-ui/events/docs/ContextMenu.md diff --git a/packages/react-events/docs/Focus.md b/packages/react-ui/events/docs/Focus.md similarity index 100% rename from packages/react-events/docs/Focus.md rename to packages/react-ui/events/docs/Focus.md diff --git a/packages/react-events/docs/FocusWithin.md b/packages/react-ui/events/docs/FocusWithin.md similarity index 100% rename from packages/react-events/docs/FocusWithin.md rename to packages/react-ui/events/docs/FocusWithin.md diff --git a/packages/react-events/docs/Hover.md b/packages/react-ui/events/docs/Hover.md similarity index 100% rename from packages/react-events/docs/Hover.md rename to packages/react-ui/events/docs/Hover.md diff --git a/packages/react-events/docs/Press.md b/packages/react-ui/events/docs/Press.md similarity index 100% rename from packages/react-events/docs/Press.md rename to packages/react-ui/events/docs/Press.md diff --git a/packages/react-events/drag.js b/packages/react-ui/events/drag.js similarity index 100% rename from packages/react-events/drag.js rename to packages/react-ui/events/drag.js diff --git a/packages/react-events/focus.js b/packages/react-ui/events/focus.js similarity index 100% rename from packages/react-events/focus.js rename to packages/react-ui/events/focus.js diff --git a/packages/react-events/hover.js b/packages/react-ui/events/hover.js similarity index 100% rename from packages/react-events/hover.js rename to packages/react-ui/events/hover.js diff --git a/packages/react-events/input.js b/packages/react-ui/events/input.js similarity index 100% rename from packages/react-events/input.js rename to packages/react-ui/events/input.js diff --git a/packages/react-events/keyboard.js b/packages/react-ui/events/keyboard.js similarity index 100% rename from packages/react-events/keyboard.js rename to packages/react-ui/events/keyboard.js diff --git a/packages/react-events/press.js b/packages/react-ui/events/press.js similarity index 100% rename from packages/react-events/press.js rename to packages/react-ui/events/press.js diff --git a/packages/react-events/scroll.js b/packages/react-ui/events/scroll.js similarity index 100% rename from packages/react-events/scroll.js rename to packages/react-ui/events/scroll.js diff --git a/packages/react-events/src/dom/ContextMenu.js b/packages/react-ui/events/src/dom/ContextMenu.js similarity index 100% rename from packages/react-events/src/dom/ContextMenu.js rename to packages/react-ui/events/src/dom/ContextMenu.js diff --git a/packages/react-events/src/dom/Drag.js b/packages/react-ui/events/src/dom/Drag.js similarity index 100% rename from packages/react-events/src/dom/Drag.js rename to packages/react-ui/events/src/dom/Drag.js diff --git a/packages/react-events/src/dom/Focus.js b/packages/react-ui/events/src/dom/Focus.js similarity index 100% rename from packages/react-events/src/dom/Focus.js rename to packages/react-ui/events/src/dom/Focus.js diff --git a/packages/react-events/src/dom/Hover.js b/packages/react-ui/events/src/dom/Hover.js similarity index 100% rename from packages/react-events/src/dom/Hover.js rename to packages/react-ui/events/src/dom/Hover.js diff --git a/packages/react-events/src/dom/Input.js b/packages/react-ui/events/src/dom/Input.js similarity index 100% rename from packages/react-events/src/dom/Input.js rename to packages/react-ui/events/src/dom/Input.js diff --git a/packages/react-events/src/dom/Keyboard.js b/packages/react-ui/events/src/dom/Keyboard.js similarity index 100% rename from packages/react-events/src/dom/Keyboard.js rename to packages/react-ui/events/src/dom/Keyboard.js diff --git a/packages/react-events/src/dom/Press.js b/packages/react-ui/events/src/dom/Press.js similarity index 100% rename from packages/react-events/src/dom/Press.js rename to packages/react-ui/events/src/dom/Press.js diff --git a/packages/react-events/src/dom/Scroll.js b/packages/react-ui/events/src/dom/Scroll.js similarity index 100% rename from packages/react-events/src/dom/Scroll.js rename to packages/react-ui/events/src/dom/Scroll.js diff --git a/packages/react-events/src/dom/Swipe.js b/packages/react-ui/events/src/dom/Swipe.js similarity index 100% rename from packages/react-events/src/dom/Swipe.js rename to packages/react-ui/events/src/dom/Swipe.js diff --git a/packages/react-events/src/dom/Tap.js b/packages/react-ui/events/src/dom/Tap.js similarity index 100% rename from packages/react-events/src/dom/Tap.js rename to packages/react-ui/events/src/dom/Tap.js diff --git a/packages/react-events/src/dom/__tests__/ContextMenu-test.internal.js b/packages/react-ui/events/src/dom/__tests__/ContextMenu-test.internal.js similarity index 98% rename from packages/react-events/src/dom/__tests__/ContextMenu-test.internal.js rename to packages/react-ui/events/src/dom/__tests__/ContextMenu-test.internal.js index dca993a4409a6..935ff277f807c 100644 --- a/packages/react-events/src/dom/__tests__/ContextMenu-test.internal.js +++ b/packages/react-ui/events/src/dom/__tests__/ContextMenu-test.internal.js @@ -28,7 +28,7 @@ function initializeModules(hasPointerEvents) { ReactFeatureFlags.enableFlareAPI = true; React = require('react'); ReactDOM = require('react-dom'); - useContextMenu = require('react-events/context-menu').useContextMenu; + useContextMenu = require('react-ui/events/context-menu').useContextMenu; } const forcePointerEvents = true; diff --git a/packages/react-events/src/dom/__tests__/Drag-test.internal.js b/packages/react-ui/events/src/dom/__tests__/Drag-test.internal.js similarity index 98% rename from packages/react-events/src/dom/__tests__/Drag-test.internal.js rename to packages/react-ui/events/src/dom/__tests__/Drag-test.internal.js index 28b000d1b0563..add315eddf0dc 100644 --- a/packages/react-events/src/dom/__tests__/Drag-test.internal.js +++ b/packages/react-ui/events/src/dom/__tests__/Drag-test.internal.js @@ -23,7 +23,7 @@ describe('Drag event responder', () => { ReactFeatureFlags.enableFlareAPI = true; React = require('react'); ReactDOM = require('react-dom'); - useDrag = require('react-events/drag').useDrag; + useDrag = require('react-ui/events/drag').useDrag; container = document.createElement('div'); document.body.appendChild(container); diff --git a/packages/react-events/src/dom/__tests__/Focus-test.internal.js b/packages/react-ui/events/src/dom/__tests__/Focus-test.internal.js similarity index 98% rename from packages/react-events/src/dom/__tests__/Focus-test.internal.js rename to packages/react-ui/events/src/dom/__tests__/Focus-test.internal.js index 19bf4d6ff4589..8eb1003c1f5d2 100644 --- a/packages/react-events/src/dom/__tests__/Focus-test.internal.js +++ b/packages/react-ui/events/src/dom/__tests__/Focus-test.internal.js @@ -24,8 +24,8 @@ function initializeModules(hasPointerEvents) { ReactFeatureFlags.enableFlareAPI = true; React = require('react'); ReactDOM = require('react-dom'); - FocusResponder = require('react-events/focus').FocusResponder; - useFocus = require('react-events/focus').useFocus; + FocusResponder = require('react-ui/events/focus').FocusResponder; + useFocus = require('react-ui/events/focus').useFocus; } const forcePointerEvents = true; diff --git a/packages/react-events/src/dom/__tests__/FocusWithin-test.internal.js b/packages/react-ui/events/src/dom/__tests__/FocusWithin-test.internal.js similarity index 98% rename from packages/react-events/src/dom/__tests__/FocusWithin-test.internal.js rename to packages/react-ui/events/src/dom/__tests__/FocusWithin-test.internal.js index f9f3f81bca71c..7c80352d54538 100644 --- a/packages/react-events/src/dom/__tests__/FocusWithin-test.internal.js +++ b/packages/react-ui/events/src/dom/__tests__/FocusWithin-test.internal.js @@ -24,8 +24,8 @@ const initializeModules = hasPointerEvents => { ReactFeatureFlags.enableFlareAPI = true; React = require('react'); ReactDOM = require('react-dom'); - FocusWithinResponder = require('react-events/focus').FocusWithinResponder; - useFocusWithin = require('react-events/focus').useFocusWithin; + FocusWithinResponder = require('react-ui/events/focus').FocusWithinResponder; + useFocusWithin = require('react-ui/events/focus').useFocusWithin; }; const forcePointerEvents = true; diff --git a/packages/react-events/src/dom/__tests__/Hover-test.internal.js b/packages/react-ui/events/src/dom/__tests__/Hover-test.internal.js similarity index 98% rename from packages/react-events/src/dom/__tests__/Hover-test.internal.js rename to packages/react-ui/events/src/dom/__tests__/Hover-test.internal.js index f114465a9ad2e..ad015e19301b8 100644 --- a/packages/react-events/src/dom/__tests__/Hover-test.internal.js +++ b/packages/react-ui/events/src/dom/__tests__/Hover-test.internal.js @@ -25,8 +25,8 @@ function initializeModules(hasPointerEvents) { ReactFeatureFlags.enableUserBlockingEvents = true; React = require('react'); ReactDOM = require('react-dom'); - HoverResponder = require('react-events/hover').HoverResponder; - useHover = require('react-events/hover').useHover; + HoverResponder = require('react-ui/events/hover').HoverResponder; + useHover = require('react-ui/events/hover').useHover; } const forcePointerEvents = true; diff --git a/packages/react-events/src/dom/__tests__/Input-test.internal.js b/packages/react-ui/events/src/dom/__tests__/Input-test.internal.js similarity index 99% rename from packages/react-events/src/dom/__tests__/Input-test.internal.js rename to packages/react-ui/events/src/dom/__tests__/Input-test.internal.js index 6d7d26cabd286..d1168a3810129 100644 --- a/packages/react-events/src/dom/__tests__/Input-test.internal.js +++ b/packages/react-ui/events/src/dom/__tests__/Input-test.internal.js @@ -39,8 +39,8 @@ const modulesInit = () => { React = require('react'); ReactDOM = require('react-dom'); Scheduler = require('scheduler'); - InputResponder = require('react-events/input').InputResponder; - useInput = require('react-events/input').useInput; + InputResponder = require('react-ui/events/input').InputResponder; + useInput = require('react-ui/events/input').useInput; }; describe('Input event responder', () => { diff --git a/packages/react-events/src/dom/__tests__/Keyboard-test.internal.js b/packages/react-ui/events/src/dom/__tests__/Keyboard-test.internal.js similarity index 99% rename from packages/react-events/src/dom/__tests__/Keyboard-test.internal.js rename to packages/react-ui/events/src/dom/__tests__/Keyboard-test.internal.js index e49a57c5d2c91..feea638e295a3 100644 --- a/packages/react-events/src/dom/__tests__/Keyboard-test.internal.js +++ b/packages/react-ui/events/src/dom/__tests__/Keyboard-test.internal.js @@ -22,7 +22,7 @@ function initializeModules(hasPointerEvents) { ReactFeatureFlags.enableFlareAPI = true; React = require('react'); ReactDOM = require('react-dom'); - useKeyboard = require('react-events/keyboard').useKeyboard; + useKeyboard = require('react-ui/events/keyboard').useKeyboard; } describe('Keyboard responder', () => { diff --git a/packages/react-events/src/dom/__tests__/MixedResponders-test-internal.js b/packages/react-ui/events/src/dom/__tests__/MixedResponders-test-internal.js similarity index 96% rename from packages/react-events/src/dom/__tests__/MixedResponders-test-internal.js rename to packages/react-ui/events/src/dom/__tests__/MixedResponders-test-internal.js index 157039c9bd710..26815678e1a43 100644 --- a/packages/react-events/src/dom/__tests__/MixedResponders-test-internal.js +++ b/packages/react-ui/events/src/dom/__tests__/MixedResponders-test-internal.js @@ -35,7 +35,7 @@ describe('mixing responders with the heritage event system', () => { }); it('should properly only flush sync once when the event systems are mixed', () => { - const usePress = require('react-events/press').usePress; + const usePress = require('react-ui/events/press').usePress; const ref = React.createRef(); let renderCounts = 0; @@ -104,7 +104,7 @@ describe('mixing responders with the heritage event system', () => { }); it('should properly flush sync when the event systems are mixed with unstable_flushDiscreteUpdates', () => { - const usePress = require('react-events/press').usePress; + const usePress = require('react-ui/events/press').usePress; const ref = React.createRef(); let renderCounts = 0; @@ -177,7 +177,7 @@ describe('mixing responders with the heritage event system', () => { 'event systems', async () => { const {useState} = React; - const usePress = require('react-events/press').usePress; + const usePress = require('react-ui/events/press').usePress; const button = React.createRef(); @@ -237,8 +237,8 @@ describe('mixing responders with the heritage event system', () => { it('is async for non-input events', () => { ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = false; ReactFeatureFlags.enableUserBlockingEvents = true; - const usePress = require('react-events/press').usePress; - const useInput = require('react-events/input').useInput; + const usePress = require('react-ui/events/press').usePress; + const useInput = require('react-ui/events/input').useInput; const root = ReactDOM.unstable_createRoot(container); let input; diff --git a/packages/react-events/src/dom/__tests__/Press-test.internal.js b/packages/react-ui/events/src/dom/__tests__/Press-test.internal.js similarity index 99% rename from packages/react-events/src/dom/__tests__/Press-test.internal.js rename to packages/react-ui/events/src/dom/__tests__/Press-test.internal.js index c203b7f38da3c..932bfd896fe0a 100644 --- a/packages/react-events/src/dom/__tests__/Press-test.internal.js +++ b/packages/react-ui/events/src/dom/__tests__/Press-test.internal.js @@ -28,8 +28,8 @@ function initializeModules(hasPointerEvents) { ReactFeatureFlags.enableFlareAPI = true; React = require('react'); ReactDOM = require('react-dom'); - PressResponder = require('react-events/press').PressResponder; - usePress = require('react-events/press').usePress; + PressResponder = require('react-ui/events/press').PressResponder; + usePress = require('react-ui/events/press').usePress; } function removePressMoveStrings(eventString) { diff --git a/packages/react-events/src/dom/__tests__/Scroll-test.internal.js b/packages/react-ui/events/src/dom/__tests__/Scroll-test.internal.js similarity index 98% rename from packages/react-events/src/dom/__tests__/Scroll-test.internal.js rename to packages/react-ui/events/src/dom/__tests__/Scroll-test.internal.js index 3af960e55a389..5d08145cccb24 100644 --- a/packages/react-events/src/dom/__tests__/Scroll-test.internal.js +++ b/packages/react-ui/events/src/dom/__tests__/Scroll-test.internal.js @@ -26,7 +26,7 @@ const initializeModules = hasPointerEvents => { ReactFeatureFlags.enableFlareAPI = true; React = require('react'); ReactDOM = require('react-dom'); - useScroll = require('react-events/scroll').useScroll; + useScroll = require('react-ui/events/scroll').useScroll; }; describe.each(table)('Scroll responder', hasPointerEvents => { diff --git a/packages/react-events/src/dom/__tests__/Tap-test.internal.js b/packages/react-ui/events/src/dom/__tests__/Tap-test.internal.js similarity index 99% rename from packages/react-events/src/dom/__tests__/Tap-test.internal.js rename to packages/react-ui/events/src/dom/__tests__/Tap-test.internal.js index e8f12aa7c365f..99a85f2faeb88 100644 --- a/packages/react-events/src/dom/__tests__/Tap-test.internal.js +++ b/packages/react-ui/events/src/dom/__tests__/Tap-test.internal.js @@ -29,7 +29,7 @@ function initializeModules(hasPointerEvents) { ReactFeatureFlags.enableFlareAPI = true; React = require('react'); ReactDOM = require('react-dom'); - useTap = require('react-events/tap').useTap; + useTap = require('react-ui/events/tap').useTap; } const coordinatesInside = {x: 51, y: 51}; diff --git a/packages/react-events/src/dom/shared/index.js b/packages/react-ui/events/src/dom/shared/index.js similarity index 100% rename from packages/react-events/src/dom/shared/index.js rename to packages/react-ui/events/src/dom/shared/index.js diff --git a/packages/react-events/src/dom/testing-library/domEnvironment.js b/packages/react-ui/events/src/dom/testing-library/domEnvironment.js similarity index 100% rename from packages/react-events/src/dom/testing-library/domEnvironment.js rename to packages/react-ui/events/src/dom/testing-library/domEnvironment.js diff --git a/packages/react-events/src/dom/testing-library/domEventSequences.js b/packages/react-ui/events/src/dom/testing-library/domEventSequences.js similarity index 100% rename from packages/react-events/src/dom/testing-library/domEventSequences.js rename to packages/react-ui/events/src/dom/testing-library/domEventSequences.js diff --git a/packages/react-events/src/dom/testing-library/domEvents.js b/packages/react-ui/events/src/dom/testing-library/domEvents.js similarity index 100% rename from packages/react-events/src/dom/testing-library/domEvents.js rename to packages/react-ui/events/src/dom/testing-library/domEvents.js diff --git a/packages/react-events/src/dom/testing-library/index.js b/packages/react-ui/events/src/dom/testing-library/index.js similarity index 100% rename from packages/react-events/src/dom/testing-library/index.js rename to packages/react-ui/events/src/dom/testing-library/index.js diff --git a/packages/react-events/src/rn/Press.js b/packages/react-ui/events/src/rn/Press.js similarity index 100% rename from packages/react-events/src/rn/Press.js rename to packages/react-ui/events/src/rn/Press.js diff --git a/packages/react-events/swipe.js b/packages/react-ui/events/swipe.js similarity index 100% rename from packages/react-events/swipe.js rename to packages/react-ui/events/swipe.js diff --git a/packages/react-events/tap.js b/packages/react-ui/events/tap.js similarity index 100% rename from packages/react-events/tap.js rename to packages/react-ui/events/tap.js diff --git a/packages/react-events/npm/drag.js b/packages/react-ui/npm/drag.js similarity index 100% rename from packages/react-events/npm/drag.js rename to packages/react-ui/npm/drag.js diff --git a/packages/react-events/npm/focus.js b/packages/react-ui/npm/focus.js similarity index 100% rename from packages/react-events/npm/focus.js rename to packages/react-ui/npm/focus.js diff --git a/packages/react-events/npm/hover.js b/packages/react-ui/npm/hover.js similarity index 100% rename from packages/react-events/npm/hover.js rename to packages/react-ui/npm/hover.js diff --git a/packages/react-events/npm/input.js b/packages/react-ui/npm/input.js similarity index 100% rename from packages/react-events/npm/input.js rename to packages/react-ui/npm/input.js diff --git a/packages/react-events/npm/keyboard.js b/packages/react-ui/npm/keyboard.js similarity index 100% rename from packages/react-events/npm/keyboard.js rename to packages/react-ui/npm/keyboard.js diff --git a/packages/react-events/npm/press.js b/packages/react-ui/npm/press.js similarity index 100% rename from packages/react-events/npm/press.js rename to packages/react-ui/npm/press.js diff --git a/packages/react-events/npm/scroll.js b/packages/react-ui/npm/scroll.js similarity index 100% rename from packages/react-events/npm/scroll.js rename to packages/react-ui/npm/scroll.js diff --git a/packages/react-events/npm/swipe.js b/packages/react-ui/npm/swipe.js similarity index 100% rename from packages/react-events/npm/swipe.js rename to packages/react-ui/npm/swipe.js diff --git a/packages/react-events/npm/tap.js b/packages/react-ui/npm/tap.js similarity index 100% rename from packages/react-events/npm/tap.js rename to packages/react-ui/npm/tap.js diff --git a/packages/react-events/package.json b/packages/react-ui/package.json similarity index 72% rename from packages/react-events/package.json rename to packages/react-ui/package.json index 3af4293fd53ee..015bc236bee37 100644 --- a/packages/react-events/package.json +++ b/packages/react-ui/package.json @@ -1,5 +1,5 @@ { - "name": "react-events", + "name": "react-ui", "private": true, "description": "React is a JavaScript library for building user interfaces.", "keywords": [ @@ -12,16 +12,17 @@ "files": [ "LICENSE", "README.md", - "context-menu.js", - "drag.js", - "focus.js", - "hover.js", - "input.js", - "keyboard.js", - "press.js", - "scroll.js", - "swipe.js", - "tap.js", + "events/README.md", + "events/context-menu.js", + "events/drag.js", + "events/focus.js", + "events/hover.js", + "events/input.js", + "events/keyboard.js", + "events/press.js", + "events/scroll.js", + "events/swipe.js", + "events/tap.js", "build-info.json", "cjs/", "umd/" diff --git a/scripts/rollup/bundles.js b/scripts/rollup/bundles.js index 6a2d7d2af098c..8ed51477f5ce5 100644 --- a/scripts/rollup/bundles.js +++ b/scripts/rollup/bundles.js @@ -505,7 +505,7 @@ const bundles = [ FB_WWW_PROD, ], moduleType: NON_FIBER_RENDERER, - entry: 'react-events/context-menu', + entry: 'react-ui/events/context-menu', global: 'ReactEventsContextMenu', externals: ['react'], }, @@ -520,7 +520,7 @@ const bundles = [ FB_WWW_PROD, ], moduleType: NON_FIBER_RENDERER, - entry: 'react-events/drag', + entry: 'react-ui/events/drag', global: 'ReactEventsDrag', externals: ['react'], }, @@ -535,7 +535,7 @@ const bundles = [ FB_WWW_PROD, ], moduleType: NON_FIBER_RENDERER, - entry: 'react-events/focus', + entry: 'react-ui/events/focus', global: 'ReactEventsFocus', externals: ['react'], }, @@ -550,7 +550,7 @@ const bundles = [ FB_WWW_PROD, ], moduleType: NON_FIBER_RENDERER, - entry: 'react-events/hover', + entry: 'react-ui/events/hover', global: 'ReactEventsHover', externals: ['react'], }, @@ -565,7 +565,7 @@ const bundles = [ FB_WWW_PROD, ], moduleType: NON_FIBER_RENDERER, - entry: 'react-events/input', + entry: 'react-ui/events/input', global: 'ReactEventsInput', externals: ['react'], }, @@ -580,7 +580,7 @@ const bundles = [ FB_WWW_PROD, ], moduleType: NON_FIBER_RENDERER, - entry: 'react-events/keyboard', + entry: 'react-ui/events/keyboard', global: 'ReactEventsKeyboard', externals: ['react'], }, @@ -595,7 +595,7 @@ const bundles = [ FB_WWW_PROD, ], moduleType: NON_FIBER_RENDERER, - entry: 'react-events/press', + entry: 'react-ui/events/press', global: 'ReactEventsPress', externals: ['react'], }, @@ -610,7 +610,7 @@ const bundles = [ FB_WWW_PROD, ], moduleType: NON_FIBER_RENDERER, - entry: 'react-events/scroll', + entry: 'react-ui/events/scroll', global: 'ReactEventsScroll', externals: ['react'], }, @@ -625,7 +625,7 @@ const bundles = [ FB_WWW_PROD, ], moduleType: NON_FIBER_RENDERER, - entry: 'react-events/swipe', + entry: 'react-ui/events/swipe', global: 'ReactEventsSwipe', externals: ['react'], }, @@ -640,7 +640,7 @@ const bundles = [ FB_WWW_PROD, ], moduleType: NON_FIBER_RENDERER, - entry: 'react-events/tap', + entry: 'react-ui/events/tap', global: 'ReactEventsTap', externals: ['react'], }, diff --git a/scripts/shared/pathsByLanguageVersion.js b/scripts/shared/pathsByLanguageVersion.js index 396b28cdbd44a..fec671522bb12 100644 --- a/scripts/shared/pathsByLanguageVersion.js +++ b/scripts/shared/pathsByLanguageVersion.js @@ -12,6 +12,7 @@ const esNextPaths = [ 'packages/*/*.js', // Source files 'packages/*/src/**/*.js', + 'packages/react-ui/*/src/**/*.js', 'packages/legacy-events/**/*.js', 'packages/shared/**/*.js', // Shims and Flow environment