From 3f515bb45e769c16d33e1dd07958ebfbfc9b4c86 Mon Sep 17 00:00:00 2001 From: Cole Bemis Date: Fri, 21 Apr 2023 09:22:42 -0600 Subject: [PATCH] Deprecate legacy slots --- src/_CheckboxOrRadioGroup/slots.ts | 3 --- src/deprecated/ChoiceFieldset/ChoiceFieldset.tsx | 2 +- src/deprecated/InputField/slots.ts | 2 +- .../utils/__snapshots__/createSlots.test.tsx.snap | 0 src/{ => deprecated}/utils/create-slots.tsx | 9 ++++++--- src/{__tests__ => deprecated}/utils/createSlots.test.tsx | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) delete mode 100644 src/_CheckboxOrRadioGroup/slots.ts rename src/{__tests__ => deprecated}/utils/__snapshots__/createSlots.test.tsx.snap (100%) rename src/{ => deprecated}/utils/create-slots.tsx (93%) rename src/{__tests__ => deprecated}/utils/createSlots.test.tsx (97%) diff --git a/src/_CheckboxOrRadioGroup/slots.ts b/src/_CheckboxOrRadioGroup/slots.ts deleted file mode 100644 index 75ba8a8171b..00000000000 --- a/src/_CheckboxOrRadioGroup/slots.ts +++ /dev/null @@ -1,3 +0,0 @@ -import createSlots from '../utils/create-slots' - -export const {Slots, Slot} = createSlots(['Caption', 'Label', 'Validation']) diff --git a/src/deprecated/ChoiceFieldset/ChoiceFieldset.tsx b/src/deprecated/ChoiceFieldset/ChoiceFieldset.tsx index 3496a198091..469ca189640 100644 --- a/src/deprecated/ChoiceFieldset/ChoiceFieldset.tsx +++ b/src/deprecated/ChoiceFieldset/ChoiceFieldset.tsx @@ -1,6 +1,6 @@ import React from 'react' import {Box, useSSRSafeId} from '../..' -import createSlots from '../../utils/create-slots' +import createSlots from '../utils/create-slots' import {FormValidationStatus} from '../../utils/types/FormValidationStatus' import ValidationAnimationContainer from '../../_ValidationAnimationContainer' import InputValidation from '../../_InputValidation' diff --git a/src/deprecated/InputField/slots.ts b/src/deprecated/InputField/slots.ts index 4418ab896c6..1df9b0ed419 100644 --- a/src/deprecated/InputField/slots.ts +++ b/src/deprecated/InputField/slots.ts @@ -1,3 +1,3 @@ -import createSlots from '../../utils/create-slots' +import createSlots from '../utils/create-slots' export const {Slots, Slot} = createSlots(['Caption', 'Input', 'Label', 'LeadingVisual']) diff --git a/src/__tests__/utils/__snapshots__/createSlots.test.tsx.snap b/src/deprecated/utils/__snapshots__/createSlots.test.tsx.snap similarity index 100% rename from src/__tests__/utils/__snapshots__/createSlots.test.tsx.snap rename to src/deprecated/utils/__snapshots__/createSlots.test.tsx.snap diff --git a/src/utils/create-slots.tsx b/src/deprecated/utils/create-slots.tsx similarity index 93% rename from src/utils/create-slots.tsx rename to src/deprecated/utils/create-slots.tsx index b520b16ad0b..a86abcef0b9 100644 --- a/src/utils/create-slots.tsx +++ b/src/deprecated/utils/create-slots.tsx @@ -1,8 +1,11 @@ import React from 'react' -import {useForceUpdate} from './use-force-update' -import useLayoutEffect from './useIsomorphicLayoutEffect' +import {useForceUpdate} from '../../utils/use-force-update' +import useLayoutEffect from '../../utils/useIsomorphicLayoutEffect' -/** createSlots is a factory that can create a +/** + * @deprecated Use the `useSlots` hook instead. + * + * createSlots is a factory that can create a * typesafe Slots + Slot pair to use in a component definition * For example: ActionList.Item uses createSlots to get a Slots wrapper * + Slot component that is used by LeadingVisual, Description diff --git a/src/__tests__/utils/createSlots.test.tsx b/src/deprecated/utils/createSlots.test.tsx similarity index 97% rename from src/__tests__/utils/createSlots.test.tsx rename to src/deprecated/utils/createSlots.test.tsx index 7cff0be92ef..2d1bcfef461 100644 --- a/src/__tests__/utils/createSlots.test.tsx +++ b/src/deprecated/utils/createSlots.test.tsx @@ -1,6 +1,6 @@ import React from 'react' import {render, waitFor} from '@testing-library/react' -import createSlots from '../../utils/create-slots' +import createSlots from './create-slots' // setup a component with slots const {Slots, Slot} = createSlots(['One', 'Two', 'Three'])