From 62b1daffd0336c59ee3b7c581e8bd254ec8aaf90 Mon Sep 17 00:00:00 2001 From: "Amanda G. Brown" Date: Mon, 5 Jun 2023 18:03:31 -0400 Subject: [PATCH 1/2] refactor(getGlobalFocusStyles): moved to internal --- src/Button/types.ts | 2 +- src/Checkbox/Checkbox.tsx | 2 +- src/Pagination/Pagination.tsx | 2 +- src/Radio/Radio.tsx | 2 +- src/TabNav/TabNav.tsx | 2 +- src/UnderlineNav/UnderlineNav.tsx | 2 +- src/drafts/Button2/types.ts | 2 +- .../hooks/getGlobalFocusStyles.ts} | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) rename src/{_getGlobalFocusStyles.ts => internal/hooks/getGlobalFocusStyles.ts} (95%) diff --git a/src/Button/types.ts b/src/Button/types.ts index 68eade62b71..f7acaa33310 100644 --- a/src/Button/types.ts +++ b/src/Button/types.ts @@ -1,7 +1,7 @@ import React from 'react' import styled from 'styled-components' import sx, {SxProp} from '../sx' -import getGlobalFocusStyles from '../_getGlobalFocusStyles' +import getGlobalFocusStyles from '../internal/hooks/getGlobalFocusStyles' export const StyledButton = styled.button` ${getGlobalFocusStyles('-2px')}; diff --git a/src/Checkbox/Checkbox.tsx b/src/Checkbox/Checkbox.tsx index 984580228bc..c414c0f1228 100644 --- a/src/Checkbox/Checkbox.tsx +++ b/src/Checkbox/Checkbox.tsx @@ -5,7 +5,7 @@ import sx, {SxProp} from '../sx' import useLayoutEffect from '../utils/useIsomorphicLayoutEffect' import {FormValidationStatus} from '../utils/types/FormValidationStatus' import {CheckboxGroupContext} from '../CheckboxGroup/CheckboxGroupContext' -import getGlobalFocusStyles from '../_getGlobalFocusStyles' +import getGlobalFocusStyles from '../internal/hooks/getGlobalFocusStyles' import {get} from '../constants' import {sharedCheckboxAndRadioStyles} from '../_sharedCheckboxAndRadioStyles' diff --git a/src/Pagination/Pagination.tsx b/src/Pagination/Pagination.tsx index a193f4b1217..2f0a3af1438 100644 --- a/src/Pagination/Pagination.tsx +++ b/src/Pagination/Pagination.tsx @@ -3,7 +3,7 @@ import styled from 'styled-components' import Box from '../Box' import {get} from '../constants' import sx, {SxProp} from '../sx' -import getGlobalFocusStyles from '../_getGlobalFocusStyles' +import getGlobalFocusStyles from '../internal/hooks/getGlobalFocusStyles' import {buildComponentData, buildPaginationModel} from './model' const Page = styled.a` diff --git a/src/Radio/Radio.tsx b/src/Radio/Radio.tsx index 0e4fbc7614d..80664c0927b 100644 --- a/src/Radio/Radio.tsx +++ b/src/Radio/Radio.tsx @@ -3,7 +3,7 @@ import React, {ChangeEventHandler, InputHTMLAttributes, ReactElement, useContext import sx, {SxProp} from '../sx' import {FormValidationStatus} from '../utils/types/FormValidationStatus' import {RadioGroupContext} from '../RadioGroup/RadioGroup' -import getGlobalFocusStyles from '../_getGlobalFocusStyles' +import getGlobalFocusStyles from '../internal/hooks/getGlobalFocusStyles' import {get} from '../constants' import {sharedCheckboxAndRadioStyles} from '../_sharedCheckboxAndRadioStyles' diff --git a/src/TabNav/TabNav.tsx b/src/TabNav/TabNav.tsx index e3d46809af4..cfa1dc5f79e 100644 --- a/src/TabNav/TabNav.tsx +++ b/src/TabNav/TabNav.tsx @@ -7,7 +7,7 @@ import {get} from '../constants' import {FocusKeys, useFocusZone} from '../hooks/useFocusZone' import sx, {SxProp} from '../sx' import {ComponentProps} from '../utils/types' -import getGlobalFocusStyles from '../_getGlobalFocusStyles' +import getGlobalFocusStyles from '../internal/hooks/getGlobalFocusStyles' const ITEM_CLASS = 'TabNav-item' const SELECTED_CLASS = 'selected' diff --git a/src/UnderlineNav/UnderlineNav.tsx b/src/UnderlineNav/UnderlineNav.tsx index efd5afacd22..85b750c9a2b 100644 --- a/src/UnderlineNav/UnderlineNav.tsx +++ b/src/UnderlineNav/UnderlineNav.tsx @@ -5,7 +5,7 @@ import styled from 'styled-components' import {get} from '../constants' import sx, {SxProp} from '../sx' import {ComponentProps} from '../utils/types' -import getGlobalFocusStyles from '../_getGlobalFocusStyles' +import getGlobalFocusStyles from '../internal/hooks/getGlobalFocusStyles' const ITEM_CLASS = 'PRC-UnderlineNav-item' const SELECTED_CLASS = 'PRC-selected' diff --git a/src/drafts/Button2/types.ts b/src/drafts/Button2/types.ts index 663cf9c8c7d..66db9993793 100644 --- a/src/drafts/Button2/types.ts +++ b/src/drafts/Button2/types.ts @@ -1,7 +1,7 @@ import React from 'react' import styled from 'styled-components' import sx, {SxProp} from '../../sx' -import getGlobalFocusStyles from '../../_getGlobalFocusStyles' +import getGlobalFocusStyles from '../../internal/hooks/getGlobalFocusStyles' export const StyledButton = styled.button` ${getGlobalFocusStyles('-2px')}; diff --git a/src/_getGlobalFocusStyles.ts b/src/internal/hooks/getGlobalFocusStyles.ts similarity index 95% rename from src/_getGlobalFocusStyles.ts rename to src/internal/hooks/getGlobalFocusStyles.ts index e3969bdd81d..3453a63a434 100644 --- a/src/_getGlobalFocusStyles.ts +++ b/src/internal/hooks/getGlobalFocusStyles.ts @@ -1,6 +1,6 @@ import {CSSProperties} from 'react' import {css} from 'styled-components' -import {get} from './constants' +import {get} from '../../constants' const globalFocusStyle = css` box-shadow: none; From f25df4c866e07dcca6080e994ec465c5b7fe0833 Mon Sep 17 00:00:00 2001 From: "Amanda G. Brown" Date: Tue, 6 Jun 2023 12:08:08 -0400 Subject: [PATCH 2/2] refactor(getGlobalFocusStyles): moved to internal/utils --- src/Button/types.ts | 2 +- src/Checkbox/Checkbox.tsx | 2 +- src/Pagination/Pagination.tsx | 2 +- src/Radio/Radio.tsx | 2 +- src/TabNav/TabNav.tsx | 2 +- src/UnderlineNav/UnderlineNav.tsx | 2 +- src/drafts/Button2/types.ts | 2 +- src/internal/{hooks => utils}/getGlobalFocusStyles.ts | 0 8 files changed, 7 insertions(+), 7 deletions(-) rename src/internal/{hooks => utils}/getGlobalFocusStyles.ts (100%) diff --git a/src/Button/types.ts b/src/Button/types.ts index f7acaa33310..6ad81d0e9a0 100644 --- a/src/Button/types.ts +++ b/src/Button/types.ts @@ -1,7 +1,7 @@ import React from 'react' import styled from 'styled-components' import sx, {SxProp} from '../sx' -import getGlobalFocusStyles from '../internal/hooks/getGlobalFocusStyles' +import getGlobalFocusStyles from '../internal/utils/getGlobalFocusStyles' export const StyledButton = styled.button` ${getGlobalFocusStyles('-2px')}; diff --git a/src/Checkbox/Checkbox.tsx b/src/Checkbox/Checkbox.tsx index c414c0f1228..42accc41767 100644 --- a/src/Checkbox/Checkbox.tsx +++ b/src/Checkbox/Checkbox.tsx @@ -5,7 +5,7 @@ import sx, {SxProp} from '../sx' import useLayoutEffect from '../utils/useIsomorphicLayoutEffect' import {FormValidationStatus} from '../utils/types/FormValidationStatus' import {CheckboxGroupContext} from '../CheckboxGroup/CheckboxGroupContext' -import getGlobalFocusStyles from '../internal/hooks/getGlobalFocusStyles' +import getGlobalFocusStyles from '../internal/utils/getGlobalFocusStyles' import {get} from '../constants' import {sharedCheckboxAndRadioStyles} from '../_sharedCheckboxAndRadioStyles' diff --git a/src/Pagination/Pagination.tsx b/src/Pagination/Pagination.tsx index 2f0a3af1438..36d89dc1fb4 100644 --- a/src/Pagination/Pagination.tsx +++ b/src/Pagination/Pagination.tsx @@ -3,7 +3,7 @@ import styled from 'styled-components' import Box from '../Box' import {get} from '../constants' import sx, {SxProp} from '../sx' -import getGlobalFocusStyles from '../internal/hooks/getGlobalFocusStyles' +import getGlobalFocusStyles from '../internal/utils/getGlobalFocusStyles' import {buildComponentData, buildPaginationModel} from './model' const Page = styled.a` diff --git a/src/Radio/Radio.tsx b/src/Radio/Radio.tsx index 80664c0927b..29c116cb2ae 100644 --- a/src/Radio/Radio.tsx +++ b/src/Radio/Radio.tsx @@ -3,7 +3,7 @@ import React, {ChangeEventHandler, InputHTMLAttributes, ReactElement, useContext import sx, {SxProp} from '../sx' import {FormValidationStatus} from '../utils/types/FormValidationStatus' import {RadioGroupContext} from '../RadioGroup/RadioGroup' -import getGlobalFocusStyles from '../internal/hooks/getGlobalFocusStyles' +import getGlobalFocusStyles from '../internal/utils/getGlobalFocusStyles' import {get} from '../constants' import {sharedCheckboxAndRadioStyles} from '../_sharedCheckboxAndRadioStyles' diff --git a/src/TabNav/TabNav.tsx b/src/TabNav/TabNav.tsx index cfa1dc5f79e..e92fb1b1627 100644 --- a/src/TabNav/TabNav.tsx +++ b/src/TabNav/TabNav.tsx @@ -7,7 +7,7 @@ import {get} from '../constants' import {FocusKeys, useFocusZone} from '../hooks/useFocusZone' import sx, {SxProp} from '../sx' import {ComponentProps} from '../utils/types' -import getGlobalFocusStyles from '../internal/hooks/getGlobalFocusStyles' +import getGlobalFocusStyles from '../internal/utils/getGlobalFocusStyles' const ITEM_CLASS = 'TabNav-item' const SELECTED_CLASS = 'selected' diff --git a/src/UnderlineNav/UnderlineNav.tsx b/src/UnderlineNav/UnderlineNav.tsx index 85b750c9a2b..36964ccf6ab 100644 --- a/src/UnderlineNav/UnderlineNav.tsx +++ b/src/UnderlineNav/UnderlineNav.tsx @@ -5,7 +5,7 @@ import styled from 'styled-components' import {get} from '../constants' import sx, {SxProp} from '../sx' import {ComponentProps} from '../utils/types' -import getGlobalFocusStyles from '../internal/hooks/getGlobalFocusStyles' +import getGlobalFocusStyles from '../internal/utils/getGlobalFocusStyles' const ITEM_CLASS = 'PRC-UnderlineNav-item' const SELECTED_CLASS = 'PRC-selected' diff --git a/src/drafts/Button2/types.ts b/src/drafts/Button2/types.ts index 66db9993793..7c92531816b 100644 --- a/src/drafts/Button2/types.ts +++ b/src/drafts/Button2/types.ts @@ -1,7 +1,7 @@ import React from 'react' import styled from 'styled-components' import sx, {SxProp} from '../../sx' -import getGlobalFocusStyles from '../../internal/hooks/getGlobalFocusStyles' +import getGlobalFocusStyles from '../../internal/utils/getGlobalFocusStyles' export const StyledButton = styled.button` ${getGlobalFocusStyles('-2px')}; diff --git a/src/internal/hooks/getGlobalFocusStyles.ts b/src/internal/utils/getGlobalFocusStyles.ts similarity index 100% rename from src/internal/hooks/getGlobalFocusStyles.ts rename to src/internal/utils/getGlobalFocusStyles.ts