Skip to content

Commit

Permalink
[TrapFocus] Migrate to unstyled
Browse files Browse the repository at this point in the history
  • Loading branch information
povilass committed Feb 16, 2021
1 parent cdbc752 commit 4ed20ab
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/pages/api-docs/unstable-trap-focus.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"name": "Unstable_TrapFocus",
"styles": { "classes": [], "globalClasses": {}, "name": null },
"spread": false,
"filename": "/packages/material-ui/src/Unstable_TrapFocus/Unstable_TrapFocus.js",
"filename": "/packages/material-ui-unstyled/src/Unstable_TrapFocus/Unstable_TrapFocus.js",
"inheritance": null,
"demos": "<ul><li><a href=\"/components/trap-focus/\">Trap Focus</a></li></ul>",
"styledComponent": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
/* eslint-disable @typescript-eslint/naming-convention, consistent-return, jsx-a11y/no-noninteractive-tabindex */
import * as React from 'react';
import PropTypes from 'prop-types';
import { exactProp, elementAcceptingRef } from '@material-ui/utils';
import ownerDocument from '../utils/ownerDocument';
import useForkRef from '../utils/useForkRef';
import {
exactProp,
elementAcceptingRef,
unstable_useForkRef as useForkRef,
unstable_ownerDocument as ownerDocument,
} from '@material-ui/utils';

// Inspired by https://github.com/focus-trap/tabbable
const candidatesSelector = [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from './Unstable_TrapFocus';
export * from './Unstable_TrapFocus';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Unstable_TrapFocus';
3 changes: 3 additions & 0 deletions packages/material-ui-unstyled/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export * from './SliderUnstyled';
export { default as Portal } from './Portal';
export * from './Portal';

export { default as Unstable_TrapFocus } from './Unstable_TrapFocus';
export * from './Unstable_TrapFocus';

export { default as generateUtilityClass } from './generateUtilityClass';
export * from './generateUtilityClass';

Expand Down
2 changes: 2 additions & 0 deletions packages/material-ui-unstyled/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export * from './SliderUnstyled';

export { default as Portal } from './Portal';

export { default as Unstable_TrapFocus } from './Unstable_TrapFocus';

export { default as generateUtilityClass } from './generateUtilityClass';

export { default as generateUtilityClasses } from './generateUtilityClasses';
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui/src/Unstable_TrapFocus/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default } from './Unstable_TrapFocus';
export * from './Unstable_TrapFocus';
export { default } from '@material-ui/unstyled/Unstable_TrapFocus';
export * from '@material-ui/unstyled/Unstable_TrapFocus';
2 changes: 1 addition & 1 deletion packages/material-ui/src/Unstable_TrapFocus/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from './Unstable_TrapFocus';
export { default } from '@material-ui/unstyled/Unstable_TrapFocus';
3 changes: 0 additions & 3 deletions packages/material-ui/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,6 @@ export * from './Tooltip';
export { default as Typography } from './Typography';
export * from './Typography';

export { default as Unstable_TrapFocus } from './Unstable_TrapFocus';
export * from './Unstable_TrapFocus';

export { default as useMediaQuery } from './useMediaQuery';
export * from './useMediaQuery';

Expand Down
3 changes: 0 additions & 3 deletions packages/material-ui/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,6 @@ export * from './Tooltip';
export { default as Typography } from './Typography';
export * from './Typography';

export { default as Unstable_TrapFocus } from './Unstable_TrapFocus';
export * from './Unstable_TrapFocus';

export { default as useMediaQuery } from './useMediaQuery';
export * from './useMediaQuery';

Expand Down
2 changes: 1 addition & 1 deletion test/utils/user-event/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fireEvent, getConfig } from '@testing-library/dom';
// eslint-disable-next-line no-restricted-imports
import { defaultGetTabbable as getTabbable } from '@material-ui/core/Unstable_TrapFocus/Unstable_TrapFocus';
import { defaultGetTabbable as getTabbable } from '@material-ui/core/Unstable_TrapFocus';

// Absolutely NO events fire on label elements that contain their control
// if that control is disabled. NUTS!
Expand Down

0 comments on commit 4ed20ab

Please sign in to comment.