Skip to content

Commit bd39f29

Browse files
LFDanLuGitHub Enterprise
authored andcommitted
Fix InlineAlert heading render in Dialog and use contexts from s2 (#185)
* Fix InlineAlert heading render in Dialog, use contexts from s2 where applicable * fix tag group
1 parent 208cfb4 commit bd39f29

File tree

5 files changed

+14
-16
lines changed

5 files changed

+14
-16
lines changed

packages/@react-spectrum/s2/src/ActionButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13-
import {ButtonProps, ButtonRenderProps, Button as RACButton, Text, TextContext, Provider} from 'react-aria-components';
13+
import {ButtonProps, ButtonRenderProps, Button as RACButton, Text, Provider} from 'react-aria-components';
1414
import {baseColor, fontRelative, style} from '../style/spectrum-theme' with { type: 'macro' };
1515
import {pressScale} from './pressScale';
1616
import {StyleProps, focusRing, getAllowedOverrides} from './style-utils' with { type: 'macro' };
@@ -19,6 +19,7 @@ import {useFocusableRef} from '@react-spectrum/utils';
1919
import {ReactNode, forwardRef} from 'react';
2020
import {IconContext} from './Icon';
2121
import {centerBaseline} from './CenterBaseline';
22+
import {TextContext} from './Content';
2223

2324
export interface ActionButtonStyleProps {
2425
/**

packages/@react-spectrum/s2/src/ColorField.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212

1313
import {
1414
ColorField as AriaColorField,
15-
ColorFieldProps as AriaColorFieldProps,
16-
FormContext
15+
ColorFieldProps as AriaColorFieldProps
1716
} from 'react-aria-components';
1817
import {style} from '../style/spectrum-theme' with {type: 'macro'};
19-
import {useFormProps} from './Form';
18+
import {FormContext, useFormProps} from './Form';
2019
import {StyleProps, field, getAllowedOverrides} from './style-utils' with {type: 'macro'};
2120
import {FieldErrorIcon, FieldGroup, FieldLabel, HelpText, Input} from './Field';
2221
import {HelpTextProps, SpectrumLabelableProps} from '@react-types/shared';

packages/@react-spectrum/s2/src/IllustratedMessage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import {filterDOMProps} from '@react-aria/utils';
1414
import {forwardRef, ReactNode, useContext, createContext} from 'react';
1515
import {style} from '../style/spectrum-theme' with {type: 'macro'};
1616
import {IllustrationContext} from './Illustration';
17-
import {HeadingContext, Provider} from 'react-aria-components';
18-
import {ContentContext} from './Content';
17+
import {Provider} from 'react-aria-components';
18+
import {ContentContext, HeadingContext} from './Content';
1919
import {DOMProps, DOMRef} from '@react-types/shared';
2020
import {useDOMRef} from '@react-spectrum/utils';
2121
import {ButtonGroupContext} from './ButtonGroup';

packages/@react-spectrum/s2/src/InlineAlert.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import {ReactNode, forwardRef, useEffect, useRef} from 'react';
2121
import {useDOMRef} from '@react-spectrum/utils';
2222
import {style} from '../style/spectrum-theme' with {type: 'macro'};
2323
import {useFocusRing} from 'react-aria';
24-
import {Provider, HeadingContext} from 'react-aria-components';
25-
import {ContentContext} from './Content';
24+
import {Provider} from 'react-aria-components';
25+
import {ContentContext, HeadingContext} from './Content';
2626
import {IconContext} from './Icon';
2727

2828
export interface InlineAlertProps extends DOMProps, StyleProps, InlineStylesProps {
@@ -183,15 +183,15 @@ let ICONS = {
183183
neutral: undefined
184184
};
185185

186-
const heading = style<InlineStylesProps>({
186+
const heading = style({
187187
marginTop: 0,
188188
gridArea: 'heading',
189189
fontSize: 'ui',
190190
lineHeight: 'ui',
191191
color: '[inherit]'
192192
});
193193

194-
const content = style<InlineStylesProps>({
194+
const content = style({
195195
gridArea: 'content',
196196
fontSize: 'body-sm',
197197
lineHeight: 'body'
@@ -241,9 +241,7 @@ function InlineAlert(props: InlineAlertProps, ref: DOMRef<HTMLDivElement>) {
241241
className={grid}>
242242
<Provider
243243
values={[
244-
// @ts-ignore
245244
[HeadingContext, {className: heading}],
246-
// @ts-ignore
247245
[ContentContext, {className: content}],
248246
[IconContext, {styles: icon({variant, fillStyle})}]
249247
]}>

packages/@react-spectrum/s2/src/TagGroup.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
TagList,
1818
TagListProps,
1919
TagProps as AriaTagProps,
20-
TextContext,
20+
TextContext as RACTextContext,
2121
composeRenderProps,
2222
Provider
2323
} from 'react-aria-components';
@@ -30,7 +30,7 @@ import {fontRelative, style} from '../style/spectrum-theme' with { type: 'macro'
3030
import {pressScale} from './pressScale';
3131
import {createContext, useContext, useRef, forwardRef, ReactNode} from 'react';
3232
import {useDOMRef} from '@react-spectrum/utils';
33-
import {Text, ImageContext} from './Content';
33+
import {Text, ImageContext, TextContext} from './Content';
3434
import {IconContext} from './Icon';
3535
import {CenterBaseline, centerBaseline} from './CenterBaseline';
3636
import {forwardRefType} from './types';
@@ -108,7 +108,7 @@ function TagGroup<T extends object>(
108108
let {size = 'M'} = props;
109109
let domRef = useDOMRef(ref);
110110

111-
let helpText = undefined;
111+
let helpText = undefined;
112112
if (!isInvalid && description) {
113113
helpText = (
114114
<Text
@@ -161,7 +161,7 @@ function TagGroup<T extends object>(
161161
<FormContext.Provider value={{...formContext, size}}>
162162
<Provider
163163
values={[
164-
[TextContext, undefined],
164+
[RACTextContext, undefined],
165165
[TagGroupContext, {size, isEmphasized}]
166166
]}>
167167
<TagList

0 commit comments

Comments
 (0)