Skip to content

Commit 5f735a5

Browse files
git-nandorbalzss
authored andcommitted
feat(emotion): remove as prop from InstuiSettingsProvider and remove deprecated test
1 parent 1d74d1a commit 5f735a5

File tree

2 files changed

+11
-48
lines changed

2 files changed

+11
-48
lines changed

packages/emotion/src/InstUISettingsProvider/__tests__/InstUISettingsProvider.test.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,4 @@ describe('<InstUISettingsProvider />', () => {
8181

8282
expect(element).toHaveAttribute('dir', 'ltr')
8383
})
84-
85-
it('warns when "as" property is used without using the "dir" property', async () => {
86-
const warningMessage =
87-
"The 'as' property should be used in conjunction with the 'dir' property!"
88-
89-
render(
90-
//@ts-expect-error div is required
91-
<InstUISettingsProvider as="div">
92-
<div>text</div>
93-
</InstUISettingsProvider>
94-
)
95-
expect(consoleWarningMock).toHaveBeenCalledWith(warningMessage)
96-
})
9784
})

packages/emotion/src/InstUISettingsProvider/index.tsx

Lines changed: 11 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import { getTheme } from '../getTheme'
3232

3333
import type { ThemeOrOverride } from '../EmotionTypes'
3434
import type { DeterministicIdProviderValue } from '@instructure/ui-react-utils'
35-
import type { AsElementType } from '@instructure/shared-types'
3635

3736
type InstUIProviderProps = {
3837
children?: React.ReactNode
@@ -50,32 +49,15 @@ type InstUIProviderProps = {
5049
* specific InstUI components. (generally this is used for deterministic id generation for [SSR](/#server-side-rendering))
5150
*/
5251
instanceCounterMap?: DeterministicIdProviderValue
53-
} & (
54-
| {
55-
/**
56-
* The text direction to use in the descendants. If not provided, it uses the following in this priority order:
57-
* - The value given in a parent `TextDirectionContext`
58-
* - The `dir` prop of `document.documentElement` or its `direction` CSS prop
59-
* - The default `ltr`
60-
*/
61-
dir: 'ltr' | 'rtl'
62-
/**
63-
* @deprecated This prop will be removed in InstUI v11
64-
*
65-
* The element type to render as
66-
*/
67-
as?: AsElementType
68-
}
69-
| {
70-
dir?: never
71-
/**
72-
* @deprecated This prop will be removed in InstUI v11
73-
*
74-
* The element type to render as
75-
*/
76-
as?: never
77-
}
78-
)
52+
53+
/**
54+
* The text direction to use in the descendants. If not provided, it uses the following in this priority order:
55+
* - The value given in a parent `TextDirectionContext`
56+
* - The `dir` prop of `document.documentElement` or its `direction` CSS prop
57+
* - The default `ltr`
58+
*/
59+
dir?: 'ltr' | 'rtl'
60+
}
7961

8062
/**
8163
* ---
@@ -87,8 +69,7 @@ function InstUISettingsProvider({
8769
children,
8870
theme = {},
8971
dir,
90-
instanceCounterMap,
91-
as
72+
instanceCounterMap
9273
}: InstUIProviderProps) {
9374
const finalDir = dir || useContext(TextDirectionContext)
9475

@@ -109,12 +90,7 @@ function InstUISettingsProvider({
10990
)
11091

11192
if (dir) {
112-
const Element = as || 'span'
113-
providers = <Element dir={finalDir}>{providers}</Element>
114-
} else if (as && process.env.NODE_ENV !== 'production') {
115-
console.warn(
116-
"The 'as' property should be used in conjunction with the 'dir' property!"
117-
)
93+
providers = <span dir={finalDir}>{providers}</span>
11894
}
11995

12096
return providers

0 commit comments

Comments
 (0)